学无止境
分类: Oracle
2013-11-26 17:17:23
Inventory目录有2个,一个为全局的Inventory,一个为本地的Inventory。全局的Inventory注册了某个ORACLE_HOME下安装的数据库组件和版本。Oracle数据库软件的升级。增删组件,都需要使用Inventory。本地Inventory是每个ORACLE_HOME独有的,记录本ORACLE_HOME的OUI安装的组件信息。
安装补丁之前,检查oracle已安装的patch,正常检查信息会显示如下,有正确的Inventory信息
[oracle@node2 OPatch]$ cd $ORACLE_HOME/OPatch
[oracle@node2 OPatch]$ ./opatch lsinventory
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation. All rights reserved.
Oracle Home : /opt/ora10g/product/10.2.0/db_1
Central Inventory : /opt/ora10g/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.4.0
OUI location : /opt/ora10g/product/10.2.0/db_1/oui
Log file location : /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2013-11-26_09-08-02AM.log
Patch history file: /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Lsinventory Output file location : /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-26_09-08-02AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 2 products installed in this Oracle Home.
但如果是通过tar方式复制的ORACLE_HOME,可能由于某些原因并没有tar除ORACLE_HOME之外的信息,如Inventory目录,以及/etc/oraInst.loc(有些操作系统放在/var/opt/oracle目录下)等文件。就有可能出现Inventory目录信息无效的情况。这可能会导致patch安装失败。
[oracle@node2 OPatch]$ ./opatch lsinventory
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation. All rights reserved.
Oracle Home : /opt/ora10g/product/10.2.0/db_1
Central Inventory : n/a
from :
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.4.0
OUI location : /opt/ora10g/product/10.2.0/db_1/oui
Log file location : n/a
Patch history file: /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
OPatch cannot find a valid oraInst.loc file to locate Central Inventory.
OPatch failed with error code 104
重建全局Inventory的方法:
1.重新编辑一个oraInst.loc文件,内容如下,可以自行选择目录位置,但是inst_group必须是oracle用户的主组,文件位置根据操作系统不同有所不同,AIX和Linux存放在/etc目录下,HP-UX存放在/var/opt/oracle目录下。
inventory_loc=/software/oraInventory
inst_group=oinstall
2.转到$ORACLE_HOME/oui/bin目录下,执行创建脚本,ORACLE_HOME为本机数据库使用的ORACLE_HOME,可以自定义这个ORACLE_HOME的名称
cd $ORACLE_HOME/oui/bin
./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME="/opt/ora10g/product/10.2.0/db_1" ORACLE_HOME_NAME="ORA10GR2_HOME"
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
>>> Ignoring required pre-requisite failures. Continuing...
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /software/oraInventory
'AttachHome' was successful.
3.检查Inventory目录已经创建成功,并且检查成功。
[oracle@node2 OPatch]$ ./opatch lsinventory
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation. All rights reserved.
Oracle Home : /opt/ora10g/product/10.2.0/db_1
Central Inventory : /software/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.4.0
OUI location : /opt/ora10g/product/10.2.0/db_1/oui
Log file location : /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2013-11-26_09-24-13AM.log
Patch history file: /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Lsinventory Output file location : /opt/ora10g/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-26_09-24-13AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 2 products installed in this Oracle Home.