voting disk和ocr损坏重建过程

Oracle · newbie_l · 于 1年前发布 · 588 次阅读

云吞信息--风轻云淡

OCR和Voting disk对RAC来说是非常重要的。OCR记录节点成员的配置信息,如database、ASM、instance、listener、VIP等 CRS资源的配置信息。Voting disk记录节点成员信息,如包含哪些节点成员、节点的添加删除信息记录。在日常维护中需要对他们进行备份。当然OCR也会自动备份。 当OCR或者Voting disk出现问题时,有备份的话就使用备份来恢复。 当没有备份的话就只能重建了。

测试环境:oracle 10g rac

先对Voting disk 和OCR做一个备份

[root@rac1 bin]# ./crs_stat -t 
Name                 Type    Target    State Host
 ------------------------------------------------------------ 
ora.orcl.db      application  ONLINE ONLINE rac2 
ora....oltp.cs   application  ONLINE ONLINE rac2 
ora....cl1.srv   application  ONLINE ONLINE rac1 
ora....cl2.srv   application  ONLINE ONLINE rac2 
ora....l1.inst   application  ONLINE ONLINE rac1 
ora....l2.inst   application  ONLINE ONLINE rac2 
ora....SM1.asm   application  ONLINE ONLINE rac1 
ora....C1.lsnr  application   ONLINE ONLINE rac1 
ora.rac1.gsd    application   ONLINE ONLINE rac1 
ora.rac1.ons    application   ONLINE ONLINE rac1 
ora.rac1.vip    application   ONLINE ONLINE rac1 
ora....SM2.asm  application   ONLINE ONLINE rac2 
ora....C2.lsnr  application   ONLINE ONLINE rac2 
ora.rac2.gsd    application   ONLINE ONLINE rac2 
ora.rac2.ons    application   ONLINE ONLINE rac2 
ora.rac2.vip    application   ONLINE ONLINE rac2
[root@rac1 bin]# ./crsctl query css votedisk 
0. 0 /dev/raw/raw3 
1. 0 /dev/raw/raw4 
2. 0 /dev/raw/raw5 
located 3 votedisk(s) 
[root@rac1 bin]# dd if=/dev/raw/raw3 of=/u01/votingdisk.bak --该步骤备份voting 
401562+0 records in
401562+0 records out 
205599744 bytes (206 MB) copied, 1685.53 seconds, 122 kB/s 
[root@rac1 u01]# cd /u01/app/oracle/product/crs/bin/ 
[root@rac1 bin]# ./ocrconfig -export /u01/ocr.bak --该步骤备份ocr 
[root@rac1 bin]# ll /u01
total 202132 
drwxrwxrwx 3 oracle oinstall 4096 Nov 30 17:08 app 
-rw-r--r-- 1 root root 103141 Dec 2 08:38 ocr.bak 
-rw-r--r-- 1 root root 205599744 Dec 2 08:45 votingdisk.bak

停止所有节点CRS

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

在所有节点执行/install/rootdelete.sh 命令

[root@rac1 install]# ./rootdelete.sh 
Shutting down Oracle Cluster Ready Services (CRS): 
Stopping resources.
Error while stopping resources. Possible cause: CRSD is down. 
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'

在执行安装的节点执行/install/rootdeinstall.sh命令(节点一)

[root@rac1install]# sh/u01/app/oracle/product/crs/install/rootdeinstall.sh 
Removing contents from OCR mirror device 
2560+0 records in
2560+0 records out 
10485760 bytes (10 MB) copied, 108.972 seconds, 96.2 kB/s 
Removing contents from OCR device 
2560+0 records in 
2560+0 records out 10485760 bytes (10 MB) copied, 89.2502 seconds, 117 kB/s

确认后台没有CRS进程

[root@rac1 install]# ps -e | grep -i 'ocs[s]d' 
[root@rac1 install]# ps -e | grep -i 'cr[s]d.bin' 
[root@rac1 install]# ps -e | grep -i 'ev[m]d.bin'

在安装节点执行/root.sh命令

[root@rac1 crs]# /u01/app/oracle/product/crs/root.sh --注意,是root用户。 
WARNING: directory '/u01/app/oracle/product' is not owned by root 
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/product' is not owned by root 
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 
assigning default hostname rac1 for node 1. 
assigning default hostname rac2 for node 2. 
Successfully accumulated necessary OCR keys. 
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897. 
node <nodenumber>: <nodename> <private interconnect name> <hostname> 
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2 
Creating OCR keys for user 'root', privgrp 'root'.. 
Operation successful. 
Now formatting voting device: /dev/raw/raw3 
Now formatting voting device: /dev/raw/raw4 
Now formatting voting device: /dev/raw/raw5 
Format of 3 voting devices complete. 
Startup will be queued to init within 90 seconds. 
Adding daemons to inittab 
Expecting the CRS daemons to be up within 600 seconds. 
CSS is active on these nodes. 
rac1 
CSS is inactive on these nodes. 
rac2
Local node checking complete. 
Run root.sh on remaining nodes to start CRS daemons.

