关于迁移rac中ocr votedisk
环境:
hpunix
oracle rac 11.2.0.3
问题描述:
由于用户错误操作,将ocr和votedisk放在+GRID中,现在要将其迁移到+OCR_VOTE中:
解决:
具体操作如下:(只记录了操作命令)
[root@node2 ~]$ /u01/app/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2992
Available space (kbytes) : 259128
ID : 601346144
Device/File Name : +GRID
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 bypassed due to non-privileged user
这里我们看到ocr放在+GRID中了
然后Add a new OCR device/file:
[root @node2 ~]/u01/app/11.2.0/grid/bin/ocrconfig -add +OCR_VOTE
[root @node2 ~]$ /u01/app/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2992
Available space (kbytes) : 259128
ID : 601346144
Device/File Name : +GRID
Device/File integrity check succeeded
+OCR_VOTE
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 bypassed due to non-privileged user
(这时候ocr并不存在于+OCR_VOTE中)
迁移 ocr:
[root @node2 ~]$/u01/app/11.2.0/grid/bin/ocrconfig -replace +GRID -replacement +OCR_VOTE
然后迁移votedisk:
[root @node2 ~]$su - grid
[grid @node2 ~]$crsctl replace votedisk +OCR_VOTE
查询一下votedisk的存放目录:
[grid @node2 ~]$crsctl query css votedisk;
查询一下资源状态:
[grid @node2 ~]$crsctl status resource -t
然后登录asm查看asmdisk的信息:
sqlplus / as sysasm
SQL> select group_number,name,state,type from V$asm_diskgroup;
SQL> select group_number,name,path from v$asm_disk;
注意,此时是无法删除+GRID disk group的因为asm 的参数文件极有可能存放在+GRID中
使用命令 show parameter spfile查看路径
如果存放在+GRID中,可以重建spfile:
如下操作:
SQL>create pfile='/u01/11.2.0/grid/dbs/asmpfile.ora' from spfile;
SQL>create spfile='+OCR_VOTE' from pfile='/u01/11.2.0/grid/dbs/asmpfile.ora';
然后使用root用户重启crs即可(当然,如果你很闲,可以尝试修改启动crs时不启动asm,然后修改spfile的存放路径,这个工作量有点大哦!)
[root @node2 ~]$/u01/app/11.2.0/grid/bin/crsctl stop crs
[root @node2 ~]$/u01/app/11.2.0/grid/bin/crsctl start crs
然后再使用grid用户
su - grid
SQL>alter diskgroup OCR_VOTE mount;
切换root用户
/u01/app/11.2.0/grid/bin/ocrconfig -delete +GRID
最后删除+GRID(也可以使用asmca删除,注意,如果删除之后再使用GRID中的磁盘时,如果有找不到磁盘等问题,最好使用dd命令清理一下磁盘头,命令:dd if = /dev/zero of=/dev/rdisk/xx count=100,切记dd命令相当危险)
SQL>alter diskgroup GRID dismount;
SQL>drop diskgroup GRID including contents;