Thursday 5 February 2015

What is oraInventory in Oracle

What is oraInventory?

The oraInventory is the location for the OUI (Oracle Universal Installer) book keeping. The inventory stores information about:
All the Oracle Software Products installed on all ORACLE_HOME on a machine
Other non-oracle products such as Java Runtime env’s (JRE)
In an 11i Application system the RDBMS and IAS ORACLE_HOME are registered in the oraInventory. The 806 ORACLE_HOME, which is not managed through OUI, is not.
On Unix/Linux the location of the oraInventory is defined by the content of oraInst.loc at:
--/var/opt/oracle/oraInst.loc on Solaris and HP-UX
--/etc/oraInst.loc on Linux and AIX
On Windows the location of the oraInventory is defined by the value of the registry key.
HKEY_LOCAL_MACHINE\Software\Oracle\INST_LOC or if this value is not defined at C:\Program File\Oracle\Inventory.

Binary OraInventory:

Before OUI 2.X (or 11.5.7 or earlier) the inventory was binary, the binary or inventory centralize, in a binary format, the location of every Oracle product on the machine and the detail of their patch level. The orainventory location is defined by the content of oraInst.loc.You will have a binary inventory only if ALL of the following conditions are met:
You are on 11.5.7 or earlier (11.5.8+ install XML inventory out of the box)
You have never installed OUI 2.X or higher (Install converts the inventory to XML)
Rapid clone converts the inventory to XML
If the following file exists, the oraInventory is NOT binary.
XML oraInventory:

Starting from OUI2.X and 11.5.8 information in the inventory is stored in the Extensible Markup Language (XML) format.
The XML format allows easier diagnostic of the problem and faster loading of data Rapid Clone requires the inventory to be in XML format in order to clone it, and will take care of performing the binary to XML convention if necessary.

XML inventory is divided into 2 components.

  1. Global Inventory (or Central inventory)

·         Global Inventory holds information about Oracle Product on Machine; the Inventory contains the high level list of all Oracle Products installed on a machine such as ORACLE_HOME or JRE.
·         It doesn’t have any information about the details of patches applied on each ORACLE_HOME.
·         The Global Inventory gets updated every time you install or de-install an ORACLE_HOME on the machine, be it through OUI installer, Rapid Install, or Rapid clone.
·         There should be only one per machine. Its locations is defined in the oraInst.loc in /etc  (on Linux) or /var/opt/oracle.
·         NOTE: if you need to delete an ORACLE_HOME you should always do it through the OUI de-Installer in order to keep the Global Inventory synchronized.

(OR)

A.   What is Global Inventory?

Global Inventory holds Information about Oracle Products on a Machine. These products can be various oracle components like database, oracle application server, collaboration suite, soa suite, forms and reports or discoverer server. The global Inventory location will be determined by file oraInst.loc in /etc. (on Linux) or /var/opt/oracle (Solaris). If you want to see list of oracle products on machine check for file inventory.xml under ContentsXML in oraInventory .Please note if you multiple global Inventory on machine check all oraInventory directories.

  2.  Local Inventory (or Home inventory)

·         There is one local inventory per ORACLE_HOME.
·         Inventory inside each ORACLE HOME is called as local Inventory or ORACLE_HOME Inventory.
·         This Inventory holds information of the patch level for that ORACLE_HOME only.
·         The local Inventory gets update whenever a patch is applied to the ORACLE_HOME,using OUI.

Can I have multiple Global Inventory on machine?

Ans: Yes you can have multiple global Inventory but if you’re upgrading or applying patch then change Inventory Pointer oraInst.loc to respective location.
If you are following single global Inventory and if you wish to uninstall any software then remove if from Global Inventory as well.

What to do if my Global Inventory is corrupted?

If your Global Inventory is corrupted, you can recreate global Inventory on machine using Universal Installer and attach already Installed Oracle Home by Option.

./runInstaller –silent –attacHome –invptrloc $location_to_oraInst.loc ORACLE_HOME=Oracle_Home_Location ORACLE_HOME_NAME=Oracle_Home_Name _db={}

How to recreate Oracle Inventory.

Step 1:

 ]$ cd /u01/app/oracle/oraInventory
oraInventory]$ export PATH=$PATH:$ORACLE_HOME/OPatch
oraInventory]$ opatch lsinv
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/11.2.0
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/oui
Log file location :
/u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2012-06-06_19-08-51PM.log
Patch history file:
/u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location :
/u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2012-06-06_19-08-51PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g                                                
11.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.

Step 2.

Move OraInventory direcotry to oraInventory.old to introduce Oracle Inventory corruption:

oraInventory]$ mv oraInventory oraInventory.old

Step 3.

Try opatch lsinventory again

oraInventory]$ opatch lsinv
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/11.2.0
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/oui
Log file location :
/u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2012-06-06_19-09-54PM.log
Patch history file:
/u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch_history.txt
OPatch failed to locate Central Inventory.
Possible causes are: 
    The Central Inventory is corrupted
    The oraInst.loc file specified is not valid.
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
 
Step 3.

Check the Oracle Home Name from old Oracle Inventory Location.

app]$ cat ./oraInventory.old/ContentsXML/inventory.xml 
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2009, Oracle. All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.1.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/db_1"
TYPE="O" IDX="1"/>
</HOME_LIST>
</INVENTORY>

Step 4.

Re-create the Oracle Inventory.

 oui]$  ./runInstaller -silent -attachHome ORACLE_HOME="/u01/app/oracle/product/11.2.0/db_1" ORACLE_HOME_NAME="OraDb11g_home1"

Step 5.

Verify Oracle Inventory

bin]$ opatch lsinventory
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/11.2.0
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/oui
Log file location : /u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2012-06-06_19-15-54PM.log

Patch history file: /u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch_history.txt
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2012-06-06_19-15-54PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1): 
Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.

Do I need to worry about oraInventory during oracle Apps 11i cloning ?

No, Rapid Clone will update both Global & Local Inventory with required information, you don't have to worry about Inventory during Oracle Apps 11i cloning.

How to Move oraInventory from one location to other?

Find the current location of the central inventory (Normally $ORACLE_BASE/oraInventory):
Open the oraInst.loc file in /etc and check the value of inventory_loc
cat /etc/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall 

Remark: The oraInst.loc file is simply a pointer to the location of the central inventory (oraInventory)

Copy the oraInventory directory to the destination directory
cp -Rp /u01/app/oracle/oraInventory /u02/app/oracle/oraInventory
Edit the oraInst.loc file to point to the new location
vi /etc/oraInst.loc
inventory_loc=/u02/app/oracle/oraInventory
inst_group=dba


Difference between Oracle Home Global Inventory and Local Inventory?

Local Inventrou
Global Inventory
Locat Inventory has the list of products installed on a ORACLE_HOME
Global Inventory has the list of all oracle product installed on machine,which will be in XML format
One local Inventoru per ORACLE_HOME
One Inventory per Machine
It is physical location inside the $ORACLE_HOME/inventory.
Location defined in the content of oraInst.loc
Local Inventory gets updated,when a patch appliced to the $ORACLE_HOME,using OUI.
It records the physical location of oracle product Installed on a machine.Exg: $ORACLE_HOME.JRE
File cannot be recoverd,if the local Inventory corrupted or lost Only solution is to reinstall $ORACE_HOME and re-apply all patches.
Inventery can be recreate if the global Inventory corrupted or lost

Every $ORACLE_HOME must be registered in Global Inventory

The globel Invertory is pointer to each local Inventory located under $ORACLE_HOME/inventory for every $ORACLE_HOME

2 comments: