Showing posts with label Critical Patch Update (CPU). Show all posts
Showing posts with label Critical Patch Update (CPU). Show all posts

Sunday, June 15, 2008

How to apply Critical Patch Update using Opatch

1. Download interim patch to /home/patchnumber (ftp updates.oracle.com with metalink user id and password)

2. Shutdown the databases and listener

3. Set env variables

setenv ORACLE_HOME /oracle/10.2.0
setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib
setenv TNS_ADMIN ${ORACLE_HOME}/network/admin
set filec
setenv PATH .:/usr/sbin:/usr/bin:$ORACLE_HOME/Opatch:$ORACLE_HOME/bin

4. Install patch

cd /home/4567866
opatch apply

5. Start the affected database and complete the post installation steps

cd $ORACLE_HOME/cpu/CPUOct2005
sqlplus "/as sysdba"
sql> startup
sql> @catcpu.sql
SQL> @?/rdbms/admin/utlrp.sql
6. Start listener

Patch Deinstallation Instructions
To de-install the patch, set your current directory to the directory where the patch is located and then run opatch by entering the following command:

cd 4567866
opatch rollback -id 4567866

Start up all database instances running out of the ORACLE_HOME being patched.For each database instance running out of the ORACLE_HOME being patched, connect to the database using Sqlplus as sysdba and run catcpu_rollback.sql as follows -

cd $ORACLE_HOME/cpu/CPUOct2005
sqlplus /nolog
SQL> connect / as sysdba

SQL> STARTUP
SQL> @catcpu_rollback.sql
SQL> QUIT

Inspect the logfile and utlrplog files for any errors.
If catcpu.sql reports any Invalid Objects, Oracle recommends that you compile the invalid objects using the following;


cd $ORACLE_HOME/rdbms/admin

sqlplus /nolog
SQL> connect / as sysdba
SQL> @utlrp.sql
SQL> QUIT

You can check for any invalid objects by executing following statement;
select OBJECT_NAME from DBA_OBJECTS where status = 'INVALID';


Functions within Opatch

If you type opatch -h you will get a helplist over commands that can be used in opatch.
Here are some of them :

opatch apply -- Used to apply a patch

opatch apply -force --Used to apply patch even if there is a conflict due to previous applied interim patch. This will deinstall the previous one and install this one.

opatch lsinventory --Used to list the inventory for a particular $ORACLE_HOME or display all installations that can be found.

Opatch version Used to provide the version of the opatch utility.

If applying -report to any command everything will be printed on screen without executing the actions
To every command there is a number of arguments that can be used. To see the arguments issue the command -help along with the command to display the options.
Ex. opatch apply -help