ORACLE RAC重建OCR

from: http://blog.sina.com.cn/s/blog_5d3da3280100nhvq.html
OCR 对RAC 来说是非常重要的。 OCR记录节点成员的配置信息,如database、ASM、instance、listener、VIP等CRS资源的配置信息。在日常维护中需要对它进行备份。当然OCR 也会自动备份。 当OCR 出现问题时,有备份的话就使用备份来恢复。 当没有备份的话就只能重建了。
重建OCR操作如下:
1.停止所有节点的CRS
 [root@rac02 bin]# pwd
/u01/app/oracle/db_1/bin
[root@rac02 bin]# ./crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac01 ~]# cd /u01/app/oracle/db_1/bin
[root@rac01 bin]# ./crsctl stop crs
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2.备份每个节点的Clusterware Home
[oracle@rac01 ~]$ echo $CRS_HOME
/u01/app/oracle/crs
[root@rac01 oracle]# cp -R crs crs.bak
[root@rac01 oracle]# ls
admin  crs  crs.bak  db_1  oraInventory

[root@rac02 oracle]# ls
admin  crs  db_1  oraInventory
[root@rac02 oracle]# cp -R crs crs.bak
[root@rac02 oracle]# ls
admin  crs  crs.bak  db_1  oraInventory
3.在所有节点执行/install/rootdelete.sh 命令
 [root@rac01 install]# pwd
/u01/app/oracle/crs/install
[root@rac01 install]# ./rootdelete.sh
Shutting down Oracle Cluster Ready Services (CRS):
Stopping CSSD.
Unable to communicate with the CSS daemon.
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@rac02 install]# ./rootdelete.sh
4.在执行安装的节点执行/install/rootdeinstall.sh命令

因为我是在rac01节点上执行安装的,所以也在该节点执行该命令,只需要在该节点执行就可以了。

[root@rac01 install]# pwd
/u01/app/oracle/crs/install
[root@rac01 install]# ./rootdeinstall.sh

Removing contents from OCR device
2560+0 records in
2560+0 records out
10485760 bytes (10 MB) copied, 0.0216142 seconds, 485 MB/s

 5.检查CRS进程,如果没有返回值,继续下一步

[root@rac01 install]# ps -e | grep -i 'ocs[s]d'
13665 pts/2    00:00:00 ocssd.bin
[root@rac01 install]# ps -e | grep -i 'cr[s]d.bin'
[root@rac01 install]# ps -e | grep -i 'ev[m]d.bin'

 6.在安装节点(第4步中的节点)执行/root.sh命令

 [root@rac01 crs]# pwd
/u01/app/oracle/crs
[root@rac01 crs]# ./root.sh
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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 '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
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 30 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
CSS is inactive on these nodes.
        rac02
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.

7.在剩下的节点执行/root.sh命令

[root@rac02 ~]# /u01/app/oracle/crs/root.shWARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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 '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac01 rac01-priv rac01
node 2: rac02 rac02-priv rac02
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 30 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        rac01
        rac02
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

在 (0) 节点上创建 VIP 应用程序资源.
在 (0) 节点上创建 GSD 应用程序资源.
在 (0) 节点上创建 ONS 应用程序资源.
启动 (2) 节点上的 VIP 应用程序资源 ...
启动 (2) 节点上的 GSD 应用程序资源...
启动 (2) 节点上的 ONS 应用程序资源...


Done.

批注:如果出现若下错误
Running vipca(silent) for configuring nodeapps
Error 0(Native: listNetInterfaces:[3]
  [Error 0(Native: listNetInterfaces:[3])]
这里报错了。 root.sh 在最后一个节点执行时会调用vipca命令。这里因为网络接口没有配置好。所以执行失败了。我们配置一下接口,在Xmanager里,用root用户,手工运行vipca命令即可。
[root@rac01 bin]# ./oifcfg getif  -- 没有返回接口信息
[root@rac01 bin]# ./oifcfg iflist
[root@rac01 bin]# ./oifcfg setif -global eth0/192.168.10.0:public -- 注意IP 最后是0
[root@rac01 bin]# ./oifcfg setif -global eth1/10.0.0.0:cluster_interconnect   
--此处为cluster_interconnect,不是private
[root@rac01 bin]# ./oifcfg getif     --验证
eth0  192.168.10.0  global  public
eth1  10.0.0.0  global  cluster_interconnect
配置玩后,随便在一个节点用root用户运行一下vipca命令就可以了。 这个是有窗口的。 需要X 支持。所有用X manager。 其他工具也可以。 能运行就可以了。 执行完后nodeapps的VIP,ONS,GSD就创建完成了。
[root@rac01 bin]# ./crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac01
ora....01.lsnr application    ONLINE    ONLINE    rac01
ora.rac01.gsd  application    ONLINE    ONLINE    rac01
ora.rac01.ons  application    ONLINE    ONLINE    rac01
ora.rac01.vip  application    ONLINE    ONLINE    rac01
ora....SM2.asm application    ONLINE    ONLINE    rac02
ora....02.lsnr application    ONLINE    ONLINE    rac02
ora.rac02.gsd  application    ONLINE    ONLINE    rac02
ora.rac02.ons  application    ONLINE    ONLINE    rac02
ora.rac02.vip  application    ONLINE    ONLINE    rac02
[root@rac01 bin]# pwd
/u01/app/oracle/crs/bin

重建结束;


 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29634949/viewspace-1158549/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29634949/viewspace-1158549/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值