ITPub博客

首页 > 数据库 > Oracle > [20190428]恢复oraInventory.txt

[20190428]恢复oraInventory.txt

原创 Oracle 作者:lfree 时间:2019-04-30 10:00:04 0 删除 编辑

[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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2903
  • 访问量
    6678760