Oracle Inventory and what it means to

Whilst presenting on Exadata patching, an interesting question about “What is the Inventory”, came up at break. This individual was new to Oracle, so I spent some time going over what the Oracle Inventory is. Here is the brain dump captured 🙂

The Oracle [Software] Inventory is the mechanism that manages the software library on the server, a.k.a Oracle System. An Oracle system is server or node where Oracle software is installed. A key part of this inventory is the OUI, opatch and the inventory file. We will touch on some of these topics.

Oracle Inventory is the XML file that is stored and managed when the OUI installer (runInstaller from media) is used to installed Oracle productset.

On each Oracle system there is a Central Inventory and Local Inventory. This structure is built when oraInstRoot.sh is executed
The Central Inventory is at location defined by /etc/oraInst.loc file (specifically the inventory_loc variable), it is typically installed at $ORACLE_BASE/oraInventory, and it defines at high level the location of the registered Oracle_Homes (OH) on the system. The actual inventory file is named:
$ORACLE_BASE/oraInventory/ContentsXML/inventory.xml.

The invPtrLoc variable can used during the runInstaller invocation to point to a specific location of the inventory file. However, if doing this, then you must be aware that -invPtrLoc in opatch


[oracle@pdb12cgg app]$ cd oraInventory
[oracle@pdb12cgg oraInventory]$ ls
backup  ContentsXML  logs  oui


[oracle@pdb12cgg ContentsXML]$ cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2011, Oracle. All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.3.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/oracle/product/12.1.0/grid" TYPE="O" IDX="1"/>
<HOME NAME="OraDB12Home1" LOC="/u02/app/oracle/product/12.1.0/dbhome_1" TYPE="O" IDX="2"/>
<HOME NAME="OraHome1" LOC="/u02/app/oracle/product/12.1.2/oggcore_1" TYPE="O" IDX="3"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>


The inventory includes the following key things: HOME IDX key value is the index into the file for the registered OH, the location of the OH and Tag Name for the OH


To attach (register the OH into Central Inventory) a cloned or copied OH we do the following:
./runInstaller -silent-attachHome ORACLE_HOME="/u02/app/oracle/product/12.1.0/dbhome_1” ORACLE_HOME_NAME=“DBHome12c"

Similarly we can use -detachHome to detach the OH


The Local Inventory is at location defined by inventory.xml file, it is typically installed at $ORACLE_HOME/inventory/ContentsXML/comps.xml, and outlines the details of the software components and patch levels installed at the Oracle_Home:
cat /u02/app/oracle/product/12.1.0/dbhome_1/inventory/ContentsXML/comps.xml

... an excerpt....

<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<PRD_LIST>
<TL_LIST>
<COMP NAME="oracle.server" VER="12.1.0.1.0" BUILD_NUMBER="0" REP_VER="0.0.0.0.0"
 RELEASE="Production" INV_LOC="Components/oracle.server/12.1.0.1.0/1/" LANGS="en
" XML_INV_LOC="Components21/oracle.server/12.1.0.1.0/" ACT_INST_VER="12.1.0.1.0"
 DEINST_VER="11.2.0.0.0" INSTALL_TIME="2013.Aug.19 18:01:58 CDT" INST_LOC="/u02/
app/oracle/product/12.1.0/dbhome_1/oracle.server">
   <EXT_NAME>Oracle Database 12c</EXT_NAME>
   <DESC>Installs an optional preconfigured starter database, product options, m
anagement tools, networking services, utilities, and basic client software for a
n Oracle Database server. This option also supports Automatic Storage Management
 database configuration.</DESC>
   <DESCID>COMPONENT_DESC</DESCID>
   <STG_INFO OSP_VER="10.2.0.0.0"/>
   <CMP_JAR_INFO>
      <INFO NAME="filemapObj" VAL="Components/oracle/server/v12_1_0_1_0/filemap.
xml"/>
      <INFO NAME="helpDir" VAL="Components/oracle/server/v12_1_0_1_0/help/"/>
      <INFO NAME="actionsClass" VAL="Components.oracle.server.v12_1_0_1_0.CompAc