在节点二执行/root.sh命令

[root@rac2 crs]# /u01/app/oracle/product/crs/root.sh 
WARNING: directory '/u01/app/oracle/product' is not owned by root 
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/product' is not owned by root 
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. 
assigning default hostname rac1 for node 1. 
assigning default hostname rac2 for node 2. 
Successfully accumulated necessary OCR keys. 
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897. 
node <nodenumber>: <nodename> <private interconnect name> <hostname> 
node 1: rac1 rac1-priv rac1 
node 2: rac2 rac2-priv rac2 
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 90 seconds. 
Adding daemons to inittab 
Expecting the CRS daemons to be up within 600 seconds. 
CSS is active on these nodes. 
rac1
rac2
CSS is active on all nodes. 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Waiting for the Oracle CRSD and EVMD to start 
Oracle CRS stack installed and running under init(1M) 
Running vipca(silent) for configuring nodeapps 
Error 0(Native: listNetInterfaces:[3]) 
[Error 0(Native: listNetInterfaces:[3])]
对于上面的报错执行以下命令 
[root@rac1 bin]# ./oifcfg getif -- 没有返回接口信息 
[root@rac1 bin]# ./oifcfg iflist 
eth1 192.168.111.0 
eth0 192.168.29.0 
[root@rac1 bin]# ./oifcfg setif -global eth0/192.168.111.0:public 
[root@rac1 bin]# ./oifcfg setif -global eth1/192.168.29.0:cluster_interconnect 
[root@rac1 bin]# ./oifcfg getif 
eth0 192.168.111.0 global public 
eth1 192.168.29.0 global cluster_interconnect 
[root@rac1 bin]#./vipca

配置监听

$netca 注意:可能会提示监听已存在,可以先把$ORACLE_HOME/network/admin下的listener.ora文件重命名。

配置ONS

10g 下使用: 
<CRS_HOME>/install/racgons add_config hostname1:port hostname2:port 
[oracle@rac1 bin]$ pwd
 /u01/app/oracle/product/crs/bin 
[oracle@rac1 bin]$ racgons add_config rac1:6251 rac2:6251 
11g 使用: 
<CRS_HOME>/install/onsconfig add_config hostname1:port hostname2:port 
[oracle@rac1 bin]$ onsconfig add_config rac1:6251 rac2:6251 
验证配置: 
[oracle@rac1 bin]$ onsctl start 
[oracle@rac1 bin]$ onsctl ping 
Number of onsconfiguration retrieved, numcfg = 2 
onscfg[0]
{node = rac1, port = 6251} 
Adding remote host rac1:6251 
onscfg[1] 
{node = rac2, port = 6251} 
Adding remote host rac2:6251 
ons is running ...

添加asm、instance、database资源到ocr中

ASM 
语法:srvctl add asm -n <node_name> -i <asm_instance_name> -o <oracle_home> 
[oracle@rac1 bin]$ echo $ORACLE_HOME /u01/app/oracle/product/10.2.0/db_1 
[oracle@rac1 bin]$ srvctl add asm -n rac1 -i +ASM1 -o $ORACLE_HOME 
[oracle@rac1 bin]$ srvctl add asm -n rac2 -i +ASM2 -o /u01/app/oracle/product/10.2.0/db_1
DATABASE 
语法:srvctl add database -d <db_unique_name> -o <oracle_home>
[oracle@rac1 bin]$ srvctl add database -d orcl -o /u01/app/oracle/product/10.2.0/db_1
INSTANCE 
语法:srvctl add instance -d <db_unique_name> -i <instance_name> -n <node_name> [oracle@rac1 bin]$ srvctl add instance -d orcl -i orcl1 -n rac1 
[oracle@rac1 bin]$ srvctl add instance -d orcl -i orcl2 -n rac2

启动资源及检查

[oracle@rac1 bin]$ crs_start -all 
[root@rac1 bin]# ./crs_stat -t 
Name Type Target State Host
 ----------------------------------------
ora.orcl.db application ONLINE ONLINE rac1 
ora....oltp.cs  application ONLINE ONLINE rac2 
ora....cl1.srv  application ONLINE ONLINE rac1 
ora....cl2.srv application ONLINE ONLINE rac2 
ora....l1.inst application ONLINE ONLINE rac1 
ora....l2.inst application ONLINE ONLINE rac2 
ora....SM1.asm application ONLINE ONLINE rac1 
ora....C1.lsnr application ONLINE ONLINE rac1 
ora.rac1.gsd   application ONLINE ONLINE rac1 
ora.rac1.ons   application ONLINE ONLINE rac1 
ora.rac1.vip   application ONLINE ONLINE rac1 
ora....SM2.asm application ONLINE ONLINE rac2 
ora....C2.lsnr application ONLINE ONLINE rac2 
ora.rac2.gsd   application ONLINE ONLINE rac2 
ora.rac2.ons   application ONLINE ONLINE rac2
ora.rac2.vip   application ONLINE ONLINE rac2
```
重建完成。


共收到 0 条回复
没有找到数据。
回复本帖 (需要登录)