ITPub博客

首页 > 数据库 > Oracle > RAC 11.2.0.3 OCR的恢复实例 2

RAC 11.2.0.3 OCR的恢复实例 2

原创 Oracle 作者:SnowDBA 时间:2014-07-08 22:47:08 0 删除 编辑
本次试验的主要步骤是验证ocrconfig -restore 和 crsctl replace votedisk 命令的先后顺序是否能改变

步骤0,查看当前表决磁盘信息:
[root@node1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   6601def4246d4f7ebf0ed724d7c61af1 (/dev/asm-diskb) [ORCVOTE]
Located 1 voting disk(s).

步骤1 执行OCR文件的手动备份
[root@node1 ~]# ocrconfig -manualbackup

node1     2014/07/08 22:01:22     /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup_20140708_220122.ocr

步骤2 清空存储表决磁盘和OCR的ASM磁盘组所有磁盘的头信息,模拟磁盘组故障
[root@node1 ~]# dd if=/dev/zero of=/dev/asm-diskb bs=1024 count=256
256+0 records in
256+0 records out
262144 bytes (262 kB) copied, 0.01301 seconds, 20.1 MB/s

查询当前表决磁盘信息: 此时查看依然有信息的哦
[root@node1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   6601def4246d4f7ebf0ed724d7c61af1 (/dev/asm-diskb) [ORCVOTE]
Located 1 voting disk(s). 

步骤3 以root用户独占模式启动CRS:
在节点node1关闭crs
[root@node1 ~]#  crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.crsd' on 'node1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'node1'
CRS-2673: Attempting to stop 'ora.ORCVOTE.dg' on 'node1'
CRS-2673: Attempting to stop 'ora.prod.db' on 'node1'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.node1.vip' on 'node1'
CRS-2677: Stop of 'ora.node1.vip' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.node1.vip' on 'node2'
CRS-2677: Stop of 'ora.prod.db' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.ARCH.dg' on 'node1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'node1'
CRS-2677: Stop of 'ora.ARCH.dg' on 'node1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'node1' succeeded
CRS-2676: Start of 'ora.node1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.ORCVOTE.dg' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2677: Stop of 'ora.asm' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'node1'
CRS-2677: Stop of 'ora.ons' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'node1'
CRS-2677: Stop of 'ora.net1.network' on 'node1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'node1' has completed
CRS-2677: Stop of 'ora.crsd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'node1'
CRS-2673: Attempting to stop 'ora.evmd' on 'node1'
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2677: Stop of 'ora.evmd' on 'node1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'node1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'node1' succeeded
CRS-2677: Stop of 'ora.asm' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'node1'
CRS-2677: Stop of 'ora.cssd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'node1'
CRS-2677: Stop of 'ora.crf' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'node1'
CRS-2677: Stop of 'ora.gipcd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'node1'
CRS-2677: Stop of 'ora.gpnpd' on 'node1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node1' has completed
CRS-4133: Oracle High Availability Services has been stopped.

在节点node2关闭crs
[root@node2 ~]# crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node2'
CRS-2673: Attempting to stop 'ora.crsd' on 'node2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'node2'
CRS-2673: Attempting to stop 'ora.oc4j' on 'node2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'node2'
CRS-2673: Attempting to stop 'ora.ORCVOTE.dg' on 'node2'
CRS-2673: Attempting to stop 'ora.prod.db' on 'node2'
CRS-2673: Attempting to stop 'ora.node2.vip' on 'node2'
CRS-2673: Attempting to stop 'ora.cvu' on 'node2'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'node2'
CRS-2677: Stop of 'ora.node2.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.node1.vip' on 'node2'
CRS-2677: Stop of 'ora.node1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'node2'
CRS-2677: Stop of 'ora.scan1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.prod.db' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.ARCH.dg' on 'node2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'node2'
CRS-2677: Stop of 'ora.ARCH.dg' on 'node2' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'node2' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'node2' succeeded
CRS-2677: Stop of 'ora.cvu' on 'node2' succeeded
CRS-2677: Stop of 'ora.ORCVOTE.dg' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'node2'
CRS-2677: Stop of 'ora.asm' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'node2'
CRS-2677: Stop of 'ora.ons' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'node2'
CRS-2677: Stop of 'ora.net1.network' on 'node2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'node2' has completed
CRS-2677: Stop of 'ora.crsd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'node2'
CRS-2673: Attempting to stop 'ora.ctssd' on 'node2'
CRS-2673: Attempting to stop 'ora.evmd' on 'node2'
CRS-2673: Attempting to stop 'ora.asm' on 'node2'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node2'
CRS-2677: Stop of 'ora.crf' on 'node2' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'node2' succeeded
CRS-2677: Stop of 'ora.evmd' on 'node2' succeeded
CRS-2677: Stop of 'ora.asm' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node2'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node2' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'node2'
CRS-2677: Stop of 'ora.cssd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'node2'
CRS-2677: Stop of 'ora.gipcd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'node2'
CRS-2677: Stop of 'ora.gpnpd' on 'node2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node2' has completed
CRS-4133: Oracle High Availability Services has been stopped. 

如果不能顺利的停止CRS, 可以采用下列命令杀掉进程
ps -ef | grep d.bin | grep -v grep | awk '{print $2}' | xargs kill -s 9

在节点node1以独占方式开启crs
[root@node1 ~]# crsctl start crs -excl -nocrs
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.mdnsd' on 'node1'
CRS-2676: Start of 'ora.mdnsd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'node1'
CRS-2676: Start of 'ora.gpnpd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'node1'
CRS-2672: Attempting to start 'ora.gipcd' on 'node1'
CRS-2676: Start of 'ora.cssdmonitor' on 'node1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'node1'
CRS-2672: Attempting to start 'ora.diskmon' on 'node1'
CRS-2676: Start of 'ora.diskmon' on 'node1' succeeded
CRS-2676: Start of 'ora.cssd' on 'node1' succeeded
CRS-2679: Attempting to clean 'ora.cluster_interconnect.haip' on 'node1'
CRS-2672: Attempting to start 'ora.ctssd' on 'node1'
CRS-2681: Clean of 'ora.cluster_interconnect.haip' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'node1'
CRS-2676: Start of 'ora.ctssd' on 'node1' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'node1'
CRS-2676: Start of 'ora.asm' on 'node1' succeeded

此时查看votedisk已经没有信息了
[root@node1 ~]# crsctl query css votedisk
Located 0 voting disk(s).

步骤4 切换到grid用户,重新创建用于存储表决磁盘和OCR的磁盘组
[root@node1 ~]# su - grid
[grid@node1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 8 21:30:23 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> create diskgroup ORCVOTE EXTERNAL REDUNDANCY disk '/dev/asm-diskb'
  2  attribute 'compatible.asm'='11.2.0.0.0';

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
ARCH                           DISMOUNTED
DATA                           DISMOUNTED
ORCVOTE                        MOUNTED


步骤5 设置asm_diskstring
SQL> col name for a30
SQL> col path for a50
SQL> set linesize 200               
SQL> select name,path from v$asm_disk;

no rows selected

SQL> alter system set asm_diskstring='/dev/asm-disk*';

System altered.

SQL> select name,path from v$asm_disk;

NAME                           PATH
------------------------------ --------------------------------------------------
                               /dev/asm-diski
                               /dev/asm-diskd
                               /dev/asm-diskb
                               /dev/asm-diskc
                               /dev/asm-diskf
                               /dev/asm-diskg
                               /dev/asm-diske
                               /dev/asm-diskh

8 rows selected.

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
ARCH                           DISMOUNTED
DATA                           DISMOUNTED
ORCVOTE                        DISMOUNTED

SQL> alter diskgroup ORCVOTE mount;

Diskgroup altered.

步骤6 执行表决磁盘的恢复:
找到之前的手工备份
[root@node1 ~]# cd /g01/grid/app/11.2.0/grid/cdata/node-cluster
[root@node1 node-cluster]# ll
total 56272
-rw------- 1 root root 7188480 Jul  2 04:33 backup00.ocr
-rwxrwxrwx 1 root root 7188480 Jun 11 16:06 backup01.ocr
-rw------- 1 root root 7192576 Jul  6 17:13 backup_20140706_171301.ocr
-rw------- 1 root root 7192576 Jul  6 18:17 backup_20140706_181750.ocr
-rw------- 1 root root 7192576 Jul  8 21:23 backup_20140708_212328.ocr
-rw------- 1 root root 7192576 Jul  8 22:01 backup_20140708_220122.ocr
-rw------- 1 root root 7188480 Jul  2 04:33 day.ocr
-rw------- 1 root root 7188480 Jul  2 04:33 week.ocr

步骤10 执行OCR恢复、votedisk重置
[root@node1 node-cluster]# ocrconfig -restore backup_20140708_220122.ocr

[root@node1 node-cluster]# crsctl replace votedisk +ORCVOTE
Successful addition of voting disk 1df65fd6c17b4f6bbf6a516c9f2f16b6.
Successfully replaced voting disk group with +ORCVOTE.
CRS-4266: Voting file(s) successfully replaced

检测OCR
[root@node1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2872
         Available space (kbytes) :     259248
         ID                       :  566437264
         Device/File Name         :   +ORCVOTE
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded


步骤11 停止独占模式运行的CRS
crsctl stop crs -f

步骤12 在所有节点执行以下命令以正常模式启动CRS:
[root@node1 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

[root@node2 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

步骤13 在所有节点检查节点状态
[root@node1 ~]# crsctl check crd
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

[root@node2 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online


步骤14 在任一节点执行以下命令检查素有资源的状态
crsctl status res -t


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29047826/viewspace-1213117/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-06-21

  • 博文量
    223
  • 访问量
    1633592