RAC OCR备份与恢复

来源:互联网 发布:融信普惠网络借贷信息 编辑:程序博客网 时间:2024/05/01 07:55

环境:RHEL5.8 RAC 11.2.0.4.0

1:查看ORC和voting disk信息:

In 11g Release 2 your voting disk data is automatically backed up in theOCR whenever there is a configuration change.
所以恢复时恢复备份OCR即可,这里和10g是不同的,不需要备份voting disk,备份OCR即可

2:使用ocrcheck检测OCR内容的完整性:

[grid@node2 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version                  :          3
Total space (kbytes)     :     262120
Used space (kbytes)      :       3156
Available space (kbytes) :     258964
ID                       : 2091470210
Device/File Name         :       +OCR
                                    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 bypassed due to non-privileged user

3:使用cluvfy 工具检查OCR完整性

[grid@node2 ~]$ cluvfy comp ocr -n all
Verifying OCR integrity 
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations
ASM Running check passed. ASM is running on all specified nodes
Checking OCR config file "/etc/oracle/ocr.loc"...
OCR config file "/etc/oracle/ocr.loc" check successful
Disk group for ocr location "+OCR" available on all the nodes
NOTE: 
This check does not verify the integrity of the OCR contents. Execute 'ocrcheck' as a privileged user to verify the contents of OCR.
OCR integrity check passed
Verification of OCR integrity was successful.

4:检测voting disk的信息

[grid@node2 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   731e191da4044f75bf0814b6eb2add41 (/dev/asm-diskf) [OCR]
Located 1 voting disk(s).

5:手动备份一份OCR信息:

[root@node1 bin]# ./ocrconfig -export /home/grid/ocr.dmp

6:查看OCR自动备份信息:

[root@node1 bin]# ./ocrconfig -showbackup

node2     2014/11/17 15:54:38     /u01/app/11.2.0./grid/cdata/scan/backup00.ocr

node2     2014/11/16 17:27:49     /u01/app/11.2.0./grid/cdata/scan/backup01.ocr

node1     2014/11/15 17:07:44     /u01/app/11.2.0./grid/cdata/scan/backup02.ocr

node1     2014/11/15 13:07:31     /u01/app/11.2.0./grid/cdata/scan/day.ocr

node1     2014/10/30 18:12:56     /u01/app/11.2.0./grid/cdata/scan/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available

7:保存一份ASM参数文件

[grid@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 18 16:52:39 2014
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 Real Application Clusters and Automatic Storage Management options
SQL> create pfile='/home/grid/pfile.ora' from spfile;
File created.

8:破坏保存OCR信息的磁盘组+CRS

[root@node1 bin]# dd if=/dev/zero of=/dev/asm-diskf bs=1024k count=2000
2000+0 records in
2000+0 records out
2097152000 bytes (2.1 GB) copied, 93.0326 seconds, 22.5 MB/s

9:破坏OCR磁盘组后,集群宕机

[root@node1 bin]# ./crsctl check cluster -all
**************************************************************
node1:
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4530: Communications failure contacting Cluster Synchronization Services daemon
CRS-4534: Cannot communicate with Event Manager
**************************************************************
node2:
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4530: Communications failure contacting Cluster Synchronization Services daemon
CRS-4534: Cannot communicate with Event Manager
**************************************************************

10.在各个节点强制关闭集群:

[root@node1 bin]# ./crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node1'
CRS-2673: Attempting to stop 'ora.crf' on 'node1'
CRS-2677: Stop of 'ora.mdnsd' on 'node1' succeeded
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.

11.以独占模式启动rac1:只启动ASM实例,不启动CRS

[root@node1 bin]# ./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-2672: Attempting to start 'ora.drivers.acfs' on 'node1'
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-2676: Start of 'ora.drivers.acfs' on 'node1' succeeded
CRS-2679: Attempting to clean 'ora.asm' on 'node1'
CRS-2681: Clean of 'ora.asm' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'node1'
CRS-2676: Start of 'ora.asm' on 'node1' succeeded

12:创建CRS磁盘组

[grid@node1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 18 17:23:48 2014

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 Real Application Clusters and Automatic Storage Management options

SQL> create diskgroup OCR external redundancy disk '/dev/asm-diskf' attribute 'compatible.asm'='11.2.0.4.0', 'compatible.rdbms'='11.2.0.4.0';
Diskgroup created.

13.通过导入或者restore还原OCR

[root@node1 bin]# ./ocrconfig -import /home/grid/ocr.dmp 

14.OCR恢复成功;

[root@node1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version                  :          3
Total space (kbytes)     :     262120
Used space (kbytes)      :       3188
Available space (kbytes) :     258932
ID                       : 1409503864
Device/File Name         :       +OCR
                                    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

15.恢复VOTEDISK

SQL> conn /as sysasm

Connected.
SQL> shutdown immediate;
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown

SQL> startup pfile='/home/grid/pfile.ora';
ASM instance started

Total System Global Area 1135747072 bytes
Fixed Size    2260728 bytes
Variable Size 1108320520 bytes
ASM Cache   25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL> show parameter spfile;


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile     string
SQL> create spfile from pfile='/home/grid/pfile.ora';

File created.

[root@node1 bin]# ./crsctl replace votedisk +OCR
Successful addition of voting disk 7d1dc64dda914f8abf57617a857032bb.
Successfully replaced voting disk group with +OCR.
CRS-4266: Voting file(s) successfully replaced

[root@node1 bin]# ./crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   7d1dc64dda914f8abf57617a857032bb (/dev/asm-diskf) [OCR]
Located 1 voting disk(s).

16.节点一退出独占模式:

[root@node1 bin]# ./crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'node1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'node1'
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node1'
CRS-2677: Stop of 'ora.mdnsd' on 'node1' succeeded
CRS-2677: Stop of 'ora.drivers.acfs' 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.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.

17.启动所有节点集群:

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

[root@node1 bin]# ./crsctl check cluster -all
**************************************************************
node1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
node2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

0 0
原创粉丝点击