Tuesday, January 15, 2013

ORACLE - Opatch : Install & De-install procedure

Prerequisites:
DB Version
: 11gR1
Utility Required : Opatch version 11.1.0.8.2 or later
Download Location: My Oracle Support patch 6880880
Note: Keep backup of /u01 or all binaries.

Install Opatch 11.1.0.8.2 This needs to be done on both ASM and database homes.
. profile_GENERIC $ORACLE_SID
cd $ORACLE_HOME
mv OPatch Opatch_old
cp /dba/staging/patch/Opatch/p6880880_111000_Linux-x86-64.zip $ORACLE_HOME
unzip p6880880_111000_Linux-x86-64.zip
opatch lsInventory  (Verify that it is 11.1.0.8.2 )

Download patch 11.1.0.7.11 :
 Download patch p13621679_111070_Linux-x86-64.zip  
 unzip p13621679_111070_Linux-x86-64.zip

Patch ASM : Patch Pre-install Steps Source ASM environment . .profile_GENERIC +ASM

Check patch conflicts
Determine whether any currently installed one-off patches conflict with the PSU patch as follows:
RUN:
/u01/app/oracle/product/11.1.0/db_1/OPatch/opatch prereq
CheckConflictAgainstOHWithDetail -phBaseDir /dba/staging/patches/PSU/April2012/13621679

Install Steps:
Generate a script file of all the steps executed :
Patch needs to be applied on ASM home and each Database home :->
If you are using a Data Guard Physical Standby database, you must install this patch on both the primary database and the physical standby database, as described by My Oracle Support Note 278641.1.

Shutdown all databases and listeners including ASM
/dba/maestro/db_stop_all.sh
ps -ef | grep pmon
ps -ef | grep tns
ps -ef | grep oracle
$ORA_PERL/rac/ocr_resources.sh

Apply patch to ASM -Make sure the New Opatch is vailable in the ASM ORACLE_HOME
cd /dba/staging/patches/PSU/April2012/13621679
echo $ORACLE_HOME  ( Verify the home is correctly set to ASM)
opatch lsinventory
opatch apply
opatch lsinventory (Verify that the PSU is listed in the output)

Start all databases and listeners including ASM
/dba/maestro/db_start_all.sh
ps -ef | grep pmon
ps -ef | grep tns
ps -ef | grep oracle  ( Make sure every thing has been started)
$ORA_PERL/RAC/ocr_resources.sh

Patch DATABASE
Patch Pre-install Steps

Check patch conflicts
Determine whether any currently installed one-off patches conflict with the PSU patch as follows:
RUN:

/u01/app/oracle/product/11.1.0/db_1/OPatch/opatch prereq
CheckConflictAgainstOHWithDetail -phBaseDir /dba/staging/patches/PSU/April2012/13621679

Check invalid objects:

Check invalid objects on all databases to which the PSU is being applied and save them for post install compare.

Check services online/offline
Check services on all databases to which the PSU is being applied and save them for post install compare
$ORA_PERL/rac/ocr_resources.sh

Install Steps Apply the patch to each database home(DB_1,DB_2,DB_3,DB_4 etc) after sourcing the appropriate database profile.
. .profile_GENERIC <ORACLE_INSTANCE>
cd /home/oracle
echo $ORACLE_HOME ( Verify the home is correct)
/dba/maestro/stop<db_1/2/3/4>.sh
cd /dba/staging/patches/PSU/April2012/13621679
opatch lsinventory
opatch apply
opatch lsinventory ( Verify that the PSU is listed in the output)
 
Patch Post-install Steps
Post Installation steps need to be run for each database using oracle home that is being patched except ASM

1. Apply the patch conflict resolution one-off patches that were determined to be needed when you performed the steps in Pre-install one-off-conflict step.

2. The following steps load modified SQL files into the database. For a RAC environment, perform these steps on only one node.

Run catbundle.sql

. .profile_GENERIC <ORACLE_SID>
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
CONNECT / AS SYSDBA
startup
@$ORACLE_HOME/rdbms/admin/catbundle.sql psu apply
shutdown immediate

Check the following log files in $ORACLE_HOME/cfgtoollogs/catbundle for any errors :
cd $ORACLE_HOME/cfgtoollogs/catbundle
grep ORA- catbundle_PSU_<ORACLE_SID>_APPLY_<TIMESTAMP>.log
grep ORA- catbundle_PSU_<ORACLE_SIDS>_GENERATE_<TIMESTAMP>.log

Check invalid objects:

Start Database and listeners :
Startup all the databases after completing the catbundle script is run
cd /home/oracle
. .profile_GENERIC <ORACLE_SID>
echo $ORACLE_HOME <--- Verify the home is correct
/dba/maestro/start<db_1/2/3/4>.sh

Run Opatch :
1. Run opatch lsinventory on both nodes and on DR also to verify the patch applied. $ORACLE_HOME/OPatch/opatch lsinventory
Review Script Log :
2. Review the script log for any error during patch application.
view /dba/staging/patches/PSU/April2012/script.log

Patch De-install Steps:
1. Follow these steps for each node in the cluster, one node at a time:
2. Shut down the instance on the node. (Shut down all RDBMS instances before any ASM instances.)
3. Run the OPatch utility specifying the rollback argument as follows.

opatch rollback -id 10248531

4. Start the instance on the node. Depending on the type of home, enter the following commands:

/dba/maestro/stop<db_1/2/3/4>.sh

5. From on the node where post-install step 2 was executed do the following.

Start all database instances running from the Oracle home.
For each database instance running out of the ORACLE_HOME, connect to the database using SQL*Plus as SYSDBA and run the rollback script as follows:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU_<database SID>_ROLLBACK.sql
SQL> QUIT
In a RAC environment, the name of the rollback script will have the format catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql.
Check the log file for any errors. The log file is found in $ORACLE_HOME/cfgtoollogs/catbundle and is named catbundle_PSU_<database SID>_ROLLBACK_<TIMESTAMP>.log.

No comments:

Post a Comment