Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

Find the Useful OPATCH Commands for Oracle Database

Posted by Mir Sayeed Hassan on May 2nd, 2022

Find the Useful OPATCH Commands for Oracle Database

List inventory details of patch.

[oracle@miroradb ~]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0.4/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/db_1/oraInst.loc
OPatch version : 11.2.0.3.4
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2022-05-02_10-04-31AM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/lsinv/lsinventory2022-05-02_10-04-31AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.

List patchsets applied :

[oracle@miroradb ~]$ $ORACLE_HOME/OPatch/opatch lspatches
There are no Interim patches installed in this Oracle Home.

Find opatch version:

[oracle@miroradb ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.

Find details of a particular patch(before applying):

$ORACLE_HOME/OPatch/opatch query -all {PATCH_PATH}
$ORACLE_HOME/OPatch/opatch query -all /home/oracle/patch/19282021

Apply a patch to RDBMS HOME:

— You may need to shutdown the database and listener services:

cd /home/oracle/patch/30089984 -- Go to the patch path:
$ORACLE_HOME/OPatch/opatch apply

Check to Rollback an patch from RDBMS HOME:

$ORACLE_HOME/OPatch/opatch rollback -id [patch_id]
$ORACLE_HOME/OPatch/opatch rollback -id 19282021

How to Apply one off patch in grid_home:

root # $GI_HOME/crs/install/rootcrs.sh -prepatch.

oracle$ cd /home/oracle/patch/19282021 -- Go to the patch path:
oracle$ $GRID_HOME/OPatch/opatch apply

root# $GI_HOME/crs/install/rootcrs.sh -postpatch

Check conflict against ORACLE_HOME

- go to patch folder.
cd 19282021

[19282021]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Check whether active executables are running:

- go to patch folder.
cd 19282021

[19282021]$ $ORACLE_HOME/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./

Find the Opatch command using different inventory location:

$ORACLE_HOME/OPatch/opatch lsinventory -invPtrLoc /etc/orainv/orainventory