The purpose of this blog is to assist DBAs in resolving issues encountered while applying or rolling back OPatch in an Oracle database. , we faced the issue “OPatch Unable to lock Central Inventory.” This document details our troubleshooting steps and solutions to address this problem.
Below are the steps:
Issue:
While we try to rollback the opatch we faced the issue OPatch Unable to lock Central Inventory.
[orappl@clonedbOPatch]$ opatch rollback -id 31424070Oracle Interim Patch Installer version 12.2.0.1.42
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/test_db/tech_st/19.3.0
Central Inventory : /opt/oracle/oraInventory
from : /u01/test_db/tech_st/19.3.0/oraInst.loc
OPatch version : 12.2.0.1.42
OUI version : 12.2.0.7.0
Log file location : /u01/test_db/tech_st/19.3.0/cfgtoollogs/opatch/opatch2024-06-30_12-33-05PM_1.log
Unable to lock Central Inventory. OPatch will attempt to re-lock.
Do you want to proceed? [y|n]
y
User Responded with: Y
OPatch will sleep for a few seconds before re-trying to get the lock…
Unable to lock Central Inventory. OPatch will attempt to re-lock.
Do you want to proceed? [y|n]
y
User Responded with: Y
OPatch will sleep for a few seconds before re-trying to get the lock…
Unable to lock Central Inventory. OPatch will attempt to re-lock.
Do you want to proceed? [y|n]
ISSUE:
While we try to rollback the opatch we faced the issue OPatch Unable to lock Central Inventory.
opatch apply Fails with Error : “Unable to lock Central Inventory” (Doc ID 861677.1)
Cause:
The main cause for this issue is permission problems on the Central Inventory directory: /opt/oracle/oraInventory
[orappl@clonedboracle]$ ll
drwxr-xr-x. 3 oracle oinstall 17 Jul 21 2021 product
drwxrwx—. 2 oracle oinstall 6 Jul 21 2021 checkpoints
drwxrwxr-x. 23 oracle oinstall 4096 Jul 21 2021 diag
drwxr-xr-x. 4 oracle oinstall 47 Aug 2 2021 orachk
drwxrwx—. 5 oracle oinstall 92 Aug 3 2021 oraInventory.080321
drwxr-xr-x. 4 oracle oinstall 37 Nov 9 2021 oraInventory
[orappl@clonedboracle]$ pwd/opt/oracle
[orappl@clonedb~]$ iduid=54323(orappl) gid=54331(orappl) groups=54331(orappl),54321(oinstall) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Solution:
Switch to the root user and change the permissions of the oraInventory directory:
[root@clonedb~]# cd /opt/oracle [root@clonedboracle]# chown -R orappl:orappl oraInventory
Then, try to roll back OPatch again:
[orappl@clonedbOPatch]$ opatch rollback -id 31424070Oracle Interim Patch Installer version 12.2.0.1.42
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/test_db/tech_st/19.3.0
Central Inventory : /opt/oracle/oraInventory
from : /u01/test_db/tech_st/19.3.0/oraInst.loc
OPatch version : 12.2.0.1.42
OUI version : 12.2.0.7.0
Log file location : /u01/test_db/tech_st/19.3.0/cfgtoollogs/opatch/opatch2024-06-30_12-45-06PM_1.log
Patches will be rolled back in the following order:
31424070
The following patch(es) will be rolled back: 31424070
Rolling back patch 31424070…
RollbackSession rolling back interim patch ‘31424070’ from OH ‘/u01/test_db/tech_st/19.3.0’
Patching component oracle.rdbms, 19.0.0.0.0…
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0…
RollbackSession removing interim patch ‘31424070’ from inventory
Log file location: /u01/test_db/tech_st/19.3.0/cfgtoollogs/opatch/opatch2024-06-30_12-45-06PM_1.log
OPatch succeeded.
[orappl@clonedbOPatch]$Thanks for visiting our blog. We hope the steps above help you resolve the issue you encountered.