11gR2 ocr votedisk的恢复测试

来源:互联网 发布:帝国cms 栏目别名 编辑:程序博客网 时间:2024/05/22 05:16

先做一些检查:



1.检查ocr的完整性

root@oeltan1 ~]# su - grid
[grid@oeltan1 ~]$ 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 configurationsASM Running check passed. ASM is running on all specified nodesChecking OCR config file "/etc/oracle/ocr.loc"...OCR config file "/etc/oracle/ocr.loc" check successfulDisk group for ocr location "+CRS" available on all the nodesDisk group for ocr location "+DATA1" available on all the nodesNOTE: 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 passedVerification of OCR integrity was successful. 


[grid@oeltan1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :         Version                  :          3         Total space (kbytes)     :     262120         Used space (kbytes)      :       3320         Available space (kbytes) :     258800         ID                       : 1360300110         Device/File Name         :       +CRS                                    Device/File integrity check succeeded         Device/File Name         :     +DATA1                                    Device/File integrity check succeeded                                    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


2.检查votedisk



[grid@oeltan1 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   2141c8c7d8904f89bfa45dbaecb827c5 (/dev/asm-diskb) [CRS]

Located 1 voting disk(s).

3看看磁盘使用的情况 

  1* select name,header_status,path from V$asm_disk
SQL> /


NAME                           HEADER_STATU PATH
------------------------------ ------------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CRS_0000                       MEMBER       /dev/asm-diskb
DATA1_0002                     MEMBER       /dev/asm-diskg
DATA1_0001                     MEMBER       /dev/asm-diskf
DATA1_0000                     MEMBER       /dev/asm-diske
CRS_0002                       MEMBER       /dev/asm-diskd
CRS_0001                       MEMBER       /dev/asm-diskc
FRI_0000                       MEMBER       /dev/asm-diskh
FRI_0001                       MEMBER       /dev/asm-diski
FRI_0002                       MEMBER       /dev/asm-diskj


做备份 


11g中votedisk不需要备份

1备份ASMspfile                                        

SQL> create pfile='/tmp/asm_pfile_0724.txt' from spfile    

2备份ocr

[root@oeltan1 ~]# ocrconfig -manualbackup

3检查备份:

[root@oeltan1 ~]# ocrconfig -showbackup
oeltan1     2013/07/24 11:18:08     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup00.ocroeltan1     2013/07/24 07:18:02     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup01.ocroeltan1     2013/07/24 03:17:54     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup02.ocroeltan1     2013/07/23 07:17:31     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/day.ocroeltan1     2013/07/12 07:14:46     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/week.ocroeltan1     2013/07/23 11:17:30     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130723_111730.ocroeltan1     2013/07/23 11:15:00     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130723_111500.ocroeltan1     2013/07/18 10:36:48     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130718_103648.ocroeltan1     2013/07/18 10:36:30     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130718_103630.ocroeltan2     2013/06/17 09:04:34     /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130617_090434.ocr


破坏掉3块CRS盘


开始搞破坏喽。。。


[root@oeltan2 ~]# dd if=/dev/zero of=/dev/asm-dskb bs=1024 count=1000
[root@oeltan2 ~]# dd if=/dev/zero of=/dev/asm-dskc bs=1024 count=1000
[root@oeltan2 ~]# dd if=/dev/zero of=/dev/asm-dskd bs=1024 count=1000

检查一下:
[root@oeltan1 ~]# ocrcheck
PROT-601: Failed to initialize ocrcheck
PROC-22: The OCR backend has an invalid format

开始还原:


1.强制停止CRS

[root@oeltan1 ~]# crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oeltan1'
CRS-4133: Oracle High Availability Services has been stopped.
上面这个时间有点长,10多分钟

节点2也要停

2.以独占模式启动:

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



3.创创建CRS磁盘组

[grid@oeltan1 ~]$ asmcmd
ASMCMD> ls
ASMCMD> 
[grid@oeltan1 ~]$ sqlplus / as sysasm


SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 26 09:33:13 2013


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> show parameter spfile


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string


SQL> create diskgroup crsvote normal redundancy disk '/dev/asm-diskb','/dev/asm-diskc','/dev/asm-diskd'
  2  attribute 'compatible.asm'='11.2.0.0.0','compatible.rdbms'='11.2.0.0.0';



Diskgroup created.

4.还愿spfile

SQL> create spfile='+CRSVOTE' from pfile='/tmp/asm_pfile_0724.txt';


File created.


ASMCMD> pwd  
+CRSVOTE/oeltan-cluster/ASMPARAMETERFILE
ASMCMD> ls
REGISTRY.253.821785057


5. 修改ocr.loc,节点2也要改。

[root@oeltan1 ~]# vi /etc/oracle/ocr.loc


#Device/file +DATA1 being deleted
ocrconfig_loc=+CRSVOTE
local_only=false


6.导入OCR

# ocrconfig -restore /apps/grid/gridhome/11.2.0/grid/cdata/oeltan-cluster/backup_20130723_111730.ocr


ASMCMD> pwd
+CRSVOTE/oeltan-cluster
ASMCMD> ls
ASMPARAMETERFILE/
OCRFILE/


检查OCR
[root@oeltan1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :         Version                  :          3         Total space (kbytes)     :     262120         Used space (kbytes)      :       3320         Available space (kbytes) :     258800         ID                       : 1360300110         Device/File Name         :   +CRSVOTE                                    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




7.修复VOTE  DISK

[root@oeltan1 ~]# crsctl query css votedisk
Located 0 voting disk(s).
[root@oeltan1 ~]# 
[root@oeltan1 ~]# crsctl replace votedisk +CRSVOTE
CRS-4602: Failed 27 to add voting file 66d2624128ee4fd2bf882a8a3d295a99.
CRS-4602: Failed 27 to add voting file 1d4cf4ec74794f05bfc8f3f452cddfaf.
CRS-4602: Failed 27 to add voting file 731c37abf7fa4fc0bf6219155cf0e7e0.
Failed to replace voting disk group with +CRSVOTE.
CRS-4000: Command Replace failed, or completed with errors.
[root@oeltan1 ~]# crsctl query css votedisk
Located 0 voting disk(s).
出现上面的错误,是因为asm_diskstring配置不正确:
检查一下:
SQL> show parameter asm


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      CRSVOTE
asm_diskstring                       string
asm_power_limit                      integer     1
asm_preferred_read_failure_groups    string
修改
SQL> alter system set asm_diskstring='/dev/asm*' scope=both;
需要重启ASM
上述问题更详细的解决过程:http://blog.csdn.net/tanqingru/article/details/9493703

再次还愿votedisk


[root@oeltan1 ~]# crsctl replace votedisk +CRSVOTE
Successful addition of voting disk 54e90342890c4f58bf319f3c57c4acd7.
Successful addition of voting disk 5103d7e756f14f69bf3935ace34e5de7.
Successful addition of voting disk 370645ed11324fe5bf99eac9bf5efb21.
Successfully replaced voting disk group with +CRSVOTE.
CRS-4266: Voting file(s) successfully replaced
[root@oeltan1 ~]# crsctl  query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   54e90342890c4f58bf319f3c57c4acd7 (/dev/asm-diskb) [CRSVOTE]
 2. ONLINE   5103d7e756f14f69bf3935ace34e5de7 (/dev/asm-diskc) [CRSVOTE]
 3. ONLINE   370645ed11324fe5bf99eac9bf5efb21 (/dev/asm-diskd) [CRSVOTE]
Located 3 voting disk(s).

重启CRS

1.检查一下crs


[root@oeltan1 ~]# 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-4534: Cannot communicate with Event Manager


2.正常重启一次

crsctl stop crs
crsctl start crs

节点2也启动:
[root@oeltan2 tmp]# crsctl start crs

3.检查一下crs


[root@oeltan1 ~]# 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

恢复后检查

1最后进行检查:

[root@oeltan1 tmp]# crs_stat -t
Name           Type           Target    State     Host        ------------------------------------------------------------ora.CRS.dg     ora....up.type ONLINE    OFFLINE               ora.DATA1.dg   ora....up.type ONLINE    ONLINE    oeltan1     ora.FRI.dg     ora....up.type ONLINE    ONLINE    oeltan1     ora....ER.lsnr ora....er.type ONLINE    ONLINE    oeltan2     ora....N1.lsnr ora....er.type ONLINE    ONLINE    oeltan2     ora.asm        ora.asm.type   ONLINE    ONLINE    oeltan1     ora.cvu        ora.cvu.type   ONLINE    ONLINE    oeltan1     ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               ora....network ora....rk.type ONLINE    ONLINE    oeltan1     ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    oeltan1     ora....SM1.asm application    ONLINE    ONLINE    oeltan1     ora....N1.lsnr application    ONLINE    OFFLINE               ora....an1.gsd application    OFFLINE   OFFLINE               ora....an1.ons application    ONLINE    ONLINE    oeltan1     ora....an1.vip ora....t1.type ONLINE    ONLINE    oeltan2     ora....SM2.asm application    ONLINE    ONLINE    oeltan2     ora....N2.lsnr application    ONLINE    ONLINE    oeltan2     ora....an2.gsd application    OFFLINE   OFFLINE               ora....an2.ons application    ONLINE    ONLINE    oeltan2     ora....an2.vip ora....t1.type ONLINE    ONLINE    oeltan2     ora.ons        ora.ons.type   ONLINE    ONLINE    oeltan1     ora.scan1.vip  ora....ip.type ONLINE    ONLINE    oeltan2     ora.scan2.vip  ora....ip.type ONLINE    ONLINE    oeltan2     ora.scan3.vip  ora....ip.type ONLINE    ONLINE    oeltan2     ora.tantest.db ora....se.type ONLINE    ONLINE    oeltan1     ora....tag.svc ora....ce.type ONLINE    ONLINE    oeltan2     


[root@oeltan1 tmp]# crsctl stat res -t
--------------------------------------------------------------------------------NAME           TARGET  STATE        SERVER                   STATE_DETAILS       --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.CRS.dg               ONLINE  OFFLINE      oeltan1                                                     OFFLINE OFFLINE      oeltan2                                      ora.DATA1.dg               ONLINE  ONLINE       oeltan1                                                     ONLINE  ONLINE       oeltan2                                      ora.FRI.dg               ONLINE  ONLINE       oeltan1                                                     ONLINE  ONLINE       oeltan2                                      ora.LISTENER.lsnr               ONLINE  OFFLINE      oeltan1                                                     ONLINE  ONLINE       oeltan2                                      ora.asm               ONLINE  ONLINE       oeltan1                  Started                            ONLINE  ONLINE       oeltan2                  Started             ora.gsd               OFFLINE OFFLINE      oeltan1                                                     OFFLINE OFFLINE      oeltan2                                      ora.net1.network               ONLINE  ONLINE       oeltan1                                                     ONLINE  ONLINE       oeltan2                                      ora.ons               ONLINE  ONLINE       oeltan1                                                     ONLINE  ONLINE       oeltan2                                      --------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.LISTENER_SCAN1.lsnr      1        ONLINE  ONLINE       oeltan2                                      ora.cvu      1        ONLINE  ONLINE       oeltan1                                      ora.oc4j      1        ONLINE  ONLINE       oeltan1                                      ora.oeltan1.vip      1        ONLINE  INTERMEDIATE oeltan2                  FAILED OVER         ora.oeltan2.vip      1        ONLINE  ONLINE       oeltan2                                      ora.scan1.vip      1        ONLINE  ONLINE       oeltan2                                      ora.scan2.vip      1        ONLINE  ONLINE       oeltan2                                      ora.scan3.vip      1        ONLINE  ONLINE       oeltan2                                      ora.tantest.db      1        ONLINE  ONLINE       oeltan1                  Open                      2        ONLINE  ONLINE       oeltan2                  Open                ora.tantest.tantag.svc      1        ONLINE  OFFLINE                                                         2        ONLINE  ONLINE       oeltan2                                      



ASMCMD> ls
CRSVOTE/
DATA1/
FRI/