打补丁报错Opatch error : "Unable to lock Central Inventory

来源:互联网 发布:淘宝卖家寄恐怖东西 编辑:程序博客网 时间:2024/05/02 12:19

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 10.2.0.4 [Release 9.2 to 10.2]
Information in this document applies to any platform.
This problem can occur on any UNIX platform

***Checked for relevance on 29-Mar-2013***

Symptoms

Opatch apply failing with following errors

  Unable to lock Central Inventory. OPatch will attempt to re-lock.
  Do you want to proceed? [y|n]

Following are the messages during 'opatch apply'

[oracle@ccuine19 5596276]$ id
uid=500(oracle) gid=500(oinstall) groups=100(users),500(oinstall)

[oracle@ccuine19 5596276]$ opatch apply
Invoking OPatch 10.2.0.4.7

Oracle Interim Patch Installer version 10.2.0.4.7
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /db/dr/drdb/10.2.0
Central Inventory : /etc/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.7
OUI version       : 10.2.0.4.0
OUI location      : /db/dr/drdb/10.2.0/oui
Log file location : /db/dr/drdb/10.2.0/cfgtoollogs/opatch/opatch2009-07-22_10-
50-24AM.log

Patch history file: /db/dr/drdb/10.2.0/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '5596276' to OH '/db/dr/drdb/10.2.0'
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 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]

Cause

Cause 1: Main cause for this issue is permissions problem.

Oracle user does not have WRITE permissions on "<oraInventory>/locks" in order to create writer.lock for locking the central inventory. Below is the cause justification

OS user being used to apply the patch is "oracle" and permissions on 'oraInventory' contents are 

[oracle@ccuine19 oraInventory]$ id 
uid=500(oracle) gid=500(oinstall) groups=100(users),500(oinstall)

[oracle@ccuine19 oraInventory]$ ls -la
total 40
drwxrwxrwx    6 oracle oinstall   4096 Jul 20 14:27 .
drwxr-xr-x  116 root   root      12288 Jul 21 15:42 ..
drwxrwxrwx    2 oracle oinstall   4096 Jul  8 18:28 Contents
drwxrwxrwx    2 oracle oinstall   4096 Jul 14 12:00 ContentsXML
-rwxrwxrwx    1 oracle oinstall     37 Jul 21 14:27 install.platform
drwxr-xr-x    2 testdb oinstall   4096 Jul 21 14:28 locks
drwxrwx---    2 oracle oinstall   4096 Jul 22 12:20 logs


There are two oracle users "oracle" and "testdb" sharing the same central inventory (i.e oraInventory). But some how write permissions on "locks" folder is set to "testdb" only. Which is causing "oracle" user unable to create writer.lock file inside "locks" folder and thus the error "Unable to lock Central Inventory".

Cause 2:
Another possible cause for this issue is previous failed/unsuccessful patching activity which leaves write.lock (in oraInventory>/locks/) and/or patch_locked (in $ORACLE_HOME/.patch_storage/)

NOTE:257800.1 OPATCH: Interim Patch is holding the lock from this patch
NOTE:73123.1 Universal Installer / OPatch tools are Hanging and / or Fail to Install

Verified and found that this issue is not due to previous failed/unsuccessful patching activity because files patch_locked and/or writer.locked do not exist in given locations.

[oracle@ccuine19 5596276]$ cat /etc/oraInst.loc  
inventory_loc=/etc/oraInventory  
inst_group=oinstall
[oracle@ccuine19 5596276]$ ls /etc/oraInventory/locks 
[oracle@ccuine19 5596276]$ ls $ORACLE_HOME/.patch_storage 
5596276_Apr_22_2008_05_54_46/  
 

Solution

To implement the solution, please execute the following steps:

1. Verify and ensure that oracle user, who is running the opatch/runInstaller command, has WRITE permissions on central inventory (i.e "oraInventory") and its contents 

$ ls -la <oraInventory>

2. If same central inventory (i.e oraInventory) is used for multiple Oracle Home installations using different OS user accounts (Example: 'oracle:oinstall' and 'testdb:oinstall'), then ensure that central inventory (i.e oraInventory) has GROUP (i.e oinstall) WRITE permissions so that any user account (oracle:oinstall OR testdb:oinstall) fall under same GROUP (i.e oinstall) can have proper permissions (read/write) to access/update the central inventory.

3. If problem persists even after having proper WRITE permissions for oracle user, then problem is due to presence of following files (mentioned underCause 2)
       <oraInventory>/locks/writer.lock
               and/or
      $ORACLE_HOME/.patch_storage/patch_locked
Verify and ensure that these two files are not present in menitoned locations.

Following is the solution for the issue due to permissions problem

- Grant group WRITE permissions on oraInventory folder and its contents

# cat /etc/oraInst.loc 
inventory_loc=/etc/oraInventory 
inst_group=oinstall 
# chmod -R g+w /etc/oraInventory

- Re-try applying the patch

原创粉丝点击