DBCA建库诡异问题处理

【故障处理】DBCA建库诡异问题处理--rac环境不能创建rac

一.1  BLOG文档结构图

 wps3AC2.tmp[4]

一.2  前言部分

 

一.2.1  导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~

dbca静默创建rac

Inventory目录作用及其2种重建方法(重点)

rac环境dbca工具不能创建rac库的解决办法

dbca静默建库常见问题处理

⑤ 重建CRS集群环境执行root.sh脚本

 

  Tips:

① 本文在ITpubhttp://blog.itpub.net/26736162)和博客园(http://www.cnblogs.com/lhrbest)有同步更新

② 文章中用到的所有代码,相关软件,相关资料请前往小麦苗的云盘下载(http://blog.itpub.net/26736162/viewspace-1624453/

若文章代码格式有错乱,推荐使用搜狗360QQ浏览器,也可以下载pdf格式的文档来查看,pdf文档下载地址:http://blog.itpub.net/26736162/viewspace-1624453/

本篇BLOG中命令的输出部分需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33thread 2的最大归档日志号为43是需要特别关注的地方;而命令一般使用黄色背景和红色字体注;对代码或代码输出部分的注释一般采用蓝色字体表示

 

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

[ZHLHRDB1:root]:/>lsvg -o

T_XDESK_APP1_vg

rootvg

[ZHLHRDB1:root]:/>

00:27:22 SQL> alter tablespace idxtbs read write;

 

 

====》2097152*512/1024/1024/1024=1G 

 

 

 

本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。

 

 

一.3  故障分析及解决过程

 

一.3.1  故障环境介绍

 

项目

source db

db 类型

RAC

db version

11.2.0.4

db 存储

ASM

OS版本及kernel版本

AIX 646.1.0.0

 

 

一.3.2  故障发生现象及报错信息

小麦苗采用dbca -silent+nodeinifo创建rac库,原来用的好好的命令,结果在这个rac环境上创建出来的库成了单实例的,很是郁闷,,,,且看故障发生的现象:

[ZFZHLHRDB1:oracle]:/oracle>dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

> -gdbname raclhr  -sid raclhr \

> -sysPassword oracle -systemPassword lhr \

> -datafileDestination 'DATA/' -recoveryAreaDestination 'DATA/' \

> -redoLogFileSize 50 \

> -storageType ASM -asmsnmpPassword lhr  -diskGroupName 'DATA' \

> -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \

> -sampleSchema true \

> -automaticMemoryManagement true -totalMemory 2048 \

> -databaseType OLTP  \

> -emConfiguration NONE \

> -nodeinfo ZFZHLHRDB1,ZFZHLHRDB2

Copying database files

1% complete

3% complete

10% complete

17% complete

24% complete

35% complete

Creating and starting Oracle instance

37% complete

42% complete

47% complete

52% complete

53% complete

56% complete

58% complete

Registering database with Oracle Restart

64% complete

Completing Database Creation

68% complete

71% complete

75% complete

85% complete

96% complete

100% complete

Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/raclhr/raclhr.log" for further details.

[ZFZHLHRDB1:oracle]:/oracle>more /oracle/app/oracle/cfgtoollogs/dbca/raclhr/raclhr.log

Copying database files

DBCA_PROGRESS : 1%

DBCA_PROGRESS : 3%

DBCA_PROGRESS : 10%

DBCA_PROGRESS : 17%

DBCA_PROGRESS : 24%

DBCA_PROGRESS : 31%

DBCA_PROGRESS : 35%

Creating and starting Oracle instance

DBCA_PROGRESS : 37%

DBCA_PROGRESS : 42%

DBCA_PROGRESS : 47%

DBCA_PROGRESS : 52%

DBCA_PROGRESS : 53%

DBCA_PROGRESS : 56%

DBCA_PROGRESS : 58%

Registering database with Oracle Restart

DBCA_PROGRESS : 64%

Completing Database Creation

DBCA_PROGRESS : 68%

DBCA_PROGRESS : 71%

DBCA_PROGRESS : 75%

DBCA_PROGRESS : 85%

DBCA_PROGRESS : 96%

DBCA_PROGRESS : 100%

Database creation complete. For details check the logfiles at:

/oracle/app/oracle/cfgtoollogs/dbca/raclhr.

Database Information:

Global Database Name:raclhr

System Identifier(SID):raclhr

[ZFZHLHRDB1:oracle]:/oracle>

[ZFZHLHRDB1:oracle]:/oracle>ORACLE_SID=raclhr                                             

[ZFZHLHRDB1:oracle]:/oracle>sqlplus / as sysdba                                           

                                                                                          

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jul 5 17:17:42 2016                        

                                                                                          

Copyright (c) 1982, 2013, Oracle.  All rights reserved.                                   

                                                                                          

                                                                                          

Connected to:                                                                             

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production              

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,     

Data Mining and Real Application Testing options                                          

                                                                                          

SYS@raclhr> show parameter cluster                                                        

                                                                                          

NAME                                 TYPE        VALUE                                    

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

cluster_database                     boolean     FALSE                                    

cluster_database_instances           integer     1                                        

cluster_interconnects                string                                               

 

大家看到这里的安装百分比是1%->3%->10%-17%.....,rac库创建的时候进度百分比应该是1%->3%->9%-15%.....,如下图所示:

wps3AD3.tmp[4] 

Copying database files

1% complete

3% complete

9% complete

15% complete

21% complete

30% complete

Creating and starting Oracle instance

32% complete

36% complete

40% complete

44% complete

45% complete

48% complete

50% complete

Creating cluster database views

52% complete

70% complete

Completing Database Creation

73% complete

76% complete

85% complete

94% complete

100% complete

Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/raclhr/raclhr.log" for further details.

 

接下来小麦苗尝试了如下的几种方式:①dbca采用响应文件的形式,②dbca图形界面的方式,都是同样的情况。

 

我的环境dbca图形界面的第一张图:

wps3AD4.tmp[4] 

 

 

而正常rac环境下dbca图形界面的第一步图应该是:

wps3AE5.tmp[4] 

以上都是目前出现的问题,初步预估是哪个配置文件出错了,dbca不能判断集群环境。

 

一.3.3  故障分析及解决过程

 

起初小麦苗以为是集群出现了问题,在万般无奈的情况下执行root.sh重建了集群,按照以前的经验,这个终极大招执行后集群肯定可以恢复到正常的情况下,结果呢?结果还是令小麦苗很伤心,情况依旧没有解决。重新执行root.sh的命令如下(注:重新执行root.sh并不会清掉db的数据):

ocrconfig -showbackup

ocrconfig -manualbackup 

 

 

$ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose

ls -l $ORACLE_BASE/Clusterware/ckptGridHA*

find $ORACLE_HOME/gpnp/* -type f

find $ORACLE_HOME/gpnp/* -type f -exec rm -rf {} \;

 

 

 

$ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose -lastnode -keepdg

ls -l $ORACLE_BASE/Clusterware/ckptGridHA*

find $ORACLE_HOME/gpnp/* -type f

find $ORACLE_HOME/gpnp/* -type f -exec rm -rf {} \;

 

 

ipcs

$ORACLE_HOME/root.sh

/oracle/app/11.2.0/grid/perl/bin/perl -I/oracle/app/11.2.0/grid/perl/lib -I/oracle/app/11.2.0/grid/crs/install /oracle/app/11.2.0/grid/crs/install/rootcrs.pl

 

ipcs

$ORACLE_HOME/root.sh

 

---crs的配置文件

---$ORACLE_HOME/crs/install/crsconfig_params

-- GRID

export DISPLAY=22.188.216.132:0.0

$ORACLE_HOME/crs/config/config.sh

 

这个终极大招已经使用过了,问题没有解决只能说明不是权限的问题,也不是集群的问题,而是DB环境的问题。

于是硬着头皮分析分析dbca的日志,dbca创建库的时候日志在:11g:$ORACLE_BASE/cfgtoollogs/dbca , 10g:$ORACLE_HOME/cfgtoollogs/dbca

 

[ZFZHLHRDB1:oracle]:/oracle>cd /oracle/app/oracle/cfgtoollogs/dbca/raclhr               

[ZFZHLHRDB1:oracle]:/oracle/app/oracle/cfgtoollogs/dbca/raclhr>l                        

total 15592                                                                             

-rw-r-----    1 oracle   dba            1454 Jul 05 16:56 CloneRmanRestore.log          

-rw-r-----    1 oracle   dba             182 Jul 05 16:52 DetectOption.log              

-rw-r-----    1 oracle   dba           43191 Jul 05 16:59 cloneDBCreation.log           

-rw-r-----    1 oracle   dba              48 Jul 05 16:59 lockAccount.log               

-rw-r-----    1 oracle   dba           18557 Jul 05 16:59 mkplug_v3_raclhr.log          

-rw-r-----    1 oracle   dba            1630 Jul 05 16:59 postDBCreation.log            

-rw-r-----    1 oracle   dba              16 Jul 05 16:59 postScripts.log               

-rw-r-----    1 oracle   dba             718 Jul 05 16:51 raclhr.log                    

-rw-r-----    1 oracle   dba             738 Jul 05 17:00 raclhr0.log                   

-rw-r-----    1 oracle   dba            1476 Jul 05 17:00 raclhr_creation_checkpoint.xml

-rw-r-----    1 oracle   dba            1454 Jul 05 16:55 rmanRestoreDatafiles.sql      

-rw-r-----    1 oracle   dba         7716864 Jul 05 16:56 tempControl.ctl               

-rw-r-----    1 oracle   dba          155662 Jul 05 17:00 trace.log                     

-rw-r-----    1 oracle   asmadmin       2258 Jul 05 16:57 tts_example_imp.log           

 

里边有trace.log文件,拿到手,搜了下cluster,发现一个错误:

wps3AE6.tmp[4]

[main] [ 2016-07-05 17:37:30.694 GMT+08:00 ] [HAUtils.getDefaultListenerProperties:1666]  PRCR-1001 : Resource ora.LISTENER.lsnr does not exist

PRCR-1001 : Resource ora.LISTENER.lsnr does not exist

at oracle.cluster.impl.common.SoftwareModuleImpl.crsResource(SoftwareModuleImpl.java:776)

at oracle.cluster.impl.nodeapps.ListenerImpl.crsResource(ListenerImpl.java:1107)

ora.LISTENER.lsnr该资源不存在,那就手动创建该资源:

[ZFZHLHRDB1:grid]:/home/grid>netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp      

                                                                                                      

Parsing command line arguments:                                                                       

    Parameter "silent" = true                                                                         

    Parameter "responsefile" = /oracle/app/11.2.0/grid/assistants/netca/netca.rsp                     

Done parsing command line arguments.                                                                  

Oracle Net Services Configuration:                                                                    

Profile configuration complete.                                                                       

ListenerException: Could not create Listener: TNS-04414: File error                                   

Error: null                                                                                           

Check the trace file for details: /oracle/app/grid/cfgtoollogs/netca/trace_GridHome1-1607055PM5133.log

Oracle Net Services configuration failed.  The exit code is 1                                         

报错了,应该是监听已经存在了,重新添加进crs中:

[ZFZHLHRDB1:grid]:/oracle/app/11.2.0/grid/network/admin>crsctl stat res -t                                 

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                 

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

Local Resources                                                                                            

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

ora.DATA.dg                                                                                                

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.LISTENER_LHRDG.lsnr                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.asm                                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1               Started                                       

               ONLINE  ONLINE       ZFZHLHRDB2               Started                                       

ora.gsd                                                                                                    

               OFFLINE OFFLINE      ZFZHLHRDB1                                                             

               OFFLINE OFFLINE      ZFZHLHRDB2                                                             

ora.net1.network                                                                                           

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.ons                                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.registry.acfs                                                                                          

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

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

Cluster Resources                                                                                          

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

ora.LISTENER_SCAN1.lsnr                                                                                    

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.cvu                                                                                                    

      1        ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.myrac.db                                                                                               

      1        ONLINE  ONLINE       ZFZHLHRDB1               Open                                          

ora.oc4j                                                                                                   

      1        ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.oraesdb.db                                                                                             

      1        ONLINE  OFFLINE                               Instance Shutdown                             

      2        ONLINE  OFFLINE                                                                             

ora.oraeskdb.db                                                                                            

      1        ONLINE  ONLINE       ZFZHLHRDB1               Open,Readonly                                 

      2        OFFLINE OFFLINE                               Instance Shutdown                             

ora.scan1.vip                                                                                              

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.ZFZHLHRDB1.vip                                                                                         

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.ZFZHLHRDB2.vip                                                                                         

      1        ONLINE  ONLINE       ZFZHLHRDB2                                                             

[ZFZHLHRDB1:grid]:/oracle/app/11.2.0/grid/network/admin>                                                   

[ZFZHLHRDB1:grid]:/oracle/app/11.2.0/grid/network/admin>                                                   

[ZFZHLHRDB1:grid]:/oracle/app/11.2.0/grid/network/admin>srvctl add listener -l LISTENER -p 1521 -o $ORACLE_HOME

[ZFZHLHRDB1:grid]:/oracle/app/11.2.0/grid/network/admin>crsctl stat res -t                                 

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                 

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

Local Resources                                                                                            

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

ora.DATA.dg                                                                                                

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.LISTENER.lsnr                                                                                          

               OFFLINE OFFLINE      ZFZHLHRDB1                                                             

               OFFLINE OFFLINE      ZFZHLHRDB2                                                             

ora.LISTENER_LHRDG.lsnr                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.asm                                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1               Started                                       

               ONLINE  ONLINE       ZFZHLHRDB2               Started                                       

ora.gsd                                                                                                    

               OFFLINE OFFLINE      ZFZHLHRDB1                                                             

               OFFLINE OFFLINE      ZFZHLHRDB2                                                             

ora.net1.network                                                                                           

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.ons                                                                                                    

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.registry.acfs                                                                                          

               ONLINE  ONLINE       ZFZHLHRDB1                                                             

               ONLINE  ONLINE       ZFZHLHRDB2                                                             

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

Cluster Resources                                                                                          

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

ora.LISTENER_SCAN1.lsnr                                                                                    

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.cvu                                                                                                    

      1        ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.oc4j                                                                                                   

      1        ONLINE  ONLINE       ZFZHLHRDB2                                                             

ora.oraesdb.db                                                                                             

      1        ONLINE  OFFLINE                               Instance Shutdown                             

      2        ONLINE  OFFLINE                                                                             

ora.oraeskdb.db                                                                                            

      1        ONLINE  ONLINE       ZFZHLHRDB1               Open,Readonly                                 

      2        OFFLINE OFFLINE                               Instance Shutdown                             

ora.scan1.vip                                                                                              

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.ZFZHLHRDB1.vip                                                                                         

      1        ONLINE  ONLINE       ZFZHLHRDB1                                                             

ora.ZFZHLHRDB2.vip                                                                                         

      1        ONLINE  ONLINE       ZFZHLHRDB2  

[ZFZHLHRDB1:grid]:/home/grid>crsctl stop res ora.LISTENER.lsnr     

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ZFZHLHRDB2'   

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ZFZHLHRDB1'   

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ZFZHLHRDB1' succeeded    

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ZFZHLHRDB2' succeeded    

[ZFZHLHRDB1:grid]:/home/grid>crsctl start res ora.LISTENER.lsnr    

CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'ZFZHLHRDB2'  

CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'ZFZHLHRDB1'  

CRS-2676: Start of 'ora.LISTENER.lsnr' on 'ZFZHLHRDB1' succeeded   

CRS-2676: Start of 'ora.LISTENER.lsnr' on 'ZFZHLHRDB2' succeeded                                                              

 

原本以为就是这个原因导致的,结果添加完ora.LISTENER.lsnr后还是单实例的,郁闷。。。更郁闷的是第二次创建后,trace文件中已经没有任何错误了,无论搜errorfail都搜不到,但是创建的数据库还是单实例,,,第二次创建的日志:

wps3AF6.tmp[4]

有种深深的挫败感,于是解决同事碰到的那个DG问题,参考:http://blog.itpub.net/26736162/viewspace-2121688/时间就这样过了2天,到了78号,手头又没什么事情了,想起来dbca这个问题,想来想去还是得从日志入手,老子一行一行的看,总能看出点东西来,但这次我比对的看,就是找一个dbca可以创建rac的环境,生成日志来分析差异,结果令我震惊了。

当小麦苗看到第5行的日志的时候,发现一个null的问题,Current Version From Inventory: null,截图如下:

错误环境截图:

wps3AF7.tmp[4] 

而正常环境的rac是这个样子的:

wps3AF8.tmp[4] 

可以看到正常环境下,可以获取到HomeinfoCurrent Version From Inventory的值,当看到Inventory这个词的时候我就想我已经找到问题的答案了。应该是Inventory这个目录出现了问题,标准点的说法应该是/oracle/app/oraInventory/ContentsXML/inventory.xml这个文件的内容有问题了。Inventory目录存放的是Oracle软件安装的目录信息,Oracle升级也需要这个目录,执行opatch lspatches也需要这个目录。oraInventory目录的位置在/etc/oraInst.loc中记录,11g中我们可以通过$ORACLE_HOME/oui/bin/attachHome.sh来重建这个目录。

 

2个节点上分别执行:

[ZFZHLHRDB1:oracle]:/oracle/app>$ORACLE_HOME/oui/bin/attachHome.sh

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/app/oraInventory

'AttachHome' was successful.

 

重建Inventory这个目录后重新执行建库脚本:

[ZFZHLHRDB1:oracle]:/oracle>dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

> -gdbname racdb  -sid racdb \                                                                                     

-gdbname racdb  -sid racdb \                                                                                       

> -sysPassword lhr -systemPassword lhr \                                                                           

> -datafileDestination 'DATA/' -recoveryAreaDestination 'DATA/' \                                                  

> -redoLogFileSize 50 \                                                                                            

> -storageType ASM -asmsnmpPassword lhr  -diskGroupName 'DATA' \                                                   

> -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \                                                         

> -sampleSchema true \                                                                                             

> -automaticMemoryManagement true -totalMemory 2048 \                                                              

> -databaseType OLTP  \                                                                                            

> -emConfiguration NONE \                                                                                          

> -nodelist ZFZHLHRDB1,ZFZHLHRDB2                                                                                  

Copying database files                                                                                             

1% complete                                                                                                        

3% complete                                                                                                        

9% complete                                                                                                        

15% complete                                                                                                       

21% complete                                                                                                       

30% complete                                                                                                       

Creating and starting Oracle instance                                                                              

32% complete                                                                                                       

36% complete                                                                                                       

40% complete                                                                                                       

44% complete                                                                                                       

45% complete                                                                                                       

48% complete                                                                                                       

50% complete                                                                                                       

Creating cluster database views                                                                                    

52% complete                                                                                                       

70% complete                                                                                                       

Completing Database Creation                                                                                       

73% complete                                                                                                       

76% complete                                                                                                       

85% complete                                                                                                       

94% complete                                                                                                       

100% complete                                                                                                      

Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/racdb/racdb.log" for further details.                    

 

已经正常了,唉,o(︶︿︶)o 唉,折腾了这么久原来是这个文件的问题,至于新环境为啥这个目录的配置文件不全,这个估计得追溯到rac的安装过程了,这个就不去纠结了。

 

 

一.3.3.1  模拟让故障重现

我们再来看看/oracle/app/oraInventory/ContentsXML/inventory.xml文件的内容:

[ZFZHLHRDB1:oracle]:/oracle>more /oracle/app/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="GridHome1" LOC="/oracle/app/11.2.0/grid" TYPE="O" IDX="1" CRS="true">

   <NODE_LIST>

      <NODE NAME="ZFZHLHRDB1"/>

      <NODE NAME="ZFZHLHRDB2"/>

   </NODE_LIST>

</HOME>

<HOME NAME="DbHome1" LOC="/oracle/app/oracle/product/11.2.0/db" TYPE="O" IDX="2">

   <NODE_LIST>

      <NODE NAME="ZFZHLHRDB1"/>

      <NODE NAME="ZFZHLHRDB2"/>

   </NODE_LIST>

</HOME>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

对了,看仔细了,文件中有2个部分,若把蓝色字体的部分删掉,或者把/oracle/app/oraInventory/ContentsXML/inventory.xml的权限修改为root用户,那么执行dbca的时候将又回到单库的时代,原来dbca会从这里去获取是否集群环境,小麦苗阅读了dbca这个shell脚本,无奈最后发现是调用的java,但java这是个二进制文件不是shell脚本,所以就无法知道到底从哪里获取的集群环境信息。

小麦苗已亲自测试过,各位朋友测试过了吗????

一.3.3.2  关于重建Inventory目录的2种办法

重建Inventory目录的时候,生成的log文件在/oracle/app/oraInventory/logs下。

一、 方法一:$ORACLE_HOME/oui/bin/attachHome.sh

这篇文档中提到有一个脚本$ORACLE_HOME/oui/bin/attachHome.sh可以重建Inventory目录,但是我们可以看到在不同的用户下(gridoracle),其OHOME的变量值不同,所以若单独创建可以执行该脚本即可。

[ZFXDESKDB1:grid]:/home/grid>more $ORACLE_HOME/oui/bin/attachHome.sh

#!/bin/sh

OHOME=/oracle/app/11.2.0/grid

OHOMENAME=Ora11g_gridinfrahome1

CUR_DIR=`pwd`

cd $OHOME/oui/bin

./runInstaller -detachhome ORACLE_HOME=$OHOME ORACLE_HOME_NAME=$OHOMENAME $* > /dev/null 2>&1

./runInstaller -attachhome ORACLE_HOME=$OHOME ORACLE_HOME_NAME=$OHOMENAME $*

cd $CUR_DIR

[ZFXDESKDB1:grid]:/home/grid>exit

[ZFXDESKDB1:root]:/oracle/app>su - oracle

[ZFXDESKDB1:oracle]:/oracle>more $ORACLE_HOME/oui/bin/attachHome.sh

#!/bin/sh

OHOME=/oracle/app/oracle/product/11.2.0/db

OHOMENAME=DbHome1

CUR_DIR=`pwd`

cd $OHOME/oui/bin

./runInstaller -detachhome ORACLE_HOME=$OHOME ORACLE_HOME_NAME=$OHOMENAME $* > /dev/null 2>&1

./runInstaller -attachhome ORACLE_HOME=$OHOME ORACLE_HOME_NAME=$OHOMENAME $*

cd $CUR_DIR

[ZFXDESKDB1:oracle]:/oracle>

备份2个节点的Inventory目录,并重建空的Inventory目录,然后分别在gridoracle用户下执行$ORACLE_HOME/oui/bin/attachHome.sh命令即可,注意只需要在其中的一个节点上执行即可。

 

[ZFXDESKDB1:root]:/oracle/app/oraInventory>$ORACLE_HOME/oui/bin/attachHome.sh

 

The user is root. Oracle Universal Installer cannot continue installation if the user is root.

: A file or directory in the path name does not exist.

[ZFXDESKDB1:root]:/oracle/app/oraInventory>su - grid 

[ZFXDESKDB1:grid]:/home/grid>$ORACLE_HOME/oui/bin/attachHome.sh

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/app/oraInventory

'AttachHome' was successful.

[ZFXDESKDB1:grid]:/home/grid>cd /oracle/app/oraInventory/ContentsXML

[ZFXDESKDB1:grid]:/oracle/app/oraInventory/ContentsXML>more inv*

<?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="Ora11g_gridinfrahome1" LOC="/oracle/app/11.2.0/grid" TYPE="O" IDX="1" CRS="true">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

[ZFXDESKDB1:grid]:/oracle/app/oraInventory/ContentsXML>exit

[ZFXDESKDB1:root]:/oracle/app/oraInventory>su - oracle

[ZFXDESKDB1:oracle]:/oracle>$ORACLE_HOME/oui/bin/attachHome.sh

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/app/oraInventory

'AttachHome' was successful.

[ZFXDESKDB1:oracle]:/oracle>cd /oracle/app/oraInventory/ContentsXML

[ZFXDESKDB1:oracle]:/oracle/app/oraInventory/ContentsXML>more inv*

<?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="Ora11g_gridinfrahome1" LOC="/oracle/app/11.2.0/grid" TYPE="O" IDX="1" CRS="true">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

<HOME NAME="DbHome1" LOC="/oracle/app/oracle/product/11.2.0/db" TYPE="O" IDX="2">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

 

二、 方法二:集群下统一创建

可以去小麦苗的云盘下载该文档:

 

wps3B09.tmp[4]

根据MOSMOS:413939.1)的介绍,重建Inventory的步骤:

 

[ZFXDESKDB2:oracle]:/oracle>more  /etc/oraInst.loc

inventory_loc=/oracle/app/oraInventory

inst_group=dba

[ZFXDESKDB2:oracle]:/oracle>cd /oracle/app/oraInventory

[ZFXDESKDB2:oracle]:/oracle/app/oraInventory>l

total 24

drwxrwx---    2 grid     dba             256 Jul 08 13:42 ContentsXML

drwxrwx---    2 grid     dba            4096 Jul 08 10:41 logs

-rw-rw----    1 grid     dba              54 Jul 01 10:45 oraInst.loc

-rwxrwx---    1 grid     dba            1630 Mar 05 2012  orainstRoot.sh

[ZFXDESKDB2:oracle]:/oracle/app/oraInventory>cd ContentsXML

[ZFXDESKDB2:oracle]:/oracle/app/oraInventory/ContentsXML>l

total 24

-rw-rw----    1 grid     dba             329 Jul 08 10:42 comps.xml

-rwxrwxrwx    1 oracle   dba             757 Jul 08 12:45 inventory.xml

-rw-rw----    1 grid     dba             292 Jul 08 10:42 libs.xml

[ZFXDESKDB2:oracle]:/oracle/app/oraInventory/ContentsXML>more 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="GridHome1" LOC="/oracle/app/11.2.0/grid" TYPE="O" IDX="1" CRS="true">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

<HOME NAME="DbHome1" LOC="/oracle/app/oracle/product/11.2.0/db" TYPE="O" IDX="2">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

 

 

接下来分别备份2个节点的Inventory目录,并重建空的Inventory目录:

[ZFXDESKDB2:root]:/oracle/app>mv oraInventory oraInventory.orig

[ZFXDESKDB2:root]:/oracle/app>echo $ORACLE_HOME

/oracle/app/11.2.0/grid

[ZFXDESKDB2:root]:/oracle/app>

[ZFXDESKDB2:root]:/oracle/app>l

total 0

drwxr-xr-x    3 root     dba             256 Jul 01 10:29 11.2.0

drwxr-xr-x    7 grid     dba             256 Jul 07 18:20 grid

drwxrwx---    4 grid     dba             256 Jul 08 10:42 oraInventory.orig

drwxr-xr-x    9 oracle   dba             256 Jul 07 19:19 oracle

[ZFXDESKDB2:root]:/oracle/app>cp -R oraInventory.orig oraInventory  

[ZFXDESKDB2:root]:/oracle/app>cd oraInventory

[ZFXDESKDB2:root]:/oracle/app/oraInventory>l

total 24

drwxr-x---    2 root     system          256 Jul 11 14:43 ContentsXML

drwxr-x---    2 root     system         4096 Jul 11 14:43 logs

-rw-r-----    1 root     system           54 Jul 11 14:43 oraInst.loc

-rwxr-x---    1 root     system         1630 Jul 11 14:43 orainstRoot.sh

[ZFXDESKDB2:root]:/oracle/app/oraInventory>rm -rf *

[ZFXDESKDB2:root]:/oracle/app/oraInventory>cd ..

[ZFXDESKDB2:root]:/oracle/app>l

total 0

drwxr-xr-x    3 root     dba             256 Jul 01 10:29 11.2.0

drwxr-xr-x    7 grid     dba             256 Jul 07 18:20 grid

drwxr-x---    2 root     system          256 Jul 11 14:43 oraInventory

drwxrwx---    4 grid     dba             256 Jul 08 10:42 oraInventory.orig

drwxr-xr-x    9 oracle   dba             256 Jul 07 19:19 oracle

[ZFXDESKDB2:root]:/oracle/app>chown grid.dba oraInventory

[ZFXDESKDB2:root]:/oracle/app>l

total 0

drwxr-xr-x    3 root     dba             256 Jul 01 10:29 11.2.0

drwxr-xr-x    7 grid     dba             256 Jul 07 18:20 grid

drwxr-x---    2 grid     dba             256 Jul 11 14:43 oraInventory

drwxrwx---    4 grid     dba             256 Jul 08 10:42 oraInventory.orig

drwxr-xr-x    9 oracle   dba             256 Jul 07 19:19 oracle

[ZFXDESKDB2:root]:/oracle/app>chmod 775 oraInventory

[ZFXDESKDB2:root]:/oracle/app>l

total 0

drwxr-xr-x    3 root     dba             256 Jul 01 10:29 11.2.0

drwxr-xr-x    7 grid     dba             256 Jul 07 18:20 grid

drwxrwxr-x    2 grid     dba             256 Jul 11 14:43 oraInventory

drwxrwx---    4 grid     dba             256 Jul 08 10:42 oraInventory.orig

drwxr-xr-x    9 oracle   dba             256 Jul 07 19:19 oracle

 

以下命令用grid用户在节点一执行即可,节点二自动创建:

[ZFXDESKDB1:grid]:/home/grid>$ORACLE_HOME/oui/bin/runInstaller -silent -ignoreSysPrereqs \

> -attachHome ORACLE_HOME="/oracle/app/11.2.0/grid" ORACLE_HOME_NAME="GridHome1" \

> LOCAL_NODE="ZFXDESKDB1" CLUSTER_NODES="{ZFXDESKDB1,ZFXDESKDB2}" CRS=true

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/app/oraInventory

'AttachHome' was successful.

 

====》GRID_HOME创建成功,接下来创建ORACLE_HOME

 

[ZFXDESKDB1:grid]:/home/grid>$ORACLE_HOME/oui/bin/runInstaller -silent -ignoreSysPrereqs \

> -attachHome ORACLE_HOME="/oracle/app/oracle/product/11.2.0/db" ORACLE_HOME_NAME="DbHome1" \

> LOCAL_NODE="ZFXDESKDB1" CLUSTER_NODES="{ZFXDESKDB1,ZFXDESKDB2}"

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/app/oraInventory

'AttachHome' was successful.

[ZFXDESKDB1:grid]:/home/grid>

 

====》2个节点均创建成功

[ZFXDESKDB2:root]:/oracle/app/oraInventory/ContentsXML>more inv*

<?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="GridHome1" LOC="/oracle/app/11.2.0/grid" TYPE="O" IDX="1" CRS="true">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

<HOME NAME="DbHome1" LOC="/oracle/app/oracle/product/11.2.0/db" TYPE="O" IDX="2">

   <NODE_LIST>

      <NODE NAME="ZFXDESKDB1"/>

      <NODE NAME="ZFXDESKDB2"/>

   </NODE_LIST>

</HOME>

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>

[ZFXDESKDB2:root]:/oracle/app/oraInventory/ContentsXML>

 

注意的2点:

a-Do not try attachHome in all the nodes, which may corrupt the inventory and it results in OUI-10197:Unable to create a new Oracle Home at /u01/app/oracle/product/10.2.0/crs_1. Oracle Home already exists at this location. Select another location. Attaching Home in one node will be propagated to other nodes.

b-Make absolutely sure you are have backed up the original inventory before starting this procedure, so that you can revert if necessary.

 

 

一.4  故障处理总结

一.4.1  rac环境不能创建rac

在集群环境中, dbca不能创建rac库,那很可能就是/oracle/app/oraInventory/ContentsXML/inventory.xml文件中丢失了db部分的内容,我们可以使用$ORACLE_HOME/oui/bin/attachHome.sh来重建该目录,或手动修改该文件。

若执行attachHome.sh报如下的错误,那么删除/oracle/app/oraInventory/ContentsXML下的3个文件后继续执行即可。

org.xml.sax.SAXParseException: <Line 1, Column 1>: XML-20108: (Fatal Error) Start of root element expected.

  at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:415)

一.4.2  其它dbca静默建库常见错误的解决办法

一、 The Oracle system identifier(SID) "xxx" already exists. Specify another SID

用root用户编辑/etc/oratab,删除相应的记录: xxx:/u01/oracle:N ,保存退出问题解决。

 

二、 The cluster database(DB_NAME) "racdb" already exists. Please specify another DB_NAME.

原因:说明集群环境中已经有racdb这个数据库了。

解决办法:若数据库无用了,可以dbca -silent -deleteDatabase -sourceDB racdb来删除数据库,若数据库不能启动,则可以直接从crs中删除数据库的注册信息:srvctl remove db -d racdb -f后重新运行脚本即可。

 

 

三、 DBCA建库报错CRS-2566 PRCR-1071 PRCR-1006

PRCR-1006 : Failed to add resource ora.lhrdg.db for lhrdg

PRCR-1071 : Failed to register or update resource ora.lhrdg.db

CRS-2566: User 'oracle' does not have sufficient permissions to operate on resource 'ora.LISTENER_LHRDG.lsnr', which is part of the dependency specification.

DBCA_PROGRESS : 100%

 

权限不对,应该用grid来创建监听srvctl config listener -l LISTENER_LHRDG -a

具体参考我的bloghttp://blog.itpub.net/26736162/viewspace-2114484/

 

 

一.5  用到的SQL集合

RAC建库脚本:

dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

-gdbname racdb  -sid racdb \

-sysPassword lhr -systemPassword lhr \

-datafileDestination 'DATA/' -recoveryAreaDestination 'DATA/' \

-redoLogFileSize 50 \

-storageType ASM -asmsnmpPassword lhr  -diskGroupName 'DATA' \

-characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \

-sampleSchema true \

-automaticMemoryManagement true -totalMemory 2048 \

-databaseType OLTP  \

-emConfiguration NONE \

-nodelist zfxdeskdb1,zfxdeskdb2

静默创建监听:netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp

添加监听:srvctl add listener -l LISTENER -p 1521 -o $ORACLE_HOME

 

oraInventory目录:/oracle/app/oraInventory/ContentsXML/inventory.xml

重建的话,oracle执行:$ORACLE_HOME/oui/bin/attachHome.sh

 

重新执行root.sh脚本:

ocrconfig -showbackup

ocrconfig -manualbackup 

 

 

$ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose

ls -l $ORACLE_BASE/Clusterware/ckptGridHA*

find $ORACLE_HOME/gpnp/* -type f

find $ORACLE_HOME/gpnp/* -type f -exec rm -rf {} \;

 

 

 

$ORACLE_HOME/crs/install/rootcrs.pl -deconfig -force -verbose -lastnode -keepdg

ls -l $ORACLE_BASE/Clusterware/ckptGridHA*

find $ORACLE_HOME/gpnp/* -type f

find $ORACLE_HOME/gpnp/* -type f -exec rm -rf {} \;

 

 

ipcs

$ORACLE_HOME/root.sh

/oracle/app/11.2.0/grid/perl/bin/perl -I/oracle/app/11.2.0/grid/perl/lib -I/oracle/app/11.2.0/grid/crs/install /oracle/app/11.2.0/grid/crs/install/rootcrs.pl

 

ipcs

$ORACLE_HOME/root.sh

 

 

  About Me

..........................................................................................................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

本文在ITpub(http://blog.itpub.net/26736162)和博客园(http://www.cnblogs.com/lhrbest)有同步更新

本文地址:http://blog.itpub.net/26736162/viewspace-2121863/

本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b)

小麦苗分享的其它资料:http://blog.itpub.net/26736162/viewspace-1624453/

联系我请加QQ好友(642808185),注明添加缘由

于 2016-07-05 16:00~ 2016-07-08 19:00 在中行完成

【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】

..........................................................................................................................................................................................................

拿起手机扫描下边的图片来关注小麦苗的微信公众号:xiaomaimiaolhr,学习最实用的数据库技术。

wps3B1A.tmp[4] 

 

 

 

 

posted @ 2016-07-11 21:54  DB宝  阅读(5371)  评论(0编辑  收藏  举报