11g r2 rac votedisk 及 ocr 磁盘破坏后,基于ocr备份的恢复步骤
1.环境说明:
--votedisk 盘
[root@host01 volacfs]# $GRID_HOME/bin/crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 7b6d30d6daa34f5ebf6032a6277658ae (ORCL:ASMDISK01) [DATA]
2. ONLINE 438ab1410f1a4ffbbfd2226fac83a32b (ORCL:ASMDISK02) [DATA]
3. ONLINE 312a8c46ed944f22bf575749772c3bb4 (ORCL:ASMDISK03) [DATA]
--ocr 盘
[root@host01 ~]# cat /etc/oracle/ocr.loc
ocrconfig_loc=+DATA
local_only=FALSE
--ocr备份
[root@host01 ~]# $GRID_HOME/bin/ocrconfig -showbackup
host01 2018/08/12 16:44:33 /u01/app/11.2.0/grid/cdata/backup_20180812_164433.ocr
--asm 参数文件备份
ls -ltr /home/oracle/initasm.ora
2.问题说明
模拟votedisk 及 ocr 磁盘破坏后,有备份的完整恢复流程
3.操作流程
3.1.破坏votedisk 磁盘组的组成磁盘
dd if=/dev/zero of=/dev/oracleasm/disks/ASMDISK01 bs=1024k count=10
dd if=/dev/zero of=/dev/oracleasm/disks/ASMDISK02 bs=1024k count=10
3.2 停止所有节点,并重新启动节点某一个节点
$GRID_HOME/bin/crsctl stop crs
$GRID_HOME/bin/crsctl start crs
会发现已经有问题,
tail -f $GRID_HOME/log/host02/cssd/ocssd.log
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmvDiskVerify: Successful discovery of 1 disks
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmCompleteInitVFDiscovery: Completing initial voting file discovery
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmCompleteVFDiscovery: Completing voting file discovery
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmvDiskStateChange: state from discovered to pending diskORCL:ASMDISK03
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmvDiskStateChange: state from pending to configured diskORCL:ASMDISK03
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssnmvVerifyCommittedConfigVFs: Insufficient voting files found, found 1 of 3 configured, needed 2 voting files
2018-08-12 17:34:29.037: [ CSSD][3021994896](:CSSNM00020:)clssnmvVerifyCommittedConfigVFs: voting file 0, id 4c671444-ca054fad-bfeff9a5-9ceec253 not found
2018-08-12 17:34:29.037: [ CSSD][3021994896](:CSSNM00020:)clssnmvVerifyCommittedConfigVFs: voting file 1, id 92cec480-91bf4f8f-bff4f003-8fce148d not found
2018-08-12 17:34:29.037: [ CSSD][3021994896]ASSERT clssnm1.c 3301
2018-08-12 17:34:29.037: [ CSSD][3021994896](:CSSNM00021:)clssnmCompleteVFDiscovery: Found 1 voting files, but 2 are required. Terminating due to insufficient configured voting files
2018-08-12 17:34:29.037: [ CSSD][3021994896]###################################
2018-08-12 17:34:29.037: [ CSSD][3021994896]clssscExit: CSSD aborting from thread clssnmvDDiscThread
2018-08-12 17:34:29.037: [ CSSD][3021994896]###################################
2018-08-12 17:34:29.037: [ CSSD][3021994896](:CSSSC00012:)clssscExit: A fatal error occurred and the CSS daemon is terminating abnormally
3.3.停止所有节点
$GRID_HOME/bin/crsctl stop crs -f
3.4.dd掉voting disk 磁盘组所有的构成盘
dd if=/dev/zero of=/dev/oracleasm/disks/ASMDISK03 bs=1024k count=10
dd if=/dev/zero of=/dev/oracleasm/disks/ASMDISK04 bs=1024k count=10
3.5.在其中一个节点使用nocrs 方式启动 crs
[root@host01 ~]# $GRID_HOME/bin/crsctl start crs -excl -nocrs
3.6.登陆asm
sql>conn / as sysasm
sql>shutdown immediate;
sql>startup pfile='/home/oracle/initasm.ora';
--这里没有也没有关系,手工创建一个 initasm.ora 文件
主要内容:
*.asm_diskgroups='FRA'
*.asm_diskstring='ORCL:*'
3.7.创建磁盘组
--先检查一下磁盘
SQL> col path for a30
SQL>select group_number, disk_number, mount_status, header_status, path from v$asm_disk
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU PATH
------------ ----------- ------- ------------ ------------------------------
0 0 CLOSED CANDIDATE ORCL:ASMDISK01
0 1 CLOSED CANDIDATE ORCL:ASMDISK02
0 2 CLOSED CANDIDATE ORCL:ASMDISK03
0 3 CLOSED CANDIDATE ORCL:ASMDISK04
1 0 CACHED MEMBER ORCL:ASMDISK05
1 1 CACHED MEMBER ORCL:ASMDISK06
1 2 CACHED MEMBER ORCL:ASMDISK07
3 0 CACHED MEMBER ORCL:ASMDISK08
3 1 CACHED MEMBER ORCL:ASMDISK09
3 2 CACHED MEMBER ORCL:ASMDISK10
3 3 CACHED MEMBER ORCL:ASMDISK11
1 3 CACHED MEMBER ORCL:ASMDISK12
--创建磁盘组
SQL> create diskgroup data normal redundancy
disk 'ORCL:ASMDISK01','ORCL:ASMDISK02','ORCL:ASMDISK03','ORCL:ASMDISK04'
attribute 'compatible.asm'='11.2.0.0.0', 'compatible.rdbms'='11.2.0.0.0';
--这里 compatible.asm 必须是'11.2.0.0.0' 以上,否则, 后面在这个磁盘组创建参数文件,
会报:ORA-15221: ASM operation requires compatible.asm of 11.2.0.0.0 or higher
3.8.创建参数文件
SQL> create spfile='+data' from pfile='/home/oracle/initasm.ora';
3.9.恢复crs ocr 文件
[root@host01 ~]# $GRID_HOME/bin/ocrconfig -restore /u01/app/11.2.0/grid/cdata/backup_20180812_164433.ocr
3.10.恢复votedisk
[root@host01 ~]# $GRID_HOME/bin/crsctl replace votedisk '+data'
3.11.确认votdisk,ocr盘情况
[root@host01 ~]# $GRID_HOME/bin/ocrcheck
[root@host01 ~]# $GRID_HOME/bin/crsctl query css votedisk
3.12.停止crs,以正常方式启动(所有节点)
[root@host01 ~]# $GRID_HOME/bin/crsctl stop crs
[root@host01 ~]# $GRID_HOME/bin/crsctl start crs
3.13 检查集群已经没有问题
[root@host01 ~]# $GRID_HOME/bin/crsctl stat res -t
|