Today I have hit the following issue while executing the 'opatch lsinventory' command in 11gR2 database.
Based on the error message "LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo", it seems to be ORACLE_HOME '<ORACLE_HOME>' is not registered in the Central Inventory i.e 'Central Inventory : /u01/db_hyd/oraInventory'. To fix this issue we can register or attach the database ORACLE_HOME information to the existing Central Inventory.
-bash-3.2$ $ORACLE_HOME/OPatch/opatch lsinventory -invPtrLoc $ORACLE_HOME/oraInst.loc
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /u01/db_hyd/11.2.0.4
Central Inventory : /u01/db_hyd/oraInventory
from : /u01/db_hyd/11.2.0.4/oraInst.loc
OPatch version : 11.2.0.3.4
OUI version : 11.2.0.4.0
Log file location : /u01/db_hyd/11.2.0.4/cfgtoollogs/opatch/opatch2020-06-23_05-36-23AM_1.log
List of Homes on this system:
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
Oracle Home dir. path does not exist in Central Inventory
Oracle Home is a symbolic link
Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo
OPatch failed with error code 73
-bash-3.2$
Based on the error message "LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo", it seems to be ORACLE_HOME '<ORACLE_HOME>' is not registered in the Central Inventory i.e 'Central Inventory : /u01/db_hyd/oraInventory'. To fix this issue we can register or attach the database ORACLE_HOME information to the existing Central Inventory.
Execute following steps to fix this issue:
1) Backup the existing oraInventory (Central Inventory : /u01/db_hyd/oraInventory)
-bash-3.2$ cp -r oraInventory oraInventory.Orig
-bash-3.2$
2) Register or Attach the database ORACLE_HOME information to the existing Central Inventory using following command.
Hope this article will help you :-)
-bash-3.2$ cd $ORACLE_HOME/oui/bin
-bash-3.2$ ./attachHome.sh
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 32767 MB Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/db_hyd/oraInventory
'AttachHome' was successful.
-bash-3.2$
3) Now execute 'OPatch lsinventory' command to check the ORACLE_HOME details-bash-3.2$ $ORACLE_HOME/OPatch/opatch lsinventory -detail
Hope this article will help you :-)