[20190428]恢復oraInventory.txt

lfree發表於2019-04-30

[20190428]恢復oraInventory.txt


--//不小心刪除oraInventory檔案,一般不影響資料庫執行。我自己以前遇到一次,當時在/home/oracle/oraInventory.

--//我採用最笨的方法重新安裝oracle資料庫.

--//不過還是測試看看如何恢復,主要原因是我遇到一種情況,看最後說明.


0.環境:

SCOTT@book> @ ver1

PORT_STRING                    VERSION        BANNER

------------------------------ -------------- --------------------------------------------------------------------------------

x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


1.確定oraInventory目錄:

$ cat /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory

inst_group=oinstall


2.確定當時安裝時環境變數ORACLE_HOME以及ORACLE_HOME_NAME。


$ echo $ORACLE_HOME

/u01/app/oracle/product/11.2.0.4/dbhome_1


--//難點是ORACLE_HOME_NAME或者叫HOME_NAME.一般使用dbca安裝都會留有一些痕跡.


$ cd $ORACLE_BASE/cfgtoollogs/dbca

$ ls -l trace.log_OraDb11g_home1_201*

-rw-r----- 1 oracle oinstall 24610 2015-11-24 09:05:07 trace.log_OraDb11g_home1_2015-11-24_09-05-02-AM

-rw-r----- 1 oracle oinstall 24610 2015-11-24 09:07:05 trace.log_OraDb11g_home1_2015-11-24_09-07-00-AM

-rw-r----- 1 oracle oinstall 53224 2017-04-26 08:45:31 trace.log_OraDb11g_home1_2017-04-26_08-32-41-AM

-rw-r----- 1 oracle oinstall 50060 2017-06-27 16:16:52 trace.log_OraDb11g_home1_2017-06-27_04-13-25-PM

-rw-r----- 1 oracle oinstall 14076 2017-07-06 16:55:35 trace.log_OraDb11g_home1_2017-07-06_04-55-21-PM

-rw-r----- 1 oracle oinstall 53909 2017-12-07 11:18:08 trace.log_OraDb11g_home1_2017-12-07_11-18-02-AM

-rw-r----- 1 oracle oinstall 38787 2018-02-11 10:15:36 trace.log_OraDb11g_home1_2018-02-11_10-15-09-AM


--//中間的部分就是"OraDb11g_home"就是ORACLE_HOME_NAME.


3.恢復:


$ cd /u01/app

$ mv oraInventory/ oraInventory.good

`oraInventory/' -> `oraInventory.good'


--//有了這些資訊恢復就容易了。


$ $ORACLE_HOME/oui/bin/runInstaller -silent -attachHome ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=OraDb11g_home1

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB.   Actual 30718 MB    Passed

The inventory pointer is located at /etc/oraInst.loc

The inventory is located at /u01/app/oraInventory

'AttachHome' was successful.


$ diff oraInventory/ContentsXML/inventory.xml oraInventory.good/ContentsXML/inventory.xml


--//OK,比較正常.

$ cat oraInventory/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="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0.4/dbhome_1" TYPE="O" IDX="1"/>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>


4.說明生產系統遇到的情況:

--//實際上我還遇到1個問題,生產系統dg,不知道為什麼出現這樣的情況:

$ cat  /u01/app/oraInventory/ContentsXML/inventory.xml

<?xml version="1.0" standalone="yes" ?>

<!-- Copyright (c) 1999, 2011, Oracle. All rights reserved. -->

<!-- Do not modify the contents of this file by hand. -->

<INVENTORY>

<VERSION_INFO>

   <SAVED_WITH>11.2.0.3.0</SAVED_WITH>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   

   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>

</VERSION_INFO>

<HOME_LIST>

<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/db_1" TYPE="O" IDX="1"/>

<HOME NAME="OraHome1" LOC="/u01/ogg122" TYPE="O" IDX="2"/>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

--//注意下劃線,不知道什麼搞的版本是11.2.0.3,實際上是11.2.0.4.感覺安裝ogg後導致的情況.而備份的情況是:


$ cat /u01/app/oraInventory/backup/2018-11-20_11-09-16AM/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="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/db_1" TYPE="O" IDX="1"/>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>


--//明顯原來是11.2.0.4的.不知道對方安裝ogg如何做的.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2642964/,如需轉載,請註明出處,否則將追究法律責任。

相關文章