OPEN

Patch lsinventory is empty

Asked by Ahmed.Yasser52 viewsoracle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
./opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.49
Copyright (c) 2026, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.0.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.49
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2026-04-05_10-42-57AM_1.log

LsInventorySession failed: Array index out of range: 0

OPatch failed with error code 73



and 



./opatch lspatches
Inventory load failed... LsPatchesSession::loadAndPrintInstalledPatch()
LsPatchesSession failed: Array index out of range: 0

OPatch failed with error code 2
#Patch issue

Solutions(1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-> The error you're seeing with OPatch (LsInventorySession failed: Array index out of range: 0 and error code 73 for lsinventory, plus similar failure for lspatches) is a common Oracle issue on 19c (and other versions). It almost always points to a corrupted, empty, or missing Oracle Inventory (the central inventory at /u01/app/oraInventory and/or the local inventory inside your Oracle Home).
OPatch cannot read the list of installed components/patches because the inventory metadata is broken or incomplete (the "array index 0" is Java code inside OPatch trying to access the first element of an empty list of homes or components).
-> Most Common and Effective Fix
-> Run the attachHome.sh script to re-register your Oracle Home in the central inventory:
cd $ORACLE_HOME/oui/bin
./attachHome.sh
-> This command should say something like "AttachHome was successful".
After that, try again:
./opatch lsinventory
./opatch lspatches
--> Additional Checks and Steps (in order)
1. Verify inventory pointers (very important):
cat /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc
cat /etc/oraInst.loc          # (or /var/opt/oracle/oraInst.loc on some platforms)
-> Both should point to the same inventory_loc=/u01/app/oraInventory.
2. Check if the inventory directory is empty or only has a "locks" folder:
ls -l /u01/app/oraInventory
ls -l /u01/app/oraInventory/ContentsXML/
-> If it's nearly empty (only locks or missing inventory.xml, comps.xml, etc.), that's the root cause.
3. If attachHome.sh fails or the inventory is badly corrupted:
-> Make a backup of the current inventory:Bash
cd /u01/app
tar -czf oraInventory_backup_$(date +%Y%m%d).tar.gz oraInventory
-> Then try re-attaching again, or follow Oracle Doc ID 556834.1 (Steps To Recreate Central Inventory).
4. ther quick checks:
-> Ensure no Oracle processes are locking files (especially if you recently applied a patch or had a crash):
fuser -u $ORACLE_HOME/lib/libclntsh.so*   # or similar key libraries
-> Confirm your OPatch version is recent enough for 19c (yours is 12.2.0.1.49 — it's acceptable, but you can update to the latest 12.2.0.1.x from My Oracle Support if needed).
-> Make sure ORACLE_HOME environment variable is correctly set and you are running as the oracle OS user.
-> If Nothing Works
-> Look at the log file mentioned in the output:text
/u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2026-04-05_10-42-57AM_1.log
-> (or the newest one). It often has more details.
-> As a last resort (after backup), you can manually fix or recreate parts of the inventory using Oracle support notes like:
Doc ID 556834.1 — Recreate Central Inventory
Doc ID 1273158.1 — Issues with attachHome
-> This issue frequently appears after incomplete patch applications, cloning, or when the oraInventory directory gets wiped/corrupted.
-> Try the 'attachHome.sh' step first — it resolves this exact error in the majority of cases.
Mahmoud

Post Your Solution