Sunday, 28 April 2019

Applying database Patch (Opatch)


Below are the steps for applying quarterly PSU patch on Oracle 11g database.

1: Check the OS Version:

$uname -a





2: Check the database version:
There are many methods to check the database version but we will use 'opatch lsinventory' command because it will give information about Oracle version and details about Opatch also.

$opatch lsinventory 
















Here we can notice two things
OPatch version    : 11.2.0.1.7
Oracle Database 11g: 11.2.0.3.0

3:  Download the patch: 
You can download a patch from my oracle support(meta link). While downloading make sure you are downloading the patch for the correct operating system bit version.

4: Move the downloaded patch to the server and unzip it.

Note: If your Opatch version is lower. Then you need to download required Opatch utility from Oracle meta link. After downloading Opatch utility move that Opatch zip file to $ORACLE_HOME. Then remove the existing Opatch directory and Unzip the new Opatch zip file. After unzip is finished check the version of Opatch again. You can use 'opatch lsinventory' command or you can use 'opatch version' command.









5: Check for the Prerequisites:
Go to patch directory and run following command.

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

















6: Shutdown the Database and listener.

SQL> shutdwon immediate

$ lsnrctl stop ORCL

7: Check for active executables:

$ opatch prereq CheckActiveFilesAndExecutables -ph ./

















8: Apply the Patch:
Go to patch directory and Issue the following command to apply Patch.

$ opatch apply































You can see the patch has been applied successfully.

9: Check the inventory, whether the patch has been updated or not:

$opatch lsinventory






















You can notice the output contains the patch details we have applied.

10: Now startup the database and listener:

SQL> startup

lsnrctl start ORCL


NOTE: If it is PSU patch then run the Post-Patch script:

$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus / as sysdba
SQL> @catbundle.sql psu apply
quit






No comments:

Post a Comment

Ask your Questions....