OCR几点考虑
1,备份OCR一致性的快照,然而导出不是
2,备份是在系统联机的时候创建的,如果使用ocrconfig-export导出命令,必须在所有节点关闭clusterware后才能获得一致性的快照
3,使用OCRDUMP工具可以检查备份的内容,但不能检查导出的内容
4,使用ocrconfig-showbackup命令列出备份,然而导出的OCR必须由用户来管理。
1,查看OCR,votedisk的存储位置和备份
[root@node1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE b095ef4f02a24fdbbf2e1b4ac2ef90f3 (/dev/asm-diskb) [ORCVOTE]
Located 1 voting disk(s).
查看当前日期
[root@node1 ~]# date
Wed Jul 2 07:55:22 CST 2014
2,在节点node1 手动备份一次ORC
[root@node1 ~]# ocrconfig -manualbackup
node1 2014/07/06 18:17:50 /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup_20140706_181750.ocr
[root@node1 ~]#
[root@node1 ~]# ocrconfig -showbackup
PROT-24: Auto backups for the Oracle Cluster Registry are not available
node1 2014/07/06 18:17:50 /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup_20140706_181750.ocr
[root@node1 ~]#
准备环节结束,下面开始破坏共享磁盘
3,在节点node1使用dd命令来人为破坏OCR
[root@node1 ~]# dd if=/dev/zero of=/dev/asm-diskb bs=1M
dd: writing `/dev/asm-diskb': No space left on device
5121+0 records in
5120+0 records out
5368709120 bytes (5.4 GB) copied, 11.3778 seconds, 472 MB/s
此时已经查询不到vodedisk的信息了
[root@node1 ~]# crsctl query css votedisk
Located 0 voting disk(s).
停止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.node2.vip' 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-2673: Attempting to stop 'ora.oc4j' on 'node1'
CRS-2673: Attempting to stop 'ora.cvu' on 'node1'
CRS-2677: Stop of 'ora.node2.vip' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.node2.vip' on 'node2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node1' succeeded
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-2676: Start of 'ora.node2.vip' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'node2'
CRS-2677: Stop of 'ora.DATA.dg' on 'node1' succeeded
CRS-2677: Stop of 'ora.ARCH.dg' on 'node1' succeeded
CRS-2676: Start of 'ora.LISTENER.lsnr' on 'node2' 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-2676: Start of 'ora.node1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.oc4j' on 'node2'
CRS-2677: Stop of 'ora.cvu' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.cvu' on 'node2'
CRS-2676: Start of 'ora.cvu' on 'node2' succeeded
CRS-2676: Start of 'ora.oc4j' 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.crf' 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.mdnsd' on 'node1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'node1' succeeded
CRS-2677: Stop of 'ora.crf' 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.
[root@node2 ~]# crsctl stop crs -f
以排他模式启动启动
[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-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
检查crsd是否在运行,如果运行,以root用户执行一下命令停止它:
如果Clusterware的版本是11.2.0.2或更高,执行crsctl start crs -excl -nocrs命令可以同时完成CRS独占模式启动和停止ora.crsd资源
# crsctl stop resource ora.crsd -init
重新创建磁盘组
OCR存储在ASM中,要保证所在磁盘组是mount状态才能对其操作resotre操作
[root@node1 ~]# su - grid
[grid@node1 ~]$ sqlplus / as sysasm
SQL> select state,name from v$asm_diskgroup;
STATE NAME
----------- ------------------------------
DISMOUNTED ARCH
DISMOUNTED DATA
删除OCR所在磁盘组ORCVOTE
SQL> drop diskgroup ORCVOTE force INCLUDING CONTENTS;
重建OCR所在磁盘组OCRVOTE,注意compatible.asm参数
SQL> create diskgroup ORCVOTE EXTERNAL REDUNDANCY disk '/dev/asm-diskb' attribute 'compatible.asm'='11.2.0.0.0';
Diskgroup created.
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
ARCH DISMOUNTED
DATA DISMOUNTED
ORCVOTE MOUNTED
SQL> exit
[grid@node1 ~]$ ocrconfig -showbackup
PROT-26: Oracle Cluster Registry backup locations were retrieved from a local copy
node1 2014/07/02 04:33:09 /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup00.ocr
node1 2014/06/11 16:06:28 /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup01.ocr
node1 2014/07/02 04:33:09 /g01/grid/app/11.2.0/grid/cdata/node-cluster/day.ocr
node1 2014/07/02 04:33:09 /g01/grid/app/11.2.0/grid/cdata/node-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
以root用户执行以下命令还原OCR:
如果OCR在ASM磁盘中配置,确保ASM磁盘组存在,且已被加载
ocrconfig -restore
[root@node1 ~]# cd /g01/grid/app/11.2.0/grid/cdata/node-cluster
[root@node1 node-cluster]# ll
total 35164
-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 7188480 Jul 2 04:33 day.ocr
-rw------- 1 root root 7188480 Jul 2 04:33 week.ocr
[grid@node1 node-cluster]$ su -
Password:
[root@node1 ~]# ocrconfig -restore /g01/grid/app/11.2.0/grid/cdata/node-cluster/backup_20140706_171301.ocr
[root@node1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2876
Available space (kbytes) : 259244
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
关闭CRS,再次以独占模式启动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.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.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.
[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
切换到GRID用户,登录
[root@node1 ~]# su - grid
[grid@node1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 6 18:00:29 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> 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.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
重新执行vodedisk恢复
[grid@node1 ~]$ su -
Password:
[root@node1 ~]# crsctl replace votedisk +ORCVOTE
Successful addition of voting disk b095ef4f02a24fdbbf2e1b4ac2ef90f3.
Successfully replaced voting disk group with +ORCVOTE.
CRS-4266: Voting file(s) successfully replaced
重启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.mdnsd' on 'node1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'node1'
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2677: Stop of 'ora.mdnsd' 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.ctssd' on 'node1' succeeded
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.
[root@node1 ~]#
[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.
[root@node1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARCH.dg
ONLINE ONLINE node1
ora.DATA.dg
ONLINE ONLINE node1
ora.LISTENER.lsnr
ONLINE ONLINE node1
ora.ORCVOTE.dg
ONLINE ONLINE node1
ora.asm
ONLINE ONLINE node1 Started
ora.gsd
OFFLINE OFFLINE node1
ora.net1.network
ONLINE ONLINE node1
ora.ons
ONLINE ONLINE node1
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE node1
ora.cvu
1 ONLINE ONLINE node1
ora.node1.vip
1 ONLINE ONLINE node1
ora.node2.vip
1 ONLINE INTERMEDIATE node1 FAILED OVER
ora.oc4j
1 ONLINE ONLINE node1
ora.prod.db
1 ONLINE ONLINE node1 Open
2 ONLINE OFFLINE
ora.scan1.vip
1 ONLINE ONLINE node1
当该节点启动结束后,开启另一个节点
[root@node2 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
[root@node1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARCH.dg
ONLINE ONLINE node1
ONLINE ONLINE node2
ora.DATA.dg
ONLINE ONLINE node1
ONLINE ONLINE node2
ora.LISTENER.lsnr
ONLINE ONLINE node1
ONLINE ONLINE node2
ora.ORCVOTE.dg
ONLINE ONLINE node1
ONLINE ONLINE node2
ora.asm
ONLINE ONLINE node1 Started
ONLINE ONLINE node2 Started
ora.gsd
OFFLINE OFFLINE node1
OFFLINE OFFLINE node2
ora.net1.network
ONLINE ONLINE node1
ONLINE ONLINE node2
ora.ons
ONLINE ONLINE node1
ONLINE ONLINE node2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE node2
ora.cvu
1 ONLINE ONLINE node2
ora.node1.vip
1 ONLINE ONLINE node1
ora.node2.vip
1 ONLINE ONLINE node2
ora.oc4j
1 ONLINE ONLINE node2
ora.prod.db
1 ONLINE ONLINE node1 Open
2 ONLINE ONLINE node2 Open
ora.scan1.vip
1 ONLINE ONLINE node2
[root@node1 ~]#
不知道为什么我的两个虚拟机的时钟居然相差4天!
date -s “2014-07-07 10:52:00”
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29047826/viewspace-1211994/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29047826/viewspace-1211994/