如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!
诗檀软件专业数据库修复团队
服务热线 : 13764045638 QQ号:47079569 邮箱:service@parnassusdata.com
Oracle Database - Enterprise Edition –版本 11.2.0.1 以后 这个文章的内容适用于所有平台。
目的
说明RAC环境中储存OCR ASM Diskgroup全面损坏时的修复方法。
对策
[详细内容] 虽然会定期自动获得OCR的自动备份,但储存OCR的Diskgroup 有破损时,restore时,CRS stack会正常启动,因为需要运行ASM,使用OCR自动备份,修复OCR储存的disk group方法就会有点麻烦。
此后将说明储存OCR的ASM Diskgroup 全面损坏时的修复方法
前提 ---- 作为储存OCR 的区域,使用ASM时, ASM Diskgroup 全面损坏时,需要修复以下文件。
- Oracle Cluster Registry file (OCR) - 投票disk - ASM 实例的 SPFILE
以下例子中,使用一个disk CRS Diskgroup。因为CRS Diskgroup破损,假设无论哪个节点都无法使用CRS stack。 结构如下所示。
- GRID user: oragrid - GRID home: /u01/app/11.2.0/grid ($CRS_HOME) - ASM disk group name for OCR: CRS - ASM/ASMLIB disk name: ASMD40 - Linux device name for ASM disk: /dev/sdh1 - Cluster name: rac_cluster1 - Nodes: racnode1, racnode2
这次的操作顺序中,请不要变更储存OCR的 Diskgroup 的名字来操作。变更储存OCR的disk group的名字时,在执行以下操作之前,需要用所有节点变更/etc/oracle/ocr.loc 文件。
构成OCR 的 ASM Diskgroup 全面损坏时的修复方法 =====================================================
请按照以下操作顺序执行。
1. 查看最新自动制成的OCR备份
因为OCR的自动备份的输出节点不是固定的,通过比较各个节点的文件就可以查看最新的备份。
$ ls -lrt $CRS_HOME/cdata/rac_cluster1/ -rw------- 1 root root 7331840 Mar 10 18:52 week.ocr -rw------- 1 root root 7651328 Mar 26 01:33 week_.ocr -rw------- 1 root root 7651328 Mar 29 01:33 day.ocrMai -rw------- 1 root root 7651328 Mar 30 01:33 day_.ocr -rw------- 1 root root 7651328 Mar 30 01:33 backup02.ocr -rw------- 1 root root 7651328 Mar 30 05:33 backup01.ocr -rw------- 1 root root 7651328 Mar 30 09:33 backup00.ocr
2. 在所有节点中终止 Grid Infrastructure
在储存OCR的disk group破损时,也有GI stack虽然没有正常运行,但demon却正常运行的情况。因此,所有的节点中,使用force选项(-f),终止GI stack。
# $CRS_HOME/bin/crsctl stop crs -f
3. 以排他模式启动CRS stack
在1. 中查看到的保存了最新的 OCR的备份的节点中,以root用户登录,以排他模式启动CRS。这个模式无论投票disk是否存在或CRS demon (crsd.bin)进程是否启动,都可以直接启动ASM。
11.2.0.1:
# $CRS_HOME/bin/crsctl start crs -excl ... CRS-2672: Attempting to start 'ora.asm' on 'racnode1' CRS-2676: Start of 'ora.asm' on 'racnode1' succeeded CRS-2672: Attempting to start 'ora.crsd' on 'racnode1' CRS-2676: Start of 'ora.crsd' on 'racnode1' succeeded
(注释) 此次文件中,因为假设CRS disk group完全损毁了。如上所示,成功启动,输出信息时,会中止CRS demon (resource ora.crsd)。 如果不终止的话,就需要参考指导手册来人工终止。 # $CRS_HOME/bin/crsctl stop res ora.crsd -init
11.2.0.2 以后:
# $CRS_HOME/bin/crsctl start crs -excl -nocrs CRS-4123: Oracle High Availability Services has been started. ... CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'auw2k3' CRS-2672: Attempting to start 'ora.ctssd' on 'racnode1' CRS-2676: Start of 'ora.drivers.acfs' on 'racnode1' succeeded CRS-2676: Start of 'ora.ctssd' on 'racnode1' succeeded CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'racnode1' succeeded CRS-2672: Attempting to start 'ora.asm' on 'racnode1' CRS-2676: Start of 'ora.asm' on 'racnode1' succeeded
(重要) 11.2.0.2 开始为了防止启动ora.crsd 资源,就会导入'-nocrs' 选项。没有使用这个选项时,启动ora.crsd资源可能会失败。
4.使用 ASMLIB 时, 对CRS disk 评级
使用ASMLIB 时,CRS disk中,以root用户进行stamp。
# /usr/sbin/oracleasm createdisk ASMD40 /dev/sdh1 Writing disk header: done Instantiating disk: done
5. 使用sqlplus ,制成CRS Diskgroup
使用sqlplus ,以 grid用户制成 CRS Diskgroup 。CRS中,使用Diskgroup时,将compatible.asm 属性设置为11.2 以上。
$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 30 11:47:24 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Real Application Clusters and Automatic Storage Management options
SQL> create diskgroup CRS external redundancy disk 'ORCL:ASMD40' attribute 'COMPATIBLE.ASM' = '11.2';
Diskgroup created. SQL> exit
6. restore最新的OCR 备份
制成CRS Diskgroup ,并mount,OCR无法restore。 restore以root 用户在 1. 中查看到的 OCR备份。
# cd $CRS_HOME/cdata/rac_cluster1/ # $CRS_HOME/bin/ocrconfig -restore backup00.ocr
7.以现在的节点启动CRS demon
因为restore 了OCR ,可以启动CRS demon。11.2.0.1 中, 如果启动CRS demon需要重新制成投票disk。 ※使用 11.2.0.2 以后的版本时,请跳过此步骤。
# $CRS_HOME/bin/crsctl start res ora.crsd -init CRS-2672: Attempting to start 'ora.crsd' on 'racnode1' CRS-2676: Start of 'ora.crsd' on 'racnode1' succeeded
8. 重新制成投票disk
在CRS Diskgroup初始化投票disk。
# $CRS_HOME/bin/crsctl replace votedisk +CRS Successful addition of voting disk 00caa5b9c0f54f3abf5bd2a2609f09a9. Successfully replaced voting disk group with +CRS. CRS-4266: Voting file(s) successfully replaced
9. 重新制成ASM 的 SPFILE (选项)
(注释) 11gR2中,即使没有 PFILE以及 SPFILE也可以启动ASM 。 以下情况可以跳过这一步骤。 - ASM 中没有使用 SPFILE - ASM中没有使用共享 SPFILE - ASM 中使用了没有出场的共享SPFILE 。
准备ASM 的 pfile 。例子如下所示。 使用ASM 警报日志查看破损前的参数设定, 请参考在CRS Diskgroup 损坏之前的输出。
*.asm_power_limit=1 *.diagnostic_dest='/u01/app/oragrid' *.instance_type='asm' *.large_pool_size=12M *.remote_login_passwordfile='EXCLUSIVE'
制成 PFILE (下記例の '/tmp/asm_pfile.ora') ,以这里的内容为基础制成SPFILE。
$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 30 11:52:39 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Real Application Clusters and Automatic Storage Management options
SQL> create spfile='+CRS' from pfile='/tmp/asm_pfile.ora';
File created. SQL> exit
终止10. CRS
至此,disk上的修复就完成了。 因为是以排他模式启动CRS的,要正常启动的话,就需要暂时中止。 这时,就需要force (-f)选项。
# $CRS_HOME/bin/crsctl stop crs -f ... CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'auw2k3' has completed CRS-4133: Oracle High Availability Services has been stopped.
11. 重新扫描ASM disk
使用ASMLIB时,以root 用户重新扫描 ASM disk。 If using ASMLIB rescan all ASM disks on each node as the root user:
# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk "ASMD40"
12.启动 CRS
作为root 用户,以所有的cluster启动CRS。
# $CRS_HOME/bin/crsctl start crs CRS-4123: Oracle High Availability Services has been started.
13. 验证CRS
确认CRS正常运行。
# $CRS_HOME/bin/crsctl check cluster -all ************************************************************** racnode1: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online ************************************************************** racnode2: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online **************************************************************
# $CRS_HOME/bin/crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE node1 ora.DATA.dg ONLINE ONLINE node1 ora.LISTENER.lsnr ONLINE ONLINE node1 ora.asm ONLINE ONLINE node1 Started