Tuesday 5 July 2011

Unable to Run Opatch Cleanup on Grid Infrastructure Home

In an environment where you have the Grid Infrastructure software installed (ie for RAC or ASM configurations), it is important to remember to unlock the software home before performing activities such as cleaning up the OPatch storage.

Databases deployed with no Grid Infrastructure software will not have this issue.

A. Steps to Reproduce Issue


The following command was executed when attempting to clean up the patch storage:
oracle@lnx01:[GRID]$ export ORACLE_SID=GRID; . oraenv
oracle@lnx01:[GRID]$ $ORACLE_HOME/OPatch/opatch util cleanup


B. Error Reported


The following output error was reported below:
Invoking OPatch 11.2.0.1.5
Oracle Interim Patch Installer version 11.2.0.1.5
Copyright (c) 2010, Oracle Corporation.  All rights reserved.
UTIL session
Oracle Home       : /u01/app/oracle/11.2.0.2/grid
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oracle/oraInst.loc
OPatch version    : 11.2.0.1.5
OUI version       : 11.2.0.2.0
OUI location      : /u01/app/oracle/11.2.0.2/grid/oui
Log file location : /u01/app/oracle/11.2.0.2/grid/cfgtoollogs/opatch/opatch2011-05-04_10-36-59AM.log
Patch history file: /u01/app/oracle/11.2.0.2/grid/cfgtoollogs/opatch/opatch_history.txt

OPatchSession cannot load inventory for the given Oracle Home /u01/app/oracle/11.2.0.2/grid. Possible causes are:
   No read or write permission to ORACLE_HOME/.patch_storage
   Central Inventory is locked by another OUI instance
   No read permission to Central Inventory
   The lock file exists in ORACLE_HOME/.patch_storage
   The Oracle Home does not exist in Central Inventory
UtilSession failed: Locker::lock() mkdir /u01/app/oracle/11.2.0.2/grid/.patch_storage

C. Solution 


1. Unlock the Grid Infrastructure Home:
oracle@lnx01:[GRID]$ export ORACLE_SID=GRID; . oraenv
oracle@lnx01:[GRID]$ sudo $ORACLE_HOME/crs/install/rootcrs.pl -unlock


2. Perform the OPatch storage cleanup:
oracle@lnx01:[GRID]$ $ORACLE_HOME/OPatch/opatch util cleanup

3. Lock the Grid Infrastructure Home:
oracle@lnx01:[GRID]$ sudo $ORACLE_HOME/crs/install/rootcrs.pl -patch