Oracle11g RAC数据库更换存储ASM磁盘(二)

4.替换OCR和voting所载的OCR磁盘(即替换表决盘)

4.1 ocrcheck

[grid@rac1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3248
         Available space (kbytes) :     258872
         ID                       :  484258700
         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 bypassed due to non-privileged user

4.2命令加磁盘组会出现版本过低错误,这里先解决错误。

https://blog.csdn.net/u012232730/article/details/83821390   -->一些应该主要的点

使用的asm磁盘组的兼容性属性的版本太旧
SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;  

SQL> set line 9999
SQL> SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;

GROUP_NUMBER NAME                           COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------ ------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
           1 ARCH                           11.2.0.0.0                                                   10.1.0.0.0
           2 DATA                           11.2.0.0.0                                                   10.1.0.0.0
           3 OCR                            11.2.0.0.0                                                   10.1.0.0.0
           4 OCR_NEW                        10.1.0.0.0                                                   10.1.0.0.0
           5 DATA_NEW                       10.1.0.0.0                                                   10.1.0.0.0
           6 ARCH_NEW                       10.1.0.0.0                                                   10.1.0.0.0

6 rows selected.

ALTER DISKGROUP OCR_NEW SET ATTRIBUTE 'compatible.asm' = '11.2';
ALTER DISKGROUP DATA_NEW SET ATTRIBUTE 'compatible.asm' = '11.2';
ALTER DISKGROUP ARCH_NEW SET ATTRIBUTE 'compatible.asm' = '11.2';

ALTER DISKGROUP OCR_NEW SET ATTRIBUTE 'compatible.rdbms' = '10.1' sid='*';

4.3 迁移OCR(root用户)

/u01/grid/11.2.0.4/bin/ocrconfig -add +OCR_NEW
/u01/grid/11.2.0.4/bin/ocrcheck

过程如下:
[root@rac1 ~]# /u01/grid/11.2.0.4/bin/ocrconfig -add +OCR_NEW
[root@rac1 ~]# /u01/grid/11.2.0.4/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3248
         Available space (kbytes) :     258872
         ID                       :  484258700
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
         Device/File Name         :   +OCR_NEW
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

日志:
[crsd(56338)]CRS-1007:The OCR/OCR mirror location was replaced by +OCR_NEW.

查看/etc/oracle/ocr.loc
[root@rac1 ~]# more /etc/oracle/ocr.loc
#Device/file  getting replaced by device +OCR_NEW 
ocrconfig_loc=+OCR
ocrmirrorconfig_loc=+OCR_NEW
local_only=false

如果以上没有成功则执行下面的命令
/如果在日志里已经查看OCR 已经替换成功,如上所示,这步可以不执行(执行也不会有影响)
/u01/grid/11.2.0.4/bin/ocrconfig -replace +OCR -replacement +OCR_NEW
PROT-29: The Oracle Cluster Registry location is already configured

4.3 迁移votdisk(grid用户)

crsctl query css votedisk(查看votedisk存放目录)
crsctl replace votedisk +OCR_NEW
crsctl query css votedisk

过程如下:
[grid@rac1 ~]$ cd /u01/grid/11.2.0.4/bin/
[grid@rac1 bin]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   604ad7360acb4fa3bfbaabff736bf9d0 (/dev/mapper/OCR) [OCR]
Located 1 voting disk(s).
[grid@rac1 bin]$ crsctl replace votedisk +OCR_NEW
Successful addition of voting disk b45597b96fe54f75bf101be4398937b0.
Successful addition of voting disk 1a8f153cf7e64f80bf3f47ad71c52249.
Successful addition of voting disk 7dd53ebc8bf74fbcbf19210e55797450.
Successful deletion of voting disk 604ad7360acb4fa3bfbaabff736bf9d0.
Successfully replaced voting disk group with +OCR_NEW.
CRS-4266: Voting file(s) successfully replaced
[grid@rac1 bin]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   b45597b96fe54f75bf101be4398937b0 (/dev/mapper/OCR_NEW1) [OCR_NEW]
 2. ONLINE   1a8f153cf7e64f80bf3f47ad71c52249 (/dev/mapper/OCR_NEW2) [OCR_NEW]
 3. ONLINE   7dd53ebc8bf74fbcbf19210e55797450 (/dev/mapper/OCR_NEW3) [OCR_NEW]
Located 3 voting disk(s).

4.4查询一下资源状态

crsctl stat res -t

4.5登陆asm查看asmdisk信息

select group_number,name,state,type from v$asm_diskgroup;
select group_number,name,path from v$asm_disk;

过程:

SQL> set line 9999
SQL> select group_number,name,path from v$asm_disk;

GROUP_NUMBER NAME                           PATH
------------ ------------------------------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
           3 OCR_0000                       /dev/mapper/OCR
           2 DATA_0000                      /dev/mapper/DATA
           1 ARCH_0000                      /dev/mapper/ARCH
           6 ARCH_NEW                       /dev/mapper/ARCH_NEW
           4 OCR_NEW_FG3_VOL3               /dev/mapper/OCR_NEW3
           5 DATA_NEW                       /dev/mapper/DATA_NEW
           4 OCR_NEW_FG2_VOL2               /dev/mapper/OCR_NEW2
           4 OCR_NEW_FG1_VOL1               /dev/mapper/OCR_NEW1

8 rows selected.

SQL> select group_number,name,state,type from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE       TYPE
------------ ------------------------------ ----------- ------
           1 ARCH                           MOUNTED     EXTERN
           2 DATA                           MOUNTED     EXTERN
           3 OCR                            MOUNTED     EXTERN
           4 OCR_NEW                        MOUNTED     NORMAL
           5 DATA_NEW                       MOUNTED     EXTERN
           6 ARCH_NEW                       MOUNTED     EXTERN

6 rows selected.

4.6重建ASM spfile

show parameter spfile;
create pfile='/u01/grid/11.2.0.4/dbs/asmpfile.ora' from spfile;
create spfile='+OCR_NEW' from pfile='/u01/grid/11.2.0.4/dbs/asmpfile.ora';

4.7重启crs,查看现在的spfile

crsctl stop cluster -all
crsctl start cluster -all
sqlplus / as sysasm
show parameter spfile

4.8删除旧的OCR(+OCR) -->root用户(剔除前要查看OCR有没有其他数据)

/u01/grid/11.2.0.4/bin/ocrconfig -delete +OCR
/u01/grid/11.2.0.4/bin/ocrcheck

删除磁盘组+OCR_VOTING//这里要注意一下,先要在所有节点2先执行alter diskgroup OCR dismount,
然后在节点1上执行:
select group_number,name,state,type from v$asm_diskgroup;
drop diskgroup  OCR including contents; 

drop diskgroup OCR force including contents;(强制删除ASM磁盘组)-->特殊情况无法dismount使用
alter diskgroup OCR dismount
crsctl delete resource ora.OCR.dg -f
crsctl stat res -t
还有执行以上的命令要用sysasm 用户登陆,不然没权限执行,

过程如下:
[grid@rac2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 6 16:56:45 2021

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> alter diskgroup OCR dismount;

Diskgroup altered.

SQL> set line 9999
SQL> select group_number,name,state,type from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE       TYPE
------------ ------------------------------ ----------- ------
           1 ARCH_NEW                       MOUNTED     EXTERN
           2 ARCH                           MOUNTED     EXTERN
           3 DATA_NEW                       MOUNTED     EXTERN
           4 DATA                           MOUNTED     EXTERN
           5 OCR_NEW                        MOUNTED     NORMAL
           0 OCR                            DISMOUNTED

6 rows selected.

[grid@rac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 6 16:57:38 2021

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> alter diskgroup OCR dismount
  2  ;

Diskgroup altered.

SQL> select group_number,name,state,type from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE       TYPE
------------ ------------------------------ ----------- ------
           1 ARCH_NEW                       MOUNTED     EXTERN
           2 ARCH                           MOUNTED     EXTERN
           3 DATA_NEW                       MOUNTED     EXTERN
           4 DATA                           MOUNTED     EXTERN
           5 OCR_NEW                        MOUNTED     NORMAL
           0 OCR                            DISMOUNTED

6 rows selected.

SQL> drop diskgroup OCR including contents; 
drop diskgroup OCR including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15001: diskgroup "OCR" does not exist or is not mounted

SQL> alter diskgroup OCR mount;

Diskgroup altered.

SQL> drop diskgroup  OCR including contents;

Diskgroup dropped.

Related Posts