RAC votedisk和OCR还原

---1.执行OCR文件的手动备份

[root@rac1 ~]# ocrconfig -manualbackup

[root@rac1 ~]# ocrconfig -manualbackup

rac1     2016/01/21 19:03:06     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_190306.ocr

rac1     2016/01/21 18:40:18     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_184018.ocr

rac1     2016/01/21 18:13:32     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_181332.ocr


--2.查看OCR的备份

[root@rac1 ~]# ocrconfig -showbackup 

rac1     2016/01/21 18:54:52     /g01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr

rac1     2016/01/21 14:54:49     /g01/app/11.2.0/grid/cdata/rac-cluster/backup01.ocr

rac1     2016/01/21 10:54:46     /g01/app/11.2.0/grid/cdata/rac-cluster/backup02.ocr

rac1     2016/01/20 02:44:37     /g01/app/11.2.0/grid/cdata/rac-cluster/day.ocr

rac1     2016/01/16 20:26:01     /g01/app/11.2.0/grid/cdata/rac-cluster/week.ocr

rac1     2016/01/21 19:03:06     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_190306.ocr

rac1     2016/01/21 18:40:18     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_184018.ocr

rac1     2016/01/21 18:13:32     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_181332.ocr



----3.查看votedisk

[root@rac1 ~]# crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   82c35688a9654f47bfc14ebf973821a6 (/dev/asm-diskb) [OCR]
Located 1 voting disk(s).



