Sunday, October 25, 2009

Find IP Address and Host Name of Oracle Server from Client Environment

Invoke the following section to get the Oracle Database Server IP Address from Client Environment.

set serveroutput on
BEGIN
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME); -- get local host name
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS); -- get local IP addr
END;
/


Get the IP Address of the client

select SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) ipaddr from dual;

Wednesday, September 30, 2009

Move or Rename Oracle Datafiles

Move or rename the datafiles from current location to another one. Then startup the database in mount mode as:

startup mount

Then rename the datafile as below:

alter database rename file '/abc/mydatafile.dbf' to '/xyz/mydatafile.dbf';

This will update the location of datafile in control file. Then open the database as

alter database open;

You can now view the location of datafile from the v$datafile view.

Identify Oracle Patches Applied in AIX Server

List of installed patches

$ORACLE_HOME/OPatch/opatch lsinventory

Detail List of installed patches

$ORACLE_HOME/OPatch/opatch lsinventory -details

Enviornment variable $ORACLE_HOME must be set.