10g安裝出現oraInventory目錄問題

  • 問題背景
因之前安裝過數據庫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
/data/oracle/oraInventory3爲安裝11.2.0.3.0數據庫的時候創建目錄。
之前的環境變量情況爲:
$ORACLE_BASE=/data/oracle
$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.
而oraInventory目錄的位置是由oraInst.loc文件決定的,在solaris中oraInst.loc文件位於/var/opt/oracle/OraInst.loc文件下,其內容如下:
[root@ocmserver]more oraInst.loc
inventory_loc=/opt/oracle/oraInventory
inst_group=oinstall
[root@ocmserver]
這樣,問題找到了。即最後一次刪除的時候,數據庫是11.2.0.3.0版本。當刪除$ORACLE_BASE和$ORACLE_HOME目錄下的所有內容的時候,沒有清楚或者修改/var/opt/oracle/oraInst.loc文件。所以在下次清除的時候,他默認從oraInst.loc文件中的那些配置讀取,每次都會需要讀取此位置,而如果新安裝的位置安放在其他地方,在會出現無權讀取某文件等。
  • 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
explame2
$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
oraInventory重建方法1
$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$
oraInventory重建方法2
$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.
實驗證明
實驗一:修改默認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$
實驗二:修改/var/opt/oracle/oraInst.loc文件以及$ORACLE_HOME/oraInst.loc文件,然後再執行./OPatch lsinventory
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$
由此可知,$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

發佈了78 篇原創文章 · 獲贊 4 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章