Friday, June 18, 2021

How to detach and attach Oracle Home to an inventory

Sometimes when you are working on database patching, you will notice opatch lsinventory will be completely corrupted. In the next few minutes, I will walk you through a step-by-step process of getting it fixed.

#####
Error:
#####
List of Homes on this system:
  Home name= OraGI12c_Home1, Location= "/usr/12.2/grid"
  Home name= agent13c2, Location= "/usr/agent13c/agent_13.2.0.0.0"
  Home name= OraDB12_Home1, Location= "/usr/product/12.2.0.2"
OPatchSession cannot load inventory for the given Oracle Home /usr/agent13c/agent_13.2.0.0.0. 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
   OUI-67073:UtilSession failed: RawInventory gets null OracleHomeInfo
UtilSession failed: RawInventory gets null OracleHomeInfo
Log file location: /usr/agent13c/agent_13.2.0.0.0/cfgtoollogs/opatch/opatch2021-01-02_01-30-00PM_1.log

####
Fix:
####

Detach and attach the home to fix it like below. Then check opatch lsinventory to make sure it is properly fixed. This system is a two-node Oracle RAC. One beauty is, this does not require any database downtime and can be fixed on the fly.

cd /usr/agent13c/agent_13.4.0.0.0/oui/bin
[oracle@sajidserver01 bin]$ ./detachHome.sh ORACLE_HOME=/usr/agent13c/agent_13.2.0.0.0 ORACLE_HOME_NAME=agent13c2 CLUSTER_NODES=sajidserver01, sajidserver02 INVENTORY_LOCATION=/usr/oraInventory LOCAL_NODE=sajidserver01
Launcher log file is /tmp/OraInstall2021/launcher2021-01-02_01-58-40PM.log.
Ignoring command-line variable "INVENTORY_LOCATION=/usr/oraInventory".
Checking swap space: must be greater than 500 MB.   Actual 34811 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
detachHome was successful.
Logs successfully copied to /usr/oraInventory/logs.
cd /usr/agent13c/agent_13.2.0.0.0/oui/bin

Now attach the home.

[oracle@sajidserver01 bin]$ ./attachHome.sh ORACLE_HOME=/usr/agent13c/agent_13.2.0.0.0 ORACLE_HOME_NAME=agent13c2 CLUSTER_NODES=sajidserver01, sajidserver02 INVENTORY_LOCATION=/usr/oraInventory LOCAL_NODE=sajidserver01
Launcher log file is /tmp/OraInstall2021-02-17_02-59-22PM/launcher2021-02-17_02-59-22PM.log.
Checking swap space: must be greater than 500 MB.   Actual 34811 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
attachHome was successful.
Logs successfully copied to /usr/oraInventory/logs.

Check the inventory, it will be fixed.

[oracle@sajidserver01 bin]$ opatch lsinventory
Oracle Interim Patch Installer version 13.9.4.2.2
Copyright (c) 2021, Oracle Corporation.  All rights reserved.
Oracle Home       : /usr/agent13c/agent_13.2.0.0.0
Central Inventory : /usr/oraInventory
   from                  : /usr/agent13c/agent_13.2.0.0.0/oraInst.loc
OPatch version    : 13.9.4.2.2
OUI version       : 13.9.4.0.0
Log file location : /usr/agent13c/agent_13.2.0.0.0/cfgtoollogs/opatch/opatch2021-01-02_07-00-50PM_1.log
   | |  | |  | |
     | |  | |  | |
     | |  | |  | |   Output is Truncated
  \                /
    \            /
      \        /
        \    /
          \/
OPatch succeeded.

Now your inventory is back in business.

1 comment:

  1. Best casino app 2021 - JeTHub
    The 광주 출장샵 best casino 여주 출장마사지 app 김제 출장마사지 2021. 대전광역 출장안마 It's a great opportunity to try out 안성 출장샵 a new casino app, try out some live casino games and gamble online.

    ReplyDelete