asm如何更换ocr新磁盘组

测试如下,安装grid选择的四块100g的磁盘组命名为+DATA

创建了三块1g的用于ocr

 

创建磁盘组命令省略

切换root用户执行如下

[root@rac1 bin]# ./ocrconfig -add +OCR
PROT-30: The Oracle Cluster Registry location to be added is not usable
PROC-50: The Oracle Cluster Registry location to be added is inaccessible on nodes rac1.
[grid@rac1 ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576    409596   407555                0          407555              0             Y  DATA/
ASMCMD> exit
[grid@rac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 25 10:41:57 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 ARCH mount;

Diskgroup altered.

SQL> l
  1* alter diskgroup ARCH mount
SQL> c/ARCH/OCR
  1* alter diskgroup OCR mount
SQL> /

Diskgroup altered.

SQL> EXIT
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
[grid@rac1 ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576    409596   409497                0          409497              0             N  ARCH/
MOUNTED  EXTERN  N         512   4096  1048576    409596   407555                0          407555              0             Y  DATA/
MOUNTED  NORMAL  N         512   4096  1048576      3069     2790             1023             883              0             N  OCR/
ASMCMD> exit
[grid@rac1 ~]$ 

root账户执行提示错误,asmcmd执行查看磁盘组没有mount ,于是进入slqplus 中对磁盘组进行上线处理

 

切换root继续执行

[root@rac1 bin]# ./ocrconfig -add +OCR
PROT-30: The Oracle Cluster Registry location to be added is not usable
PROC-8: Cannot perform cluster registry operation because one of the parameters is invalid.
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +OCR.255.1
ORA-15221: ASM operation requires compatible.asm of 11.1.0.0.0 or higher
ORA-06512: at line 4

[root@rac1 bin]#

  提示新的错误,DATA磁盘组时我安装grid时候创建的,OCR,ARCH 时安装后使用sql命令创建的

后来查资料时asm 兼容版本不一致,于是有下列操作步骤

 

[grid@rac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 25 10:43:52 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> set lines 200
SQL> select name,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup
  2  

SQL> /

NAME                           COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
DATA                           11.2.0.0.0                                                   10.1.0.0.0
OCR                            11.2.0.0.0                                                   10.1.0.0.0
ARCH                           11.2.0.0.0                                                   10.1.0.0.0
SQL> alter diskgroup OCR set attribute 'compatible.asm'='11.2';

Diskgroup altered.

SQL> L
  1* alter diskgroup OCR set attribute 'compatible.asm'='11.2'
SQL> C/OCR/ARCH
  1* alter diskgroup ARCH set attribute 'compatible.asm'='11.2'
SQL> /

Diskgroup altered.

SQL> select name,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup
  2  /

NAME                           COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------------------------ ------------------------------------------------------------ ------------------------------------------------------------
DATA                           11.2.0.0.0                                                   10.1.0.0.0
OCR                            11.2.0.0.0                                                   10.1.0.0.0
ARCH                           11.2.0.0.0                                                   10.1.0.0.0

SQL> ho ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2948
         Available space (kbytes) :     259172
         ID                       :   40263290
         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 bypassed due to non-privileged user


SQL> 

  切换root账户执行

[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)      :       2948
         Available space (kbytes) :     259172
         ID                       :   40263290
         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

[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)      :       2948
         Available space (kbytes) :     259172
         ID                       :   40263290
         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

[root@rac1 bin]# 

  

 

 

执行完毕

 

posted @ 2021-12-26 00:02  IT杂物铺  阅读(252)  评论(0编辑  收藏  举报