Change Oracle Central Inventory

How To Change Oracle Central Inventory Location

While preparing to automate Oracle Database 19.24 Release Update patching with Ansible -> Ansible Playbooks for Oracle Database Release Update(19.24) , we discovered that one of our database servers had its Oracle Central Inventory (oraInventory) in a non-standard location, under the Enterprise Manager Agent directory.

To maintain a consistent directory structure across our servers and avoid potential issues with automated patching, we decided to relocate the Central Inventory.

In this article, I’ll demonstrate how we moved oraInventory to a new location, updated the oraInst.loc references for Database, Grid Infrastructure, and Enterprise Manager Agent homes, and verified the changes using OPatch.

It is also called as oraInventory. The Central Inventory stores information about all Oracle products installed on a host. It includes a file called inventory.xml, which lists all the Oracle Homes on the node. For each Oracle Home, the file details the following:

  • The Oracle Home name
  • The home index
  • The nodes where the home is installed
  • Whether the home is an Oracle Clusterware home or a removed Oracle Home.

We have followed How To Move The Central Inventory To Another Location (Doc ID 299260.1), for all the Oracle Homes (Database, Grid and Enterprise Manager Cloud Control). Here are the steps we have followed to change it.

  • Old direction : /u01/app/oracle/em_agent/oraInventory
  • New direction: /u01/app/oracle/
[oracle@blt01 ~]$ find / -name oraInventory -print
/u01/app/oracle/em_agent/oraInventory

It will be more than one for environments with RAC and EMCC agent. The oraInst.loc file is simply a pointer to the location of the central inventory (oraInventory).

-- Find all oraInst.loc files,as we will be replacing the contents of these files in the subsequent steps.
[root@blt01 ~]# find / -name oraInst.loc -print
/etc/oraInst.loc
/u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/oraInst.loc
/u01/app/oracle/product/19.22/dbhome_1/oraInst.loc
/u01/app/19.22/grid/oraInst.loc
-- Open one of them to check what it has.
[root@blt01 ~]# cat /etc/oraInst.loc
inventory_loc=/u01/app/oracle/em_agent/oraInventory
inst_group=oinstall

The oraInst.loc file identifies the Central Inventory location. In environments with multiple Oracle Homes, including RAC and Enterprise Manager Agent installations, additional copies of this file may exist. Before relocating the Central Inventory, identify all relevant oraInst.loc files and ensure that their inventory_loc entries point to the new directory after the migration.

Using the find command, we located all Local Inventories (Oracle Home inventories) and the default directory (/etc/oraInst.loc for Linux and AIX, /var/opt/oracle/oraInst.loc for other Unix platforms). The default directory is created during the first Oracle software installation (by using the orainstRoot.sh script), while subsequent installations create additional local inventory files. If we change the central inventory, all these files must be updated to point to the new central inventory. Each Oracle Home has a pointer to the central inventory in its ORACLE_HOME/oraInst.loc file.

Much more information is available on FAQs on Central Inventory and Oracle Home Inventory (Local Inventory) in Oracle RDBMS (Doc ID 564192.1) and Significance of oraInst.loc When Installing Oracle Products and Applying Patches (Doc ID 418537.1)

The Central Inventory location also matters when cloning Oracle Homes to another server. In Cloning Oracle RAC Database Home to Single Instance and Vice Versa, I demonstrate how an incorrect inventory configuration can cause OPatch to fail after cloning an Oracle Home.

We have copied it recursively with all subdirectories and preserving the file’s permissions, timestamps, and ownership.

[root@blt01 app]# cp -Rp /u01/app/oracle/em_agent/oraInventory/ /u01/app/
[root@blt01 app]# vi /etc/oraInst.loc
[root@blt01 app]# vi /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/oraInst.loc
[root@blt01 app]# vi /u01/app/oracle/product/19.22/dbhome_1/oraInst.loc
[root@blt01 app]# vi /u01/app/19.22/grid/oraInst.loc
-- old value
[root@blt01 ~]# cat /etc/oraInst.loc
inventory_loc=/u01/app/oracle/em_agent/oraInventory
inst_group=oinstall
-- new value
[root@blt01 ~]# cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

After updating the inventory pointers, run opatch lsinventory from each relevant Oracle Home and verify that the Central Inventory path matches the new location. The command should complete successfully and display the expected installed Oracle products and patches.

-- If inventory_loc is not specified correctly it will fail like below.
[oracle@blt01 OPatch]$ export ORACLE_HOME=/u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0
[oracle@blt01 OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 13.9.4.2.13
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0
Central Inventory : /u01/app/oracle/em_agent/oraInventory
from : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/oraInst.loc
OPatch version : 13.9.4.2.13
OUI version : 13.9.4.0.0
Log file location : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/cfgtoollogs/opatch/opatch2024-10-30_14-27-15PM_1.log
OPatch detects the Middleware Home as "/u01/app/oracle/em_agent/GoldImage_GI135v8"
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
-- Command should run succesfully as provided below.
[oracle@blt01 OPatch]$ export ORACLE_HOME=/u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0
[oracle@blt01 OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 13.9.4.2.13
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0
Central Inventory : /u01/app/oracle/em_agent/oraInventory
from : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/oraInst.loc
OPatch version : 13.9.4.2.13
OUI version : 13.9.4.0.0
Log file location : /u01/app/oracle/em_agent/GoldImage_GI135v8/agent_13.5.0.0.0/cfgtoollogs/opatch/opatch2024-10-30_14-27-15PM_1.log
OPatch detects the Middleware Home as "/u01/app/oracle/em_agent/GoldImage_GI135v8"
LsInventory Output file location :
...

As per “Support For Manually Changing “inst_loc” In The Windows Registry (Doc ID 552502.1)“, changing this registry setting is unsupported and so moving the central inventory to another location is unsupported on Windows. manually changing the setting of “inst_loc” can cause OUI to report errors.

Moving the Oracle Central Inventory is a straightforward process if done correctly, but it is crucial to update all references to the inventory location in the oraInst.loc files and verify the changes with Oracle tools like opatch. Always ensure consistency across environments (especially in RAC or multi-home setups) to avoid future issues with patching and Oracle Home management.

Hope it helps.


Discover More from Osman DİNÇ


Comments

Leave your comment