一 oraInventory的作用
oraInventory中记录了oracle安装目录的相关信息,通常在oracle软件安装过程中会自动创建,路径通常会在$ORACLE_BASE/oraInventory/,并在/etc/oraInst.loc中记录相关的路径信息,有时候我们的oracle目录是从另一套相似环境中tar过来的,这个时候是不会有oraInventory信息,如果此时数据库需要升级,或者打psu,那么会报错。
二 oraInventory缺失造成的问题
[oracle@hzmc OPatch]$ ./opatch lsinv
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright © 2020, Oracle Corporation. All rights reserved.
Oracle Home : /oracle/app/product/19.3.0/db_1
Central Inventory : /oracle/oraInventory
from : /oracle/app/product/19.3.0/db_1/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.2.0.7.0
Log file location : /oracle/app/product/19.3.0/db_1/cfgtoollogs/opatch/opatch2020-08-05_00-08-40AM_1.log
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
三 UNIX重建oraInventory目录
3.1 方法一:
适用范围:通用
[oracle@hzmc oracle]$ cd $ORACLE_HOME/oui/bin
[oracle@hzmc bin]$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME="/oracle/app/product/19.3.0/db_1" ORACLE_HOME_NAME="OraDb19c_home1"
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 14909 MB Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
/oracle/oraInventory/logs/AttachHome2020-08-05_12-09-36AM.log
'AttachHome' was successful.
确认oraInventory是否重建完成:
[oracle@hzmc bin]$ more /etc/oraInst.loc
inventory_loc=/oracle/oraInventory
inst_group=oinstall
[oracle@hzmc ~]$ cd /oracle/oraInventory/ContentsXML/
[oracle@hzmc ContentsXML]$ ls
comps.xml inventory.xml libs.xml
[oracle@hzmc ContentsXML]$ more inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2020, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
<SAVED_WITH>12.2.0.7.0</SAVED_WITH>
<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDb19c_home1" LOC="/oracle/app/product/19.3.0/db_1" TYPE="O" IDX="1"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
可以看到oraInventory已重建完成。
3.2 方法二:
适用范围:10.2.0.2及以上版本
[oracle@hzmc oracle]$ cd $ORACLE_HOME/oui/bin
[oracle@hzmc bin]$ ./attachHome.sh
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 14909 MB Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
/oracle/oraInventory/logs/AttachHome2020-08-05_12-10-50AM.log
'AttachHome' was successful.
确认oraInventory是否重建完成:
[oracle@hzmc bin]$ more /etc/oraInst.loc
inventory_loc=/oracle/oraInventory
inst_group=oinstall
[oracle@hzmc ~]$ cd /oracle/oraInventory/ContentsXML/
[oracle@hzmc ContentsXML]$ ls
comps.xml inventory.xml libs.xml
[oracle@hzmc ContentsXML]$ more inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2020, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
<SAVED_WITH>12.2.0.7.0</SAVED_WITH>
<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDB19Home1" LOC="/oracle/app/product/19.3.0/db_1" TYPE="O" IDX="1"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
可以看到oraInventory已重建完成。
四 WINDOWS重建oraInventory目录
适用范围:通用
C:\Users\Administrator>d:
D:\>cd D:\app\Administrator\product\11.2.0\dbhome_1\oui\bin
D:\app\Administrator\product\11.2.0\dbhome_1\oui\bin>setup.exe -silent -attachHo
me ORACLE_HOME="D:\app\Administrator\product\11.2.0\dbhome_1" ORACLE_HOME_NAME="ora11g"
查看C:\Program Files\Oracle\Inventory\ContentsXML\inventory.xml
<?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. -->
<INVENTORY>
<VERSION_INFO>
<SAVED_WITH>11.2.0.4.0</SAVED_WITH>
<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="ora11g" LOC="D:\app\Administrator\product\11.2.0\dbhome_1" TYPE="O" IDX="1"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
可以看到oraInventory已重建完成。





