Oracle 10g RAC OCR、Voting disk更换

时间:2021-07-07 03:54:16

环境:OEL 5.7 + Oracle 10.2.0.5 RAC
需求:更换存储,OCR、Voting disk同时需要更换到新存储。

1.替换OCR

替换OCR(Oracle Cluster Registry)首先需要关闭RAC所有节点的crs,然后导出当前的ocr配置文件,手工修改ocr.loc文件后,导入ocr配置文件,可选择性创建ocrmirror。
本次实验演示就是将原来的/dev/raw/raw1替换为/dev/raw/raw14,并创建ocrmirror为/dev/raw/raw15.

--replace ocr
--两个节点关闭crs
/s01/oracle/product/10.2.0/crs_1/bin/crsctl stop crs
--ocrcheck
/s01/oracle/product/10.2.0/crs_1/bin/ocrcheck 
--导出ocr的配置
/s01/oracle/product/10.2.0/crs_1/bin/ocrconfig -export /tmp/ocrfile.dmp 
--查看文件大小
ls -lrt /tmp/ocrfile.dmp 
--两个节点修改ocr为新的/dev/raw/raw14
cat /etc/oracle/ocr.loc 
--导入ocr配置文件
/s01/oracle/product/10.2.0/crs_1/bin/ocrconfig -import /tmp/ocrfile.dmp 
/s01/oracle/product/10.2.0/crs_1/bin/ocrcheck 
--增加ocrmirror
/s01/oracle/product/10.2.0/crs_1/bin/ocrconfig -replace ocrmirror /dev/raw/raw15
/s01/oracle/product/10.2.0/crs_1/bin/ocrcheck
--最后查看ocr.loc文件
cat /etc/oracle/ocr.loc 

实际测试替换OCR的关键操作:

[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl stop crs
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/ocrconfig -export /tmp/ocrfile.dmp 
[root@rac1-server rules.d]# vi /etc/oracle/ocr.loc 
ocrconfig_loc=/dev/raw/raw14
local_only=FALSE
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/ocrconfig -replace ocrmirror /dev/raw/raw15
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :      96144
         Used space (kbytes)      :       4652
         Available space (kbytes) :      91492
         ID                       : 1953645605
         Device/File Name         : /dev/raw/raw14
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw15
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

[root@rac1-server ~]#  cat /etc/oracle/ocr.loc 
#Device/file  getting replaced by device /dev/raw/raw15 
ocrconfig_loc=/dev/raw/raw14
ocrmirrorconfig_loc=/dev/raw/raw15
local_only=false
[root@rac1-server ~]# 

2.替换voting disk

替换voting disk比较简单,只需要把新的voting disk加进来,然后把旧的删除即可。
本次实验演示就是新加/dev/raw/raw11,/dev/raw/raw12,/dev/raw/raw13,然后将原来的/dev/raw/raw2删除。

--replace voting disk
--which crsctl确认crsctl的全路径
/s01/oracle/product/10.2.0/crs_1/bin/crsctl
--查询当前的votedisk
crsctl query css votedisk
--添加新的votedisk
crsctl add css votedisk /dev/raw/raw11 -force
crsctl add css votedisk /dev/raw/raw12 -force
crsctl add css votedisk /dev/raw/raw13 -force
--删除旧的votedisk
crsctl delete css votedisk /dev/raw/raw2 -force

实际替换voting disk的关键操作:

[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl add css votedisk /dev/raw/raw11 
Cluster is not in a ready state for online disk addition
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl add css votedisk /dev/raw/raw11 -force
Now formatting voting disk: /dev/raw/raw11
successful addition of votedisk /dev/raw/raw11.
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl query css votedisk
 0.     0    /dev/raw/raw2
 1.     0    /dev/raw/raw11

located 2 votedisk(s).
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl add css votedisk /dev/raw/raw12 -force
Now formatting voting disk: /dev/raw/raw12
successful addition of votedisk /dev/raw/raw12.
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl add css votedisk /dev/raw/raw13 -force
Now formatting voting disk: /dev/raw/raw13
successful addition of votedisk /dev/raw/raw13.
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl query css votedisk
 0.     0    /dev/raw/raw2
 1.     0    /dev/raw/raw11
 2.     0    /dev/raw/raw12
 3.     0    /dev/raw/raw13

located 4 votedisk(s).
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl delete css votedisk /dev/raw/raw2
Cluster is not in a ready state for online disk removal
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl delete css votedisk /dev/raw/raw2 -force
successful deletion of votedisk /dev/raw/raw2.
[root@rac1-server rules.d]# /s01/oracle/product/10.2.0/crs_1/bin/crsctl query css votedisk
 0.     0    /dev/raw/raw11
 1.     0    /dev/raw/raw12
 2.     0    /dev/raw/raw13

located 3 votedisk(s).
[root@rac1-server rules.d]# 

附录:本次实验环境:
1.旧存储模拟:4块盘:其中第1块盘分成了2个区,绑定为raw设备raw1和raw2,分别给ocr和voting disk使用,剩余3块是给ASM使用的:
Oracle 10g RAC OCR、Voting disk更换
2.新存储模拟:10块盘:其中前三块(raw11,raw12,raw13)给voting disk使用,第4块和第5块(raw14和raw15)给ocr使用:
Oracle 10g RAC OCR、Voting disk更换
3.使用新存储3块10G的盘和2块5G的盘分别新增DATADG和FRA2个ASM磁盘组,其中DATADG是Normal冗余,FRA是External冗余:
Oracle 10g RAC OCR、Voting disk更换