Friday, September 26, 2014

Fix corrupted oracle inventory

While performing opatch lsinventory to find the patch installed on your ORACLE_HOME for you respective product you will notice the below error.

[oracle@wd20xx ~]$ opatch lsinventory
Invoking OPatch 11.1.0.8.3

Oracle Interim Patch Installer version 11.1.0.8.3
Copyright (c) 2010, Oracle Corporation. All rights reserved.

Oracle Home : /app/oracle/product/fmw/Oracle_WT1
Central Inventory : /home/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.8.3
OUI version : 11.1.0.9.0
OUI location : /app/oracle/product/fmw/Oracle_WT1/oui
Log file location : /app/oracle/product/fmw/Oracle_WT1/cfgtoollogs/opatch/opatch2012-09-28_01-47-22AM.log

Patch history file: /app/oracle/product/fmw/Oracle_WT1/cfgtoollogs/opatch/opatch_history.txt

OPatch detects the Middleware Home as “/app/oracle/product/fmw”

List of Homes on this system:

Home name= OH1519230464, Location= “/app/oracle/product/fmw_wls1035/oracle_common”
Home name= OH1974932413, Location= “/app/oracle/product/fmw_wls1035/WebCenter11?
Home name= OH1108342047, Location= “/app/oracle/product/fmw_wls1035/Oracle_WT1?
Home name= OH1403486144, Location= “/app/oracle/product/fmw/oracle_common”
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

#######
Reason#
#######

1) Corrupted Inventory
2) Oracle Inventory pointing to incorrect inventory location
3) Oracle Home not attached properly.

############################################
Fix 1 to point to correct oraInst.loc file##
############################################

1) Login to the Box as oracle
2) Export the below env variables
export ORACLE_HOME=/app/oracle/product/fmw/Oracle_WT1
export PATH=$PATH:$ORACLE_HOME/OPatch
3) opatch lsinventory -invPtrLoc /app/oracle/product/fmw/Oracle_WT1/oraInst.loc

####################################
Fix 2 to re-attach the Oracle_Home##
####################################

1) Login to the Box as oracle
2) Export the below env variables
export ORACLE_HOME=/app/oracle/product/fmw/Oracle_WT1
export PATH=$PATH:$ORACLE_HOME/OPatch
3) Compare and see if both oraInst.loc file is pointing to the correct inventory location.If not point to the same Inventory location.

[oracle@wd20xx bin]$ cat /app/oracle/product/fmw/Oracle_WT1/oraInst.loc
inventory_loc=/home/oracle/oraInventory
inst_group=dba

[oracle@wd20xx bin]$ cat /etc/oraInst.loc
inventory_loc=/home/oracle/oraInventory
inst_group=dba

3) cd $ORACLE_HOME/oui/bin
4) Run the command –> ./runInstaller -silent -attachHome ORACLE_HOME=/app/oracle/product/fmw/Oracle_WT1 ORACLE_HOME_NAME=Oracle_WT1

You will get ORACLE HOME attached successfull message after running the above command.

Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB. Actual 12283 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2012-09-28_02-38-37AM. Please wait …[oracle@wd2072 bin]$ The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /home/oracle/oraInventory
‘AttachHome’ was successful.

5) Run opatch lsinventory to list all the available interim patches