Wednesday, February 17, 2016

Oracle Database Patching (OPatch)

Oracle Database Patching (OPatch)

Patch is required for any bug fix or some additional features. Databse patches are mainly applied for security fixes, Priority fixes and patchset is used for upgradation like 10.2.0.1 to 10.2.0.4.

Critical Patch Update(CPU): These are the patches for security fixes and released each quarter.

Patch Set Update(PSU): These are cumulative patches that include both security fixes and priority fixes. PSU are the minor version upgrades (e.g., 11.2.0.1.1 to 11.2.0.1.2).

Once PSU is applied, PSU has to be applied each quarter till we upgrade our database to new base version.

How do we apply Oracle database patches?

Patches are downloaded from metalink (My Oracle Support) and it has readme.txt file with the patching instructions and we can follow as suggested by oracle with read me file.

Basic steps to follow for applying database patch:

Database Version
OS version
Opatch Version
Download CPUJan2012 patch for 11.2.0.2.0
Unzip the patch and read the instructions from read me file.
Sessions Status
Invalid objects
Shutdown database and listner.
Backup the $ORACLE_HOME and Inventory
Go to patch directory : Opatch apply
Apply Opatch
Verify the status of patch applied
Post Installation
Start listener and database.
Check the status from registry$history
Recompiling Views in Database

Log location of Opatch:

$ORACLE_HOME/cfgtoollogs/opatch

Significance of utlrp.sql and catcpu.sql:

Utlrp.sql :- location of utlrp.sql is $ORACLE_HOME/rdbms/admin. This script is used to compile the invalid objects.

Catcpu.sql :- catcpu.sql calls a script called catbundle.sql, which is located at $ORACLE_HOME/rdbms/admin.
This script will load sql file in database by looking into bundledata_cpu.xml for file information for a particular patch. It will be creating a dynamic apply sql file and run it.

Note: Set the appropriate environment variables before applying patches

export ORACLE_HOME=/u03/oracle/JECLN/u01/oracle/PROD/db/tech_st/11.1.0/

export PATH=$PATH:$HOME/bin:/u03/oracle/JECLN/u01/oracle/PROD/db/tech_st/11.1.0/OPatch/

export PATH=$PATH:$ORACLE_HOME/Opatch

No comments:

Post a Comment