一、环境
操作系统:Centos57.6
数据库版本:12.2.0.1
场景:将OCR信息从+DATA磁盘组迁移到+OCR磁盘组
二、操作步骤
1.查看可用空盘
set lin 200
set pagesize 200
col DGNAME format a15
col DISKNAME format a15
col PATH format a20
col NAME format a20
select NAME,MOUNT_STATUS,STATE,DISK_NUMBER "DNO",PATH,TOTAL_MB,FREE_MB,GROUP_NUMBER "GNO" from /* 如果name为空,那么是没有加入磁盘组 */v$ASM_DISK
order by NAME;
NAME MOUNT_S STATE DNO PATH TOTAL_MB FREE_MB GNO
-------------------- ------- -------- ---------- -------------------- ---------- ---------- ----------
ARC_0000 CACHED NORMAL 0 /dev/asm-arc 2048 921 1
DATA_0000 CACHED NORMAL 0 /dev/asm-data 10240 7185 2
REDO_0000 CACHED NORMAL 0 /dev/asm-redo 5120 5025 4
CLOSED NORMAL 0 /dev/asm-ocr 0 0 0
2.创建磁盘组
create diskgroup OCR external redundancy disk
'/dev/asm-ocr' attribute 'au_size'='1M','compatible.asm'='11.2','compatible.rdbms'='10.1';
3.ocr加入新建磁盘组
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3124
Available space (kbytes) : 258996
ID : 161991732
Device/File Name : +data
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@rac1 bin]# ./ocrconfig -add +OCR
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3128
Available space (kbytes) : 258992
ID : 161991732
Device/File Name : +data
Device/File integrity check succeeded
Device/File Name : +OCR
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
4.OCR删除老磁盘组
[root@rac1 bin]# ./ocrconfig -delete +DATA
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3128
Available space (kbytes) : 258992
ID : 161991732
Device/File Name : +OCR
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
5.替换仲裁盘
[root@rac1 bin]# ./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE aa1f2ffde3624f59bf3b76a5f14c3142 (/dev/asm-data) [DATA]
Located 1 voting disk(s).
[root@rac1 bin]# ./crsctl replace votedisk +OCR
Successful addition of voting disk 9e3d3f3ba1ba4f6ebf67db7ec6fa6fff.
Successful deletion of voting disk aa1f2ffde3624f59bf3b76a5f14c3142.
Successfully replaced voting disk group with +OCR.
CRS-4266: Voting file(s) successfully replaced
[root@rac1 bin]# ./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 9e3d3f3ba1ba4f6ebf67db7ec6fa6fff (/dev/asm-ocr) [OCR]
Located 1 voting disk(s).
6.重建spfile到新磁盘组
ASMCMD> spget
+DATA/rac-cluster/asmparameterfile/registry.253.1188043365
SQL> create pfile='/home/grid/pfile.ora' from spfile;
File created.
SQL> create spfile='+OCR' from pfile='/home/grid/pfile.ora';
File created.
exit
ASMCMD> spget
+OCR/rac-cluster/asmparameterfile/registry.253.1197525347
7.move密码文件(11G版本忽略此步骤)
[:grid]:/home/grid>asmcmd
ASMCMD> pwcopy --asm +DATA/orapwASM /home/grid/orapwASM_backup -f
copying +DG_OCR/orapwASM -> /home/grid/orapwASM_backup
ASMCMD> pwmove --asm +DATA/orapwASM +OCR/orapwASM -f
moving +DATA/orapwASM -> ++OCR/orapwASM
ASMCMD> exit
[:grid]:/home/grid>srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwASM
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNET1LSNR_ASM