- 问题背景
因之前安装过数据库11.2.0.1.0和11.2.0.3.0数据库,在环境变量倒换之间出现错误,通过kill进程的方法删除了数据库。然后删除了datafile等文件。在第二次安装的时候,出现如下情况
[oracle@aisms]./runInstaller
You do not have sufficient permissions to access the inventory '/data/oracle/oraInventory3/logs'. Installation cannot continue. Make sure that you have read/write permissions to the inventory directory and restart the installer.: Permission denied
You do not have sufficient permissions to access the inventory '/data/oracle/oraInventory3/logs'. Installation cannot continue. Make sure that you have read/write permissions to the inventory directory and restart the installer.: Permission denied
之前的环境变量情况为:
$ORACLE_BASE=/data/oracle
$ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3.0
$ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3.0
- 问题分析:
来看看oraInventory目录的介绍
All Oracle software installations rely on
this directory.
Ensure that you back it up regularly.
Do not delete this directory unless you have completely removed
all Oracle software from the system.
Ensure that you back it up regularly.
Do not delete this directory unless you have completely removed
all Oracle software from the system.
[root@ocmserver]more oraInst.loc
inventory_loc=/opt/oracle/oraInventory
inst_group=oinstall
[root@ocmserver]
inventory_loc=/opt/oracle/oraInventory
inst_group=oinstall
[root@ocmserver]
- oraInventory知识拓展:
轻易不要删除oraInventory目录,如果在生产环境删除,则会出现各种错误。常见错误总结如下:
example1
$opatch lsinventory
Invoking OPatch 10.2.0.4.3
OPatch failed to locate Central Inventory.
Possible causes are:
The Central Inventory is corrupted
The oraInst.loc file specified is not valid.
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
Invoking OPatch 10.2.0.4.3
OPatch failed to locate Central Inventory.
Possible causes are:
The Central Inventory is corrupted
The oraInst.loc file specified is not valid.
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
$opatch lsinventory
Invoking OPatch 10.2.0.4.3
List of Homes on this system:
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
Oracle Home dir. path does not exist in Central Inventory
Oracle Home is a symbolic link
Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo
OPatch failed with error code 73
Invoking OPatch 10.2.0.4.3
List of Homes on this system:
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
Oracle Home dir. path does not exist in Central Inventory
Oracle Home is a symbolic link
Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo
OPatch failed with error code 73
$cd $ORACLE_HOME/oui/bin
$./runInstaller -silent -attachHome \
> ORACLE_HOME=$ORACLE_HOME \
> ORACLE_HOME_NAME= "ORACLE_HOME"
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini,
no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /app/oracle/oraInventory
'AttachHome' was successful.
js_znjh_1./app/oracle/product/10.2.0/db_1/oui/bin$
$./runInstaller -silent -attachHome \
> ORACLE_HOME=$ORACLE_HOME \
> ORACLE_HOME_NAME= "ORACLE_HOME"
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini,
no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /app/oracle/oraInventory
'AttachHome' was successful.
js_znjh_1./app/oracle/product/10.2.0/db_1/oui/bin$
$cd $ORACLE_HOME/oui/bin
$./attachHome.sh
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini,
no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /app/oracle/oraInventory
'AttachHome' was successful.
$./attachHome.sh
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini,
no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /app/oracle/oraInventory
'AttachHome' was successful.
实验证明
实验一:修改默认oraInventory目录为oraInventory_bak目录,启动数据库,然后运行升级程序。
[oracle@ocmserver]mv oraInventory oraInventory_bak
[oracle@ocmserver]ls
admin bak flash_recovery_area oradata sql
archive_log core oraInventory_bak product sqlnet.log
[oracle@ocmserver]sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 28 22:21:35 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 230686720 bytes
Fixed Size 2019768 bytes
Variable Size 104861256 bytes
Database Buffers 117440512 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
SQL> !
bash-3.2$ cd /opt/oracle/product/10.2.0.1/OPatch
bash-3.2$ ./opatch lsinventory
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /opt/oracle/product/10.2.0.1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/10.2.0.1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /opt/oracle/product/10.2.0.1/oui
Log file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/opatch-2012_Nov_28_22-26-47-CST_Wed.log
LsInventory Session 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 72
bash-3.2$
[oracle@ocmserver]ls
admin bak flash_recovery_area oradata sql
archive_log core oraInventory_bak product sqlnet.log
[oracle@ocmserver]sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 28 22:21:35 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 230686720 bytes
Fixed Size 2019768 bytes
Variable Size 104861256 bytes
Database Buffers 117440512 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
SQL> !
bash-3.2$ cd /opt/oracle/product/10.2.0.1/OPatch
bash-3.2$ ./opatch lsinventory
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /opt/oracle/product/10.2.0.1
Central Inventory : /opt/oracle/oraInventory
from : /opt/oracle/product/10.2.0.1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /opt/oracle/product/10.2.0.1/oui
Log file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/opatch-2012_Nov_28_22-26-47-CST_Wed.log
LsInventory Session 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 72
bash-3.2$
SQL> !
bash-3.2$ more / var /opt/oracle/oraInst.loc
inventory_loc=/opt/oracle/oraInventory_bak
inst_group=oinstall
bash-3.2$ more /opt/oracle/product/10.2.0.1/oraInst.loc
inventory_loc=/opt/oracle/oraInventory_bak
inst_group=oinstall
bash-3.2$./opatch lsinventory
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /opt/oracle/product/10.2.0.1
Central Inventory : /opt/oracle/oraInventory_bak
from : /opt/oracle/product/10.2.0.1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /opt/oracle/product/10.2.0.1/oui
Log file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/opatch-2012_Nov_28_22-36-55-CST_Wed.log
Lsinventory Output file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/lsinv/lsinventory-2012_Nov_28_22-36-55-CST_Wed.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 10g 10.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
bash-3.2$
bash-3.2$ more / var /opt/oracle/oraInst.loc
inventory_loc=/opt/oracle/oraInventory_bak
inst_group=oinstall
bash-3.2$ more /opt/oracle/product/10.2.0.1/oraInst.loc
inventory_loc=/opt/oracle/oraInventory_bak
inst_group=oinstall
bash-3.2$./opatch lsinventory
Invoking OPatch 10.2.0.1.0
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..
Oracle Home : /opt/oracle/product/10.2.0.1
Central Inventory : /opt/oracle/oraInventory_bak
from : /opt/oracle/product/10.2.0.1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /opt/oracle/product/10.2.0.1/oui
Log file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/opatch-2012_Nov_28_22-36-55-CST_Wed.log
Lsinventory Output file location : /opt/oracle/product/10.2.0.1/cfgtoollogs/opatch/lsinv/lsinventory-2012_Nov_28_22-36-55-CST_Wed.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 10g 10.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
bash-3.2$
由此可知,$ORACLE_HOME/oraInst.loc文件和/var/opt/oracle/oraInst.loc应该是映射关系,在数据库启动的时候修改$ORACLE_HOME目录下的oraInst.loc,当卸载数据库的时候($ORACLE_HOME,$ORACLE_BASE被删除)可以修改/var/opt/oracle/oraInst.loc文件。
本文出自 “Focus on Oracle” 博客,请务必保留此出处http://alexy.blog.51cto.com/6115453/1073510