tions"/>
      <INFO NAME="resourceClass" VAL="Components.oracle.server.v12_1_0_1_0.resou
rces.CompRes"/>

Here’s the confusing part, there is also a oraInst.loc file in $ORACLE_HOME/oraInst.loc in the OH too!  The opatch utility uses this oraInst.loc to inspect the inventory

Here's how the Central and Local Invntories relate to each other:

From Central Inv:
<HOME NAME="OraDB12Home1" LOC="/u02/app/oracle/product/12.1.0/dbhome_1" TYPE="O" <strong>IDX="2”</strong>/>


Local Inv:
<DEP_LIST>
      <DEP NAME="oracle.rdbms" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" <strong>HOME_IDX="2"</strong>/>
      <DEP NAME="oracle.options" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.network" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.rdbms.oci" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.precomp" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.xdk" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.odbc" VER="12.1.0.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.sysman.ccr" VER="10.3.7.0.3" DEP_GRP_NAME="Optional" HOME_IDX="2"/>
      <DEP NAME="oracle.sysman.ccr.client" VER="10.3.2.1.0" DEP_GRP_NAME="Optional" HOME_IDX="2"/>\

The hierarchy and layout of the Oracle Inventory:

OH inventory

The oraclehomeproperties.xml file defines the OS architecture and ARU id.  For those who may not know, Automated Release Update (ARU) defines how opatch utility will treat the patchset 

Clients of the Inventory:
oraenv, opatch, backups, etc

Here's an strace of oraenv , it illustrates that the inventory files are accessed.


strace -aefl oraenv

stat("/u02/app/oracle/product/12.1.0/dbhome_1/inventory/ContentsXML/oraclehomeproperties.xml", {st_mode=S_IFREG|0640, st_size=549, ...}) = 0
geteuid() = 500
getegid() = 501
getuid() = 500
getgid() = 501
access("/u02/app/oracle/product/12.1.0/dbhome_1/inventory/ContentsXML/oraclehomeproperties.xml", W_OK) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
stat("/u02/app/oracle/product/12.1.0/dbhome_1/bin/orabase", {st_mode=S_IFREG|0755, st_size=4941164, ...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
stat("/u02/app/oracle/product/12.1.0/dbhome_1/bin/orabase", {st_mode=S_IFREG|0755, st_size=4941164, ...}) = 0
geteuid() = 500
getegid() = 501
getuid() = 500
getgid() = 501
access("/u02/app/oracle/product/12.1.0/dbhome_1/bin/orabase", X_OK) = 0


I have had issues when we cloned and attached an OH.  Sometimes I do a health check on the inventory just to make sure everything is cool, here's what we do:

[oracle@pdb12cgg ContentsXML]$ $ORACLE_HOME/OPatch/opatch util LoadXML -xmlInput <strong>/u02/app/oracle/product/12.1.0/dbhome_1/inventory/ContentsXML/comps.xml</strong>
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /u02/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u02/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /u02/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2014-09-01_21-44-23PM_1.log

Invoking utility "loadxml"
UtilSession: XML file is OK.
OPatch succeeded.


[oracle@pdb12cgg ContentsXML]$ $ORACLE_HOME/OPatch/opatch util LoadXML -xmlInput <strong>/u01/app/oraInventory/ContentsXML/inventory.xml</strong>
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /u02/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u02/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /u02/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2014-09-01_21-45-31PM_1.log

Invoking utility "loadxml"
UtilSession: XML file is OK.

OPatch succeeded.



<strong>Backups</strong>

For key inventory operations (install, deinstall,clone,add node,attach home) the Installer will do an automated backup of the Central Inventory and Local Inventory (the entire directory for both), into oraInventory/backup/<time stamp>.  Note, that you cannot [easily] recovery from a corrupted or destroyed OH.  For this reason a restore of the backup is necessary


[oracle@pdb12cgg oraInventory]$ ls
backup  ContentsXML  logs  oui
[oracle@pdb12cgg oraInventory]$ ls backup
2013-08-16_08-30-42AM  2013-08-19_05-20-26PM  2014-08-05_04-54-40PM