---4.停止数据库和群集
停库:
[root@rac1 ~]# srvctl stop database -d racdb -o immediate 
[root@rac1 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.FRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.oc4j
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.scan1.vip
      1        ONLINE  ONLINE       rac1     

停集群:
[root@rac1 ~]# crsctl stop cluster -all 
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.cvu' on 'rac1'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac1'
CRS-2677: Stop of 'ora.cvu' on 'rac1' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'
CRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.crsd' on 'rac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac2'
CRS-2677: Stop of 'ora.DATA.dg' on 'rac2' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'rac2' succeeded
CRS-2677: Stop of 'ora.rac2.vip' on 'rac2' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac2'
CRS-2677: Stop of 'ora.ons' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac2'
CRS-2677: Stop of 'ora.net1.network' on 'rac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac2' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac2'
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac1'
CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'
CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac2'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac2'
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded


[root@rac1 ~]#  crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4530: Communications failure contacting Cluster Synchronization Services daemon
CRS-4534: Cannot communicate with Event Manager


[root@rac1 ~]# crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@rac1 ~]# crsctl status resource -t
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Status failed, or completed with errors.



--5.破坏表决磁盘和OCR

[root@rac1 ~]# dd if=/dev/zero of=/dev/asm-diskb bs=1024k count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0371992 s, 28.2 MB/s

---6.启动crs查看错误
[root@rac1 ~]# crsctl start cluster -all  
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Start failed, or completed with errors.

[root@rac1 ~]#  crsctl start cluster -all  
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac2'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac2'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac2'
CRS-2676: Start of 'ora.diskmon' on 'rac2' succeeded  --停在这里


---7.停止crs
[root@rac1 bin]# ./crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.



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


[root@rac1 ~]# crsctl query css votedisk
Located 0 voting disk(s).


--9.重建原ocr和votedisk所在磁盘组

sqlplus / as sysasm

col path for a50
set lines 300
select path,header_status from v$asm_disk; 

PATH                           HEADER_STATUS
-------------------------------------------------- ------------------------------------
/dev/asm-diskb                       CANDIDATE
/dev/asm-diskc                       MEMBER
/dev/asm-diskd                       MEMBER


create diskgroup OCR
external redundancy
disk '/dev/asm-diskb' 
attribute 'compatible.rdbms' = '11.2','compatible.asm' = '11.2';


SQL> select path,header_status from v$asm_disk; 

PATH                           HEADER_STATUS
-------------------------------------------------- ------------------------------------
/dev/asm-diskd                       MEMBER
/dev/asm-diskc                       MEMBER
/dev/asm-diskb                       MEMBER


ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      2016     1966                0            1966              0             N  OCR/





SQL> show parameter asm_diskstring

如果asm_diskstring没有值,表示ASM磁盘用的是默认ASM磁盘搜索路径。

修改成实际的ASM磁盘搜索路径:
SQL> alter system set asm_diskstring='/dev/*';

手动加载diskgroup
SQL> alter diskgroup data mount;

Diskgroup altered.

SQL> alter diskgroup fra mount;

Diskgroup altered.

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     40000    37339                0           37339              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     30016    29686                0           29686              0             N  FRA/
MOUNTED  EXTERN  N         512   4096  1048576      2016     1966                0            1966              0             N  OCR/


----10.恢复VOTEDISK和OCR

---查看备份
[root@rac1 ~]# ls -al /g01/app/11.2.0/grid/cdata/rac-cluster/
total 63672
drwxrwxr-x 2 grid oinstall    4096 Jan 21 19:03 .
drwxrwxr-x 5 grid oinstall    4096 Jan 16 16:06 ..
-rw------- 1 root root     7315456 Jan 21 18:54 backup00.ocr
-rw------- 1 root root     7266304 Jan 21 14:54 backup01.ocr
-rw------- 1 root root     7266304 Jan 21 10:54 backup02.ocr
-rw------- 1 root root     7266304 Jan 21 18:13 backup_20160121_181332.ocr
-rw------- 1 root root     7294976 Jan 21 18:40 backup_20160121_184018.ocr
-rw------- 1 root root     7315456 Jan 21 19:03 backup_20160121_190306.ocr
-rw------- 1 root root     7266304 Jan 21 02:54 day_.ocr
-rw------- 1 root root     7266304 Jan 20 02:44 day.ocr
-rw------- 1 root root     6934528 Jan 16 20:26 week.ocr


[root@rac1 ~]# ocrconfig -showbackup
PROT-26: Oracle Cluster Registry backup locations were retrieved from a local copy

rac1     2016/01/21 18:54:52     /g01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr

rac1     2016/01/21 14:54:49     /g01/app/11.2.0/grid/cdata/rac-cluster/backup01.ocr

rac1     2016/01/21 10:54:46     /g01/app/11.2.0/grid/cdata/rac-cluster/backup02.ocr

rac1     2016/01/20 02:44:37     /g01/app/11.2.0/grid/cdata/rac-cluster/day.ocr

rac1     2016/01/16 20:26:01     /g01/app/11.2.0/grid/cdata/rac-cluster/week.ocr

rac1     2016/01/21 18:40:18     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_184018.ocr

rac1     2016/01/21 18:13:32     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_181332.ocr


[root@rac1 ~]# ocrconfig -showbackup manual
PROT-26: Oracle Cluster Registry backup locations were retrieved from a local copy

rac1     2016/01/21 18:40:18     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_184018.ocr

rac1     2016/01/21 18:13:32     /g01/app/11.2.0/grid/cdata/rac-cluster/backup_20160121_181332.ocr


#ocrconfig -restore  /g01/app/11.2.0/grid/cdata/rac-cluster/backup00.ocr

[root@rac1 ~]# crsctl replace votedisk  +OCR
Successful addition of voting disk 75b8db60ea4b4fefbf783d9b81527150.
Successfully replaced voting disk group with +OCR.
CRS-4266: Voting file(s) successfully replaced

[root@rac1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   75b8db60ea4b4fefbf783d9b81527150 (/dev/asm-diskb) [OCR]
Located 1 voting disk(s).

----11.停止CRS
[root@rac1 ~]# crsctl stop  crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.


---12.正常启动crs

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


[root@rac1 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online



[root@rac1 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.FRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.oc4j
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        ONLINE  ONLINE       rac1                     Open                
      2        ONLINE  ONLINE       rac2                     Open                
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                                         



你可能感兴趣的:(RAC,RAC,11.2,votedisk和OCR还原,votedisk和OCR还原,votedisk和OC)