As every Apps DBA knows, we apply alot of patches. For some reason, every now and then, the global inventory gets corrupted (for lack of a better term) in our cloned environments. For example:
oraora@myserver=> opatch lsinventory
Oracle Interim Patch Installer version 1.0.0.0.55
Copyright (c) 2006 Oracle Corporation. All Rights Reserved..
We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com
Oracle Home = /oradata/app/oradb/920_64bit
Location of Oracle Universal Installer components = /oradata/app/oradb/920_64bit/oui
Location of OraInstaller.jar = "/oradata/app/oradb/920_64bit/oui/jlib"
Oracle Universal Installer shared library = /oradata/app/oradb/920_64bit/oui/lib/solaris/liboraInstaller.so
Location of Oracle Inventory Pointer = /var/opt/oracle/oraInst.loc
Location of Oracle Inventory = /oradata/app/oradb/920_64bit/inventory
Path to Java = /oradata/app/oradb/920_64bit/jre/1.4.2/bin/java
Log file = /oradata/app/oradb/920_64bit/.patch_storage//*.log
Creating log file "/oradata/app/oradb/920_64bit/.patch_storage/LsInventory__03-05-2007_16-43-00.log"
Result:
LsInventory: OPatch Exception while accessing O2O
OPATCH_JAVA_ERROR : An exception of type "OPatchException" has occurred:
OPatch Exception:
OUI found no such ORACLE_HOME set in the environment
Can not get details for given Oracle Home
An exception occurs
null
There is no Interim Patch
OPATCH_JAVA_ERROR : An exception of type "OPatchException" has occurred:
Can not get a list of inventory on this home.
ERROR: OPatch failed because of Inventory problem.
If you do a search on metalink you'll see a few potential resolutions which range from verifying your oraInst.loc file to manually editing the inventory.xml file within your global inventory.
For 11i environemnts, Oracle provides us with a method to recreate the global inventory. For complete details you can view Note:295185.1 but the key steps are:
1. Verify ora inventory_loc within oraInst.loc
2. Take a backup of your inventory location.
3. Make sure you are on OUI 2.2 or later.
If your iAS ORACLE_HOME is missing from the inventory.xml file:
4. Sync your apps environment file.
5. Change to $IAS_ORACLE_HOME/appsoui/setup and execute perl OUIsetup.pl
If your RDBMS ORACLE_HOME is missing from the inventory.xml file:
4. Sync your database environment file.
5. Change to $ORACLE_HOME/appsoui/setup and execute perl OUIsetup.pl
ex. Excuting on the database tier:
oraora@myserver=> . ./DBORA.env
oraora@myserver=> cd $ORACLE_HOME/appsoui/setup
oraora@myserver=> perl OUIsetup.pl
ORACLE_HOME : /oradata/app/oradb/920_64bit (APPSDB_ORA)
OUI Location : /oradata/app/oradb/920_64bit/appsoui/oui
CLASSPATH : /oradata/app/oradb/920_64bit/appsoui/setup/OUISetup.jar:/oradata/app/oradb/920_64bit/appsoui/oui/lib/OraInstaller.jar:/oradata/app/oradb/920_64bit/appsoui/oui/lib/xmlparserv2.jar
JRE_INST : /oradata/app/oradb/920_64bit/appsoui/jre/1.1.8
Executing OUI setup now:
/oradata/app/oradb/920_64bit/appsoui/jre/1.3.1/bin/java -classpath /oradata/app/oradb/920_64bit/appsoui/setup/OUISetup.jar:/oradata/app/oradb/920_64bit/appsoui/oui/lib/OraInstaller.jar:/oradata/app/oradb/920_64bit/appsoui/oui/lib/xmlparserv2.jar -DDEBUG_MODE=false oracle.apps.ad.util.OUISetup /oradata/app/oradb/920_64bit /oradata/app/oradb/920_64bit/appsoui/oui /oradata/app/oradb/920_64bit/appsoui/jre/1.1.8 APPSDB_ORA
Log file : /oradata/app/oradb/920_64bit/appsoui/setup/OUIsetup.log
Checking inventory ...
Updating registration of ORACLE_HOME in global inventory...
Oracle home registration completed.
Removing OUI entries from the global inventory: /oradata/home/oraagf/oraInventory/ContentsXML/comps.xml
Removing OUI entries from the global inventory completed successfully
Registering the OUI component with local inventory...
OUI 2.2 registration completed.
OPatch lsinventory should now work fine.