Pages

Wednesday, 17 December 2025

Steps to Recreate Lost/corrupted oraInventory in Oracle

 LsInventorySession failed: OPatch failed to locate Central Inventory. The Central Inventory is corrupted or oraInst.loc file specified is not valid OPatch failed with error code 73.


In case if central inventory is lost or corrupted then you will get this type of error. I executed opatch lsinventory and encountered with the below error.



Recreate_corruptes_oraInventory


LsInventorySession failed: OPatch failed to locate Central Inventory.

 Possible causes are:

     The Central Inventory is corrupted

     The oraInst.loc file specified is not valid.

OPatch failed with error code 73 

In this case you need to recreate the oraInventory if someone accidentally deleted or restore the oraInst.loc file if not valid.



Steps to Recreate oraInventory:

STEP 1: Check the oraInventory location.  This file will be located under /etc or /var/opt/oracle directory.

[oracle@orahow-ux ~]$ cat /etc/oraInst.loc

 inventory_loc=/home/oracle/oraInventory

 inst_group=oracle

STEP 2: Find the Oracle Home

There are multiple ways to find the ORACLE_HOME. You can use any of the below methods:

1. [oracle@orahow-ux ~]$ env|grep ORA

 ORACLE_SID=db11g

 ORACLE_HOME=/home/oracle/app/product/11.2.4/dbhome_1


2. [oracle@orahow-ux ~]$ cat /etc/oratab

3. You can also check manually or entry in listener.ora file.


4. Under ORACLE_BASE/cfgtoollogs/dbca, check the trace.log file as shown below.

[oracle@orahow-ux dbca]$ pwd

 /home/oracle/app/cfgtoollogs/dbca

 [oracle@orahow-ux dbca]$ ls -lrt

 total 96

 -rw-r----- 1 oracle oracle 97470 Mar 19 15:01 trace.log_OraDb11g_home1_2019-03-19_03-01-05-PM

 drwxr-x--- 2 oracle oracle     6 Mar 19 15:06 db11g


5. If you have oracle old inventory, then you can view from-

/oraInventory/ContentsXML/inventory.xml

 you can see ORACLE_HOME & ORACLE_HOME_NAME

STEP 2: You can find the ORACLE_HOME_NAME using below methods:

1. [oracle@orahow-ux admin]$ $ORACLE_HOME/patch/opatch lsinventory -all

2. Invoke the runInstaller inside $ORACLE_HOME/oui/bin

-> Select Installed Products

-> The products (ORACLE_HOME_NAME) installed will be displayed

-> Put a check mark on the ORACLE_HOME_NAME and its location will be displayed

 Environment

 The installed ORACLE_HOME_NAME along with Home Path will be displayed. 


3. Under ORACLE_BASE/cfgtoollogs/dbca, check the trace.log file as shown below.

[oracle@orahow-ux dbca]$ ls -lrt

 total 96

 -rw-r----- 1 oracle oracle 97470 Mar 19 15:01 trace.log_OraDb11g_home1_2019-03-19_03-01-05-PM

 drwxr-x--- 2 oracle oracle     6 Mar 19 15:06 db11g

 [main] [ 2019-03-19 15:01:18.676 IST ] [Host.cleanup:3682]  Dbca exit status is: 0

 [main] [ 2019-03-19 15:01:18.676 IST ] [Host.cleanup:3685]  check point context null

 [main] [ 2019-03-19 15:01:18.677 IST ] [InventoryUtil.getOUIInvSession:347]  setting OUI READ level to ACCESSLEVEL_READ_LOCKLESS

 [main] [ 2019-03-19 15:01:18.677 IST ] [InventoryUtil.getHomeName:111]   homeName = OraDb11g_home1

 [main] [ 2019-03-19 15:01:18.677 IST ] [OsUtilsBase.copyFile:1565]  OsUtilsBase.copyFile:

 [main] [ 2019-03-19 15:01:18.678 IST ] [OsUtilsBase.copyFile:1613]  **write of file at destination complete…

 [main] [ 2019-03-19 15:01:18.679 IST ] [OsUtilsBase.copyFile:1648]  **file copy status:= true

 

4. /oraInventory/ContentsXML/inventory.xml 

 

STEP 3: Once you get the ORACLE_HOME and ORACLE_HOME_NAME you can execute the below command to recreate or attach the oraInventory.

Invoke the runinstaller from $ORACLE_HOME/oui/bin/runInstaller.


[oracle@orahow-ux ~]$ $ORACLE_HOME/oui/bin/runInstaller -silent -attachHome ORACLE_HOME=/home/oracle/app/product/11.2.4/dbhome_1 ORACLE_HOME_NAME=OraDb11g_home1

 Starting Oracle Universal Installer…

 Checking swap space: must be greater than 500 MB.   Actual 1159 MB    Passed

 The inventory pointer is located at /etc/oraInst.loc

 The inventory is located at /home/oracle/oraInventory

 'AttachHome' was successful.

STEP 4: Check the opatch lsinventory command.


[oracle@orahow-ux ~]$ $ORACLE_HOME/OPatch/opatch lsinventory

 Oracle Interim Patch Installer version 11.2.0.3.20

 Copyright (c) 2019, Oracle Corporation.  All rights reserved.

 Oracle Home       : /home/oracle/app/product/11.2.4/dbhome_1

 Central Inventory : /home/oracle/oraInventory

    from           : /home/oracle/app/product/11.2.4/dbhome_1/oraInst.loc

 OPatch version    : 11.2.0.3.20

 OUI version       : 11.2.0.4.0

 Log file location : /home/oracle/app/product/11.2.4/dbhome_1/cfgtoollogs/opatch/opatch2019-04-23_18-29-33PM_1.log

 Lsinventory Output file location : /home/oracle/app/product/11.2.4/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2019-04-23_18-29-33PM.txt

 

 Local Machine Information::

 Hostname: orahow-ux

 ARU platform id: 226

 ARU platform description:: Linux x86-64

 Installed Top-level Products (1):

 Oracle Database 11g                                                  11.2.0.4.0

 There are 1 products installed in this Oracle Home.

 Interim patches (1) :

 Patch  28729262     : applied on Tue Apr 02 20:14:47 IST 2019

 Unique Patch ID:  22664181

 Patch description:  "Database Patch Set Update : 11.2.0.4.190115 (28729262)"

    Created on 19 Dec 2018, 22:33:21 hrs PST8PDT


 

 OPatch succeeded.

How to restore oraInst.loc file?

Copy oraInst.loc file from $ORACLE_HOME/oraInst.loc to /var/opt/oracle/oraInst.loc in Solaris or /etc/oraInst.loc in RHEL flavour Linux.

No comments:

Post a Comment