假设我们的RAC环境中OCR磁盘和votedisk磁盘全部被破坏,并且都没有备份,那么我们该如何恢复我们的RAC环境。
最近简单的办法就是重新初始化我们的ocr盘和votedisk盘,把集群中的所有相关资源重新注册到OCR磁盘和votedisk磁盘中。

1.停掉所有节点的Clusterware Stack

[root@rac3 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued. [root@rac4 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

2.为安全期间,我们先备份一下ocr和votedisk

为防止我们的实验失败,我们先备份一下ocr盘和votedisk盘。
当然,在正式的RAC环境中是不会不备份ocr盘和votedisk盘,我们模拟的也是一种极端情况。

[root@rac3 bin]# ./crsctl query css votedisk
. /dev/raw/raw2 located votedisk(s).
[root@rac3 bin]# dd if=/dev/raw/raw2 of=/home/oracle/votedisk.bak
+ records in
+ records out [root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded [root@rac3 bin]# ./ocrconfig -export /home/oracle/ocr.bak

3.我们先破坏一下ocr和votedisk

[root@rac3 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=
+ records in
+ records out
[root@rac3 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=
dd: writing `/dev/raw/raw1': No space left on device
+ records in
+ records out
[root@rac3 bin]# dd if=/dev/zero of=/dev/raw/raw2 bs=1M count=
dd: writing `/dev/raw/raw2': No space left on device
+ records in
+ records out

现在ocr和votedisk已经被我们破坏,目前我们的RAC肯定是启不来了。

现在我们就利用重建的方式重新把信息注册到ocr和votedisk中去。

4.分别在每个节点上执行$CRS_HOME/install/rootdele.sh

[root@rac3 install]# ./rootdelete.sh
Shutting down Oracle Cluster Ready Services (CRS):
OCR initialization failed with invalid format: PROC-: The OCR backend has an invalid format
Shutdown has begun. The daemons should exit soon.
Checking to see if Oracle CRS stack is down...
Oracle CRS stack is not running.
Oracle CRS stack is down now.
Removing script for Oracle Cluster Ready services
Updating ocr file for downgrade
Cleaning up SCR settings in '/etc/oracle/scls_scr'
[root@rac4 install]# ./rootdelete.sh
Shutting down Oracle Cluster Ready Services (CRS):
OCR initialization failed with invalid format: PROC-: The OCR backend has an invalid format
Shutdown has begun. The daemons should exit soon.
Checking to see if Oracle CRS stack is down...
Oracle CRS stack is not running.
Oracle CRS stack is down now.
Removing script for Oracle Cluster Ready services
Updating ocr file for downgrade
Cleaning up SCR settings in '/etc/oracle/scls_scr'

5.在任意一个节点上执行脚本$CRS_HOME/install/rootdeinstall.sh

只需要一个节点上执行即可

[root@rac3 install]# ./rootdeinstall.sh
Removing contents from OCR mirror device
+ records in
+ records out
Removing contents from OCR device
+ records in
+ records out

6.在和步骤5同一个节点上执行$CRS_HOME/root.sh脚本

[root@rac3 crs_1]# ./root.sh
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
WARNING: directory '/opt' is not owned by root
Checking to see if Oracle CRS stack is already configured Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
WARNING: directory '/opt' is not owned by root
Successfully accumulated necessary OCR keys.
Using ports: CSS= CRS= EVMC= and EVMR=.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node : rac3 rac3-priv rac3
node : rac4 rac4-priv rac4
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw2
Format of voting devices complete.
Startup will be queued to init within seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within seconds.
CSS is active on these nodes.
rac3
CSS is inactive on these nodes.
rac4
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.

7.在其他节点执行$CRS_HOME/root.sh脚本,注意最后一个节点的输出

[root@rac4 crs_1]# ./root.sh
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
WARNING: directory '/opt' is not owned by root
Checking to see if Oracle CRS stack is already configured Current Oracle Cluster Registry mirror location '/dev/raw/raw7' in '/etc/oracle/ocr.loc' and '' does not match
Update either '/etc/oracle/ocr.loc' to use '' or variable CRS_OCR_LOCATIONS in rootconfig.sh with '/dev/raw/raw7' then rerun rootconfig.sh

发现有报错,报错信息应该是ocr mirror location和当前不匹配,这是之前我们试验ocr转移位置时留下的(/dev/raw/raw7),
/etc/oracle/ocr.loc文件里我们已经ocrmirrorconfig_loc参数注释掉了,系统怎么还能看得到那??

http://www.cnblogs.com/myrunning/p/4253696.html

[root@rac4 oracle]# cat ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw1
#ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false

我们把/etc/oracle/ocr.loc文件的"#ocrmirrorconfig_loc=/dev/raw/raw7" 去掉,重新执行$CRS_HOME/root.sh

[root@rac4 oracle]# cat ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw1
local_only=false

去掉"#ocrmirrorconfig_loc=/dev/raw/raw7",重新执行$CRS_HOME/root.sh,发现问题解决:

[root@rac4 crs_1]# ./root.sh
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
WARNING: directory '/opt' is not owned by root
Checking to see if Oracle CRS stack is already configured Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
WARNING: directory '/opt' is not owned by root
clscfg: EXISTING configuration version detected.
clscfg: version is 10G Release .
Successfully accumulated necessary OCR keys.
Using ports: CSS= CRS= EVMC= and EVMR=.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node : rac3 rac3-priv rac3
node : rac4 rac4-priv rac4
clscfg: Arguments check out successfully. NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within seconds.
CSS is active on these nodes.
rac3
rac4
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
The given interface(s), "eth0" is not public. Public interfaces should be used to configure virtual IPs.

发现问题,由于"eth0" is not public.vipca没有执行成功,这需要我们手动地在这个节点上执行vipca

8.重新执行vipca命令

执行vipca报出Error 0(Native: listNetInterfaces:[3])错误,如图:

这是因为我们需要重新设置一下RAC的公共网络及私有网络:

使用root用户重新手动执行vipca:

9.验证ONS/GSD/VIP有没有正常注册到集群中

[oracle@rac4 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4

10.使用netca命令重新配置监听

使用netca命令配置监听,该命令会自动把Listener注册到Clusterware中。

使用oracle用户手动执行netca命令:

确认一下我们刚刚配置的Listener有没有注册到监听中:

[oracle@rac4 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4

可以看到至此,我们把listener、ons、gsd、vip都已经注册到ocr中了,下一步还需要把ASM、数据库注册到ocr中我们的实验就完成了。

11.把ASM注册到OCR中

[oracle@rac3 ~]$ srvctl add asm -n rac3 -i +ASM1 -o /opt/ora10g/product/10.2./db_1
[oracle@rac3 ~]$ srvctl add asm -n rac4 -i +ASM2 -o /opt/ora10g/product/10.2./db_1
[oracle@rac3 ~]$
[oracle@rac3 ~]$ srvctl config asm -n rac3
+ASM1 /opt/ora10g/product/10.2./db_1
[oracle@rac3 ~]$ srvctl config asm -n rac4
+ASM2 /opt/ora10g/product/10.2./db_1

12.启动ASM验证

[oracle@rac3 ~]$ srvctl start asm -n rac3
[oracle@rac3 ~]$ srvctl start asm -n rac4
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4

通过上面的输出可以看出ASM已经成功启动,启动的时候可以关注一下asm的启动日志,方便有错误的时候即使发现问题:

[oracle@rac3 bdump]$ pwd
/opt/ora10g/admin/+ASM/bdump
[oracle@rac3 bdump]$ tail -f alert_+ASM1.log

13.把数据库注册到OCR中

[oracle@rac3 ~]$ srvctl add database -d racdb -o $ORACLE_HOME
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application OFFLINE OFFLINE

14.把实例注册到OCR中

[oracle@rac3 ~]$ srvctl add instance -d racdb -n rac3 -i racdb1
[oracle@rac3 ~]$ srvctl add instance -d racdb -n rac4 -i racdb2
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE

15.修改实例和ASM实例的依赖关系

[oracle@rac3 ~]$ srvctl modify instance -d racdb -i racdb1 -s +ASM1
[oracle@rac3 ~]$ srvctl modify instance -d racdb -i racdb2 -s +ASM2
[oracle@rac3 ~]$

16.启动数据库进行验证

[oracle@rac3 ~]$ srvctl start database -d racdb
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac3
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4

现在可以看到我们注册到CRS中的数据已经正常启动了

[oracle@rac3 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1. - Production on Thu Jan  :: 

Copyright (c) , , Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1. - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options SQL> col name for a50
SQL> select * from v$dbfile; FILE# NAME
---------- --------------------------------------------------
+DATA/racdb/datafile/users.259.845203503
+DATA/racdb/datafile/sysaux.257.845203501
+DATA/racdb/datafile/undotbs1.258.845203501
+DATA/racdb/datafile/system.256.845203499
+DATA/racdb/datafile/undotbs2.264.845203661
+DATA/racdb/datafile/rlst.268.852657465 rows selected. SQL>

17.手动添加service到ocr中

[oracle@rac3 ~]$ srvctl add service -d racdb -s racdbservice -r racdb1 -a racdb2 -P BASIC
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac3
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4
ora....vice.cs application OFFLINE OFFLINE
ora....db1.srv application OFFLINE OFFLINE
[oracle@rac3 ~]$ srvctl start service -d racdb
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac3
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4
ora....vice.cs application ONLINE ONLINE rac3
ora....db1.srv application ONLINE ONLINE rac3

至此,我们已经正确的重新初始化了我们的OCR盘和VoteDisk盘,并且没有用到备份。

重新初始化RAC的OCR盘和Votedisk盘,修复RAC系统的更多相关文章

  1. 将U盘分成 启动盘+文件存储区

    我看了很多帖子,发现想要将U盘分区的朋友绝大部分是和我一样,想用U盘做成一个启动盘同时兼顾文件存储,分区的目的很简单,就是想将启动部分单独做成一个区,以免在日常的应用中使得启动文件染毒或者误操作造成损 ...

  2. U盘安装CentOS无法进入Centos系统解决办法

    转自:http://blog.sina.com.cn/s/blog_3feedf320101idlu.html     目前使用U盘安装系统逐渐因为它的便捷而受到人们的欢迎,但是使用U盘来安装Cent ...

  3. 【转】u盘不显示盘符

    转自http://jingyan.baidu.com/article/f3ad7d0fd0793e09c3345b31.html 我的情况: 电脑只有一个c盘,插入u盘,u盘的盘符为d. 弹出u盘,但 ...

  4. 关于无光盘无u盘状态下该如何安装系统

    看到好东西,跟大家分享一下,需要装系统的可以作为参考资料 无光盘无u盘状态下该如何安装系统 重点  : 安装虚拟光驱(用来打开镜像文件) 一个你要安装的系统文件的iso镜像文件 http://www. ...

  5. 1. 用U盘安装Centos6.5 + Win7 双系统

    一. 用U盘安装Centos6.5 + Win7 双系统 准备工作:U盘(8G).需要安装的Centos6.5系统(64bit).EasyBCD(用来修复引导,否则开机只有一个系统).         ...

  6. 《刺杀金正恩》1080p全高清无水印,附中文字幕 bt种子下载,附字母(百度网盘/360云盘)

    <刺杀金正恩>1080p全高清无水印,附中文字幕下载(百度网盘/360云盘) 种子和字幕下载地址: thunder://QUFlZDJrOi8vfGZpbGV8JUU5JTg3JTg3JU ...

  7. 使用MBROSTool 工具制作U盘多启动盘的方法总结

    前段时间写了一个自用五合一多启动盘分享--分别用来维护娱乐,wifi密码破解,win&mac登陆密码绕过/清除,反馈的同学还是挺多,觉得大家都有这方面的需求,于是再把自己的使用经验总结一下. ...

  8. #电脑磁盘分区#新买的电脑一般只有C盘或者C盘和D盘,怎么加多几个盘呢

    新买的电脑一般只有C盘或者C盘和D盘,怎么加多几个盘呢 鼠标右键点击桌面我的电脑选择管理 进入计算机管理.选择磁盘管理 若桌面没有我的电脑,可按win+x键,在快捷菜单栏中点击磁盘管理 通过以上两种w ...

  9. WD 蓝盘、绿盘、黑盘、红盘的区别

    绿盘,蓝盘.黑盘和红盘是西部数据根据旗下所产硬盘的特点所做的分类,通俗点讲:所谓的黑盘.蓝盘.绿盘.红盘就是指的西部数据硬盘上贴的那张纸,是黑色.蓝色.绿色.或红色. 黑盘:高性能,大缓存,速度快.代 ...

随机推荐

  1. 主流IM协议简介

    四种主流的IM协议, XMPP协议.即时信息和空间协议(IMPP).空间和即时信息协议(PRIM).针对即时通讯和空间平衡扩充的进程开始协议SIP(SIMPLE). XMPP协议: 在这四种协议中,X ...

  2. util包下的Date与sql包下的Date之间的转换

    Java中的时间类型 java.sql包下给出三个与数据库相关的日期时间类型,分别是: Date:表示日期,只有年月日,没有时分秒.会丢失时间: Time:表示时间,只有时分秒,没有年月日.会丢失日期 ...

  3. JavaScript设计模式——工厂模式

    工厂模式:是一种实现“工厂”概念的面上对象设计模式.实质是定义一个创建对象的接口,但是让实现这个接口的类来决定实例化哪个类.工厂方法让类的实例化推迟到子类中进行.创建一个对象常常需要复杂的过程,所以不 ...

  4. 去除android手机滚动条

    方法1:::-webkit-scrollbar{display: none;} 方法2:::-webkit-scrollbar{height:0; width:0:}

  5. Matlab 查看变量信息who whos命令

  6. vsftpd 创建虚拟用户

    1.添加一个宿主用户:useradd vsftpd -s /sbin/nologin2.安装db4-utils,通过本底数据文件实现虚拟用户访问yum install db4-utils3.创建ftp ...

  7. 实战Hadoop中遇到的几个类、接口说明

    1. Configuration :public 类型接口,这个接口包含的多数方法是进行与数据属性<key,value>有关的操作. 几个方法: 1)addProperty(String ...

  8. LA4671 K-neighbor substrings(FFT + 字符串Hash)

    题目 Source http://acm.hust.edu.cn/vjudge/problem/19225 Description The Hamming distance between two s ...

  9. Unity Standard Assets 简介之 2D

    这篇介绍2D资源包. 文件夹比较多,但是很多都是prefab的基础资源,所以我们只介绍 Prefabs 和 Scripts 文件夹. Prefabs文件夹: CharacterRobotBoy: 提供 ...

  10. BZOJ3072 : [Pa2012]Two Cakes

    考虑DP,设$f[i][j]$表示考虑了$a[1..i]$和$b[1..j]$的最小代价. 若$a[i]==b[j]$,则$f[i][j]=\min(f[i-1][j],f[i][j-1])+1$. ...