Thursday, December 29, 2022

Patching Oracle Software With Multiple Homes on Server Fails

We recently ran into an issue patching an Oracle home (the directory holding database executables and other system files):

RawInventory gets null OracleHomeInfo


The above occurred for many reasons.  First, Oracle software was installed with a vendor package on one mount point.  Then, that same software was copied to another location.  Finally, the Oracle Enterprise Manager agent was added.  


The problem happens if any of these steps have incorrect Oracle home settings at the time they were done, or when the correct Oracle tools are not used.  The tools will always report the installation to the inventory pointer XML file (inventory.xml).  


When this is done, the contents of that file could be wrong, or there could be multiple copies.  Each of these situations can contribute to future difficulties with patching.  


Because this can happen so frequently, Oracle finally developed a workaround, via a script:


How to Change Central Inventory Directory Location by Using attachHome Command (Doc ID 2876813.1)


You will, of course, need an Oracle Support account to access the above. 


In some cases, even that script will not work without modification.  


The contents should be checked to assure it will attach the correct Oracle home, and it must be modified if not.  


Here is another fine blog with the details: 


https://doyensys.com/blogs/lsinventorysession-failed-rawinventory-gets-null-oraclehomeinfo/


In our case, the OHOME variable was referencing the directory where the agent was installed, since that was the last operation performed.  This needed to be changed.


Here is what the script will produce when executed properly:


./attachHome.sh 

Starting Oracle Universal Installer...


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

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

You can find the log of this install session at:

 /u01/app/oracle/oraInventory/logs/AttachHome2022-12-29_10-16-30AM.log

'AttachHome' was successful.


Once above is done, verification can be done with $ORACLE_HOME/OPatch/opatch lspatches:


./opatch lspatches

34133642;Database Release Update : 19.16.0.0.220719 (34133642)

29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)


OPatch succeeded.