今天小麦苗给大家分享的是替换OCR磁盘组的步骤。
【RAC】替换OCR磁盘组的步骤(视频 文档)
替换OCR磁盘组的步骤
核心的几条命令:
crsctl replace votedisk newocr ocrconfig -add newocr ocrconfig -delete ocr more /etc/oracle/ocr.loc spget spcopy -u CRSDG/xx/asmparameterfile/registry.xx newocr/spfileASM.ora spset
http://blog.itpub.net/26736162/viewspace-2141215/
2. OCR卷组调整步骤
2.1. 添加新存储
2.2. 多路径绑定配置
2.3. ASMLib配置
2.4. 备份OCR
2.5. 新建OCR卷组
2.6. 替换VOTE
2.7. 替换OCR
2.8. 迁移ASM SPFILE
2.9. 确认老OCR磁盘组是否还有其他文件
2.10. 删除老OCR卷组
2.11. 删除磁盘
1. 添加新存储
建立Normal冗余级别的OCR卷组,需要至少3个LUN,每个LUN最少容量为1GB,需要在存储端配置3个LUN至RAC集群中的各个节点。
2. 多路径绑定配置
配置/etc/multipatch.conf,添加新磁盘的UUID,假设多路径绑定之后的路径为/dev/mapper/newocr1、/dev/mapper/newocr2、/dev/mapper/newocr3,并且重新加载Mutilpathd服务生效。
3. ASMLib配置或udev绑定
节点1操作如下:
将新加的3个LUN添加到ASMLIB中
# /usr/sbin/oracleasm createdisk OCRNEW1 /dev/mapper/newocr1
# /usr/sbin/oracleasm createdisk OCRNEW2 /dev/mapper/newocr2
# /usr/sbin/oracleasm createdisk OCRNEW3 /dev/mapper/newocr3
节点2:
扫描新加的3个LUN:
# /usr/sbin/oracleasm scandisks
# /usr/sbin/oracleasm listdisks
4. 备份OCR
--逻辑备份恢复
ocrconfig -export /oracle/app/11.2.0/grid/cdata/ZFTPCCDB-crs/export_asm.bak
--物理备份恢复
ocrconfig -manualbackup
ocrconfig -showbackup
ocrcheck
5. 新建OCR卷组
set line 9999
set pagesize 9999
col path format a60
SELECT a.group_number, disk_number,mount_status, a.name, path FROM v$asm_disk a order by a.disk_number;
set line 999
select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number, disk_number,mount_status, path from v$asm_diskgroup a;
select a.group_number,name,TYPE,state,TOTAL_MB,free_mb from v$asm_diskgroup a;
select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number from v$asm_diskgroup a;
节点1新建Normal冗余级别的ASM卷组
sqlplus / as sysasm
create diskgroup newocr normal redundancy disk
'/dev/oracleasm/disks/neworc1',
'/dev/oracleasm/disks/neworc2',
'/dev/oracleasm/disks/neworc3'
attribute 'compatible.asm'='11.2','compatible.rdbms'='11.2';
节点1执行mount磁盘组:
ALTER DISKGROUP NEWOCR MOUNT;
crsctl stat res -t
1.6. 替换VOTE
在其中一个节点,root用户下执行:
替换VOTE
crsctl replace votedisk newocr
确认
crsctl query css votedisk
[root@node1 ~]# crsctl replace votedisk OCR
Successful addition of voting disk 83fc22d0d6164fd2bfc2c48c9edcd64d.
Successful deletion of voting disk afbe52656e124f8ebff3f7236ed85e32.
Successfully replaced voting disk group with OCR.
CRS-4266: Voting file(s) successfully replaced
[root@node1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 83fc22d0d6164fd2bfc2c48c9edcd64d (ORCL:OVDISK) [OCR]
Located 1 voting disk(s).
[root@node1 ~]#
7. 替换OCR
在grid或root用户下执行:
Node1:
ocrconfig -add newocr
ocrconfig -delete ocr
more /etc/oracle/ocr.loc
[root@node1 ~]# ocrconfig -add OCR
[root@node1 ~]# more /etc/oracle/ocr.loc
#Device/file getting replaced by device OCR
ocrconfig_loc= TEST
ocrmirrorconfig_loc= OCR
local_only=false
[root@node1 ~]# ocrconfig -delete TEST
[root@node1 ~]# more /etc/oracle/ocr.loc
#Device/file TEST getting replaced by device OCR
ocrconfig_loc= OCR
local_only=false
[root@node1 ~]#
Node2不用执行以下命令:
ocrconfig -repair -add newocr
ocrconfig -repair -delete ocr
[root@node2 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE afbe52656e124f8ebff3f7236ed85e32 (/dev/asm-diskb) [TEST]
Located 1 voting disk(s).
[root@node2 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 83fc22d0d6164fd2bfc2c48c9edcd64d (ORCL:OVDISK) [OCR]
Located 1 voting disk(s).
[root@node2 ~]# more /etc/oracle/ocr.loc
#Device/file OVDISK getting replaced by device TEST
ocrconfig_loc= TEST
local_only=false
[root@node2 ~]# more /etc/oracle/ocr.loc
#Device/file getting replaced by device OCR
ocrconfig_loc= TEST
ocrmirrorconfig_loc= OCR
local_only=false
[root@node2 ~]# more /etc/oracle/ocr.loc
#Device/file TEST getting replaced by device OCR
ocrconfig_loc= OCR
local_only=false
[root@node2 ~]#
8. 迁移ASM SPFILE
在GRID用户下任一节点执行
$ asmcmd
查看当前的ASMSPFILE
ASMCMD> spget
复制SPFILE至新卷组
ASMCMD> spcopy -u CRSDG/xx/asmparameterfile/registry.xx newocr/spfileASM.ora
查看新SPFILE绝对路径
ASMCMD> ls -l newocr/spfileASM.ora
NEWOCR/XX/ASMPARAMETERFILE/REGISTRY.253.833623103
ASMCMD>spset NEWOCR/XX/ASMPARAMETERFILE/REGISTRY.253.833623103
修改两个节点grid用户下$ORACLE_HOME/dbs/init.ora文件内容,可以不用修改:
SPFILE=' newocr/spfileASM.ora'
[grid@node1 ~]$ asmcmd
ASMCMD> spget
TEST/node-cluster/ASMPARAMETERFILE/REGISTRY.253.936725677
ASMCMD> spcopy -u TEST/node-cluster/ASMPARAMETERFILE/REGISTRY.253.936725677 OCR/spfileASM.ora
ASMCMD> ls -l ocr/spfileASM.ora
Type Redund Striped Time Sys Name
N spfileASM.ora => OCR/node-cluster/ASMPARAMETERFILE/REGISTRY.253.936729105
ASMCMD> spset OCR/node-cluster/ASMPARAMETERFILE/REGISTRY.253.936729105
ASMCMD> spget
OCR/node-cluster/ASMPARAMETERFILE/REGISTRY.253.936729105
9. 确认老OCR磁盘组是否还有其他文件
10. 删除老OCR卷组
重启集群后:
节点2:
su - grid
sqlplus / as sysasm
alter diskgroup OCR dismount;
exit
节点1:
su - grid
sqlplus / as sysasm
drop diskgroup ocr;
drop diskgroup OVDISK INCLUDING CONTENTS;
drop diskgroup OVDISK FORCE INCLUDING CONTENTS;
11. 删除磁盘
任一节点ROOT用户下操作:
# /usr/sbin/oracleasm dropdisk OCR
删除多路径绑定配置,删除配置/etc/multipatch.conf中原有OCR盘内容。
最后从存储上删除到2个节点的映射。
12.删除crs记录
crsctl delete res ora.OCR.dg
注意:本文内容太多,公众号有字数限制,全文可点击文末的阅读原文,谢谢大家的理解。