资讯专栏INFORMATION COLUMN

Oracle ocr磁盘更换

IT那活儿 / 2045人阅读
Oracle ocr磁盘更换
一.  创建新的OCR磁盘组

(在一个节点执行就可以)
[root@rac1 rules.d]# su - grid
[grid@rac1 ~]$ asmca

1. 创建新的OCR磁盘组:




2. 查看两个节点是否添加了新的OCR磁盘组:

节点1:

SQL> set linesize 1000SQL> select name, TOTAL_MB, FREE_MB, state, type, COMPATIBILITY from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB STATE TYPE COMPATIBILITY------------------------------ ---------- ---------- ----------- ------ ------------------------------------------------------------ARCH 4096 3302 MOUNTED EXTERN 11.2.0.0.0DATA 10240 8130 MOUNTED EXTERN 11.2.0.0.0NEWOCR 9216 9057 MOUNTED NORMAL 11.2.0.0.0OCR 9216 8290 MOUNTED NORMAL 11.2.

节点2:

SQL> set linesize 1000SQL> select name, TOTAL_MB, FREE_MB, state, type, COMPATIBILITY from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB STATE TYPE COMPATIBILITY------------------------------ ---------- ---------- ----------- ------ ------------------------------------------------------------ARCH 4096 3302 MOUNTED EXTERN 11.2.0.0.0DATA 10240 8130 MOUNTED EXTERN 11.2.0.0.0NEWOCR 0 0 DISMOUNTED 0.0.0.0.0OCR 9216 8290 MOUNTED NORMAL 11.2.0.0.0

3. 发现节点2,需要手动mount新加的ASM磁盘组:

[root@rac2 ~]# su - grid[grid@rac2 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 6 07:36:04 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Real Application Clusters and Automatic Storage Management options
SQL> SQL> alter diskgroup NEWOCR mount;
Diskgroup altered.

4. 再次查看节点2新加的OCR磁盘组:

SQL> set linesize 1000SQL> select name, TOTAL_MB, FREE_MB, state, type, COMPATIBILITY from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB STATE TYPE COMPATIBILITY------------------------------ ---------- ---------- ----------- ------ ------------------------------------------------------------ARCH 4096 3302 MOUNTED EXTERN 11.2.0.0.0DATA 10240 8130 MOUNTED EXTERN 11.2.0.0.0NEWOCR 9216 8931 MOUNTED NORMAL 11.2.0.0.0OCR 9216 8290 MOUNTED NORMAL 11.2.0.0.0


二. 添加OCR信息到新的OCR磁盘组

(迁移OCR磁盘组)(一个节点上执行)
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ su rootPassword:
[root@rac1 grid]# ocrconfig -add +NEWOCR
[root@rac1 grid]# ocrcheck -configOracle Cluster Registry configuration is : Device/File Name : +OCR Device/File Name : +NEWOCR
[root@rac1 grid]# more /etc/oracle/ocr.loc#Device/file getting replaced by device +NEWOCR ocrconfig_loc=+OCRocrmirrorconfig_loc=+NEWOCRlocal_only=false
[root@rac1 grid]# ocrcheck && crsctl query css votedisk -- 检查、查看voting diskStatus of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 3464 Available space (kbytes) : 258656 ID : 1896437032 Device/File Name : +OCR Device/File integrity check succeeded Device/File Name : +NEWOCR 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
## STATE File Universal Id File Name Disk group-- ----- ----------------- --------- --------- 1. ONLINE a96d9ab34e494f8fbf921c97da8e6580 (/dev/raw/raw1) [OCR] 2. ONLINE 29b205061cc44f8abf86d791f6cf8db0 (/dev/raw/raw2) [OCR] 3. ONLINE 75fb74dbdd8b4f74bf22870f7d7b59bd (/dev/raw/raw3) [OCR]Located 3 voting disk(s).


三. 迁移VOTE DISK到新建的ASM磁盘组OCR上

1. 查询当前使用的OCR磁盘组:
SQL> set linesize 1000SQL> select GROUP_NUMBER,NAME,STATE,type,TOTAL_MB,free_mb,VOTING_FILES,COMPATIBILITY from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V COMPATIBILITY------------ ------------------------------ ----------- ------ ---------- ---------- - ------------------------------------------------------------ 1 ARCH MOUNTED EXTERN 4096 3302 N 11.2.0.0.0 2 DATA MOUNTED EXTERN 10240 8130 N 11.2.0.0.0 3 NEWOCR MOUNTED NORMAL 9216 8388 N 11.2.0.0.0 4 OCR MOUNTED NORMAL 9216 8290 Y 11.2.0.0.0

2. 替换为新添加的OCR:

[root@rac1 ~]# su - grid
[grid@rac1 ~]$ su rootPassword: [root@rac1 grid]# crsctl replace votedisk +NEWOCRSuccessful addition of voting disk 9c4a22a517044f4dbf6a8595b0f507f9.Successful addition of voting disk 372d1b3550844f9cbffaf00b6a2dbe96.Successful addition of voting disk 08ab4466be804f48bfea02f300de046a.Successful deletion of voting disk a96d9ab34e494f8fbf921c97da8e6580.Successful deletion of voting disk 29b205061cc44f8abf86d791f6cf8db0.Successful deletion of voting disk 75fb74dbdd8b4f74bf22870f7d7b59bd.Successfully replaced voting disk group with +NEWOCR.CRS-4266: Voting file(s) successfully replaced

3. 再次查询使用的OCR磁盘组:

SQL> set linesize 1000SQL> select GROUP_NUMBER,NAME,STATE,type,TOTAL_MB,free_mb,VOTING_FILES,COMPATIBILITY from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V COMPATIBILITY------------ ------------------------------ ----------- ------ ---------- ---------- - ------------------------------------------------------------ 1 ARCH MOUNTED EXTERN 4096 3302 N 11.2.0.0.0 2 DATA MOUNTED EXTERN 10240 8120 N 11.2.0.0.0 3 NEWOCR MOUNTED NORMAL 9216 8292 Y 11.2.0.0.0 4 OCR MOUNTED NORMAL 9216 8386 N 11.2.0.0.0

4. 发现voting file已经在NEWOCR上,然后在两个节点的root下查询:

节点1:

[root@rac1 ~]# su - grid
[grid@rac1 ~]$ su rootPassword:
[root@rac1 grid]# ocrcheck && crsctl query css votediskStatus of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 3464 Available space (kbytes) : 258656 ID : 1896437032 Device/File Name : +OCR Device/File integrity check succeeded Device/File Name : +NEWOCR 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
## STATE File Universal Id File Name Disk group-- ----- ----------------- --------- --------- 1. ONLINE 9c4a22a517044f4dbf6a8595b0f507f9 (/dev/raw/raw7) [NEWOCR] 2. ONLINE 372d1b3550844f9cbffaf00b6a2dbe96 (/dev/raw/raw8) [NEWOCR] 3. ONLINE 08ab4466be804f48bfea02f300de046a (/dev/raw/raw9) [NEWOCR]Located 3 voting disk(s).

节点2:

[root@rac2 ~]# su - grid
[grid@rac2 ~]$ su rootPassword:
[root@rac2 grid]# ocrcheck && crsctl query css votediskStatus of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 3464 Available space (kbytes) : 258656 ID : 1896437032 Device/File Name : +OCR Device/File integrity check succeeded Device/File Name : +NEWOCR 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
## STATE File Universal Id File Name Disk group-- ----- ----------------- --------- --------- 1. ONLINE 9c4a22a517044f4dbf6a8595b0f507f9 (/dev/raw/raw7) [NEWOCR] 2. ONLINE 372d1b3550844f9cbffaf00b6a2dbe96 (/dev/raw/raw8) [NEWOCR] 3. ONLINE 08ab4466be804f48bfea02f300de046a (/dev/raw/raw9) [NEWOCR]Located 3 voting disk(s).


四. 创建ASM实例spfile到新建的OCR ASM磁盘组上

在一个节点以grid用户登录ASM实例执行:
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 7 19:18:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Real Application Clusters and Automatic Storage Management options
SQL> show parameter spf
NAME TYPE VALUE------------------------------------ ----------- ------------------------------spfile string +OCR/rac-cluster/asmparameterf ile/registry.253.940267187
SQL> create pfile=/home/grid/asmpfile.ora from spfile;
File created.
SQL> create spfile=+NEWOCR from pfile=/home/grid/asmpfile.ora;
File created.


五.  删除OCR原位置的ASM磁盘组OCR

1. 删除旧的OCR磁盘组的原位置(在一个节点执行就可以):
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ su rootPassword:
[root@rac1 grid]# ocrconfig -delete +OCR

2. 查看OCR和voting disk新的状态与位置(所有节点):

节点1:

[root@rac1 grid]# ocrcheck && crsctl query css votediskStatus of Oracle Cluster Registry is as follows :   Version                  :          3   Total space (kbytes)     :     262120   Used space (kbytes)      :       3464   Available space (kbytes) :     258656   ID                       : 1896437032   Device/File Name         :    +NEWOCR                                    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
## STATE File Universal Id File Name Disk group-- ----- ----------------- --------- --------- 1. ONLINE 9c4a22a517044f4dbf6a8595b0f507f9 (/dev/raw/raw7) [NEWOCR] 2. ONLINE 372d1b3550844f9cbffaf00b6a2dbe96 (/dev/raw/raw8) [NEWOCR] 3. ONLINE 08ab4466be804f48bfea02f300de046a (/dev/raw/raw9) [NEWOCR]Located 3 voting disk(s).

节点2:

[root@rac2 grid]# ocrcheck && crsctl query css votediskStatus of Oracle Cluster Registry is as follows :   Version                  :          3   Total space (kbytes)     :     262120   Used space (kbytes)      :       3464   Available space (kbytes) :     258656   ID                       : 1896437032   Device/File Name         :    +NEWOCR                                    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
## STATE File Universal Id File Name Disk group-- ----- ----------------- --------- --------- 1. ONLINE 9c4a22a517044f4dbf6a8595b0f507f9 (/dev/raw/raw7) [NEWOCR] 2. ONLINE 372d1b3550844f9cbffaf00b6a2dbe96 (/dev/raw/raw8) [NEWOCR] 3. ONLINE 08ab4466be804f48bfea02f300de046a (/dev/raw/raw9) [NEWOCR]Located 3 voting disk(s).


六. 重启整个集群(所有节点)

[root@rac1 ~]# su - grid
[grid@rac1 ~]$ su rootPassword:
[root@rac1 grid]# crsctl stop crs && crsctl start crs -- 重启集群


七. 将旧的OCR磁盘组drop掉

1. 检查ASM实例的参数文件(参数文件路径是否是新添加的OCR磁盘组):
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 7 19:46:30 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Real Application Clusters and Automatic Storage Management options
SQL> show parameter spf
NAME TYPE VALUE------------------------------------ ----------- ------------------------------spfile string +NEWOCR/rac-cluster/asmparamet erfile/registry.253.940706513

2. 检查磁盘组状态:

节点1:

SQL> set linesize 1000SQL> Select GROUP_NUMBER,NAME,STATE,type,TOTAL_MB,free_mb,VOTING_FILES,COMPATIBILITY from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V COMPATIBILITY------------ ------------------------------ ----------- ------ ---------- ---------- --------------------- 1 ARCH MOUNTED EXTERN 4096 3208 N 11.2.0.0.0 2 DATA MOUNTED EXTERN 10240 8120 N 11.2.0.0.0 3 NEWOCR MOUNTED NORMAL 9216 8290 Y 11.2.0.0.0 0 OCR DISMOUNTED 0 0 N 0.0.0.0.0

SQL> select GROUP_NUMBER,DISK_NUMBER,STATE,REDUNDANCY,TOTAL_MB,FREE_MB,name,path,failgroup from v$asm_disk order by GROUP_NUMBER;
GROUP_NUMBER DISK_NUMBER STATE REDUNDA TOTAL_MB FREE_MB NAME PATH FAILGROUP------------ ----------- -------- ------- ---------- ---------- ------------------------------ -----------------  0 9 NORMAL UNKNOWN 0 0 /dev/raw/raw11 0 2 NORMAL UNKNOWN 0 0 /dev/raw/raw2 0 3 NORMAL UNKNOWN 0 0 /dev/raw/raw10 0 7 NORMAL UNKNOWN 0 0 /dev/raw/raw6 0 8 NORMAL UNKNOWN 0 0 /dev/raw/raw3 0 1 NORMAL UNKNOWN 0 0 /dev/raw/raw1 1 0 NORMAL UNKNOWN 4096 3208 ARCH_0000 /dev/raw/raw5 ARCH_0000 2 0 NORMAL UNKNOWN 10240 8120 DATA_0000 /dev/raw/raw4 DATA_0000 3 0 NORMAL UNKNOWN 3072 2762 NEWOCR_0000 /dev/raw/raw7 NEWOCR_0000 3 1 NORMAL UNKNOWN 3072 2763 NEWOCR_0001 /dev/raw/raw8 NEWOCR_0001 3 2 NORMAL UNKNOWN 3072 2765 NEWOCR_0002 /dev/raw/raw9 NEWOCR_0002
11 rows selected.

节点2:

SQL> set linesize 1000SQL> Select GROUP_NUMBER,NAME,STATE,type,TOTAL_MB,free_mb,VOTING_FILES,COMPATIBILITY from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V COMPATIBILITY------------ ------------------------------ ----------- ------ ---------- ---------- --------------------- 1 ARCH MOUNTED EXTERN 4096 3208 N 11.2.0.0.0 2 DATA MOUNTED EXTERN 10240 8120 N 11.2.0.0.0 3 NEWOCR MOUNTED NORMAL 9216 8290 Y 11.2.0.0.0 0 OCR DISMOUNTED 0 0 N 0.0.0.0.0

SQL> select GROUP_NUMBER,DISK_NUMBER,STATE,REDUNDANCY,TOTAL_MB,FREE_MB,name,path,failgroup from v$asm_disk order by GROUP_NUMBER;
GROUP_NUMBER DISK_NUMBER STATE REDUNDA TOTAL_MB FREE_MB NAME PATH FAILGROUP------------ ----------- -------- ------- ---------- ---------- ------------------------------ ----------------- 0 9 NORMAL UNKNOWN 0 0 /dev/raw/raw11 0 2 NORMAL UNKNOWN 0 0 /dev/raw/raw2 0 3 NORMAL UNKNOWN 0 0 /dev/raw/raw10 0 7 NORMAL UNKNOWN 0 0 /dev/raw/raw6 0 8 NORMAL UNKNOWN 0 0 /dev/raw/raw3 0 1 NORMAL UNKNOWN 0 0 /dev/raw/raw1 1 0 NORMAL UNKNOWN 4096 3208 ARCH_0000 /dev/raw/raw5 ARCH_0000 2 0 NORMAL UNKNOWN 10240 8120 DATA_0000 /dev/raw/raw4 DATA_0000 3 0 NORMAL UNKNOWN 3072 2762 NEWOCR_0000 /dev/raw/raw7 NEWOCR_0000 3 1 NORMAL UNKNOWN 3072 2763 NEWOCR_0001 /dev/raw/raw8 NEWOCR_0001 3 2 NORMAL UNKNOWN 3072 2765 NEWOCR_0002 /dev/raw/raw9 NEWOCR_000211 rows selected.

3. 最后将旧的磁盘组mount并drop掉(在一个节点执行):

[root@rac1 ~]# su - grid
[grid@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 7 20:00:27 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup OCR mount;
Diskgroup altered.
SQL> drop diskgroup OCR including contents;
Diskgroup dropped.

注意:旧的磁盘组只允许在一个节点mount,如果发现多个节点mount,需要在其他节点dismount,否则会删除不掉旧的磁盘组

[grid@rac1 ~]$ asmcmdASMCMD> lsARCH/DATA/NEWOCR/


END


更多精彩干货分享

点击下方名片关注

IT那活儿

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/129891.html

相关文章

  • GCP VPS主机性能与速度评测-免费试用90天有香港韩国等多个机房性能出众

    摘要:主机机房众多,其中亚太地区的机房有香港台湾韩国日本等,这些都是连接速度快的机房。本篇文章就来分享一下台湾香港机房的主机的性能与速度,因为这两个机房的主机线路都算不错,对于建站或者跑应用都很方便。GCP,即Google Cloud Platform,谷歌云计算平台,以前为大家提供免费试用一年的VPS主机,不过现在已经将试用时间缩短到了90天了。新用户在GCP添加了信用卡验证后,可以免费赠送30...

    番茄西红柿 评论0 收藏2637
  • 企业云计算道路隐藏着各种陷阱和困难

    摘要:但在现实中,企业云端漫步的道路从来都不是康庄大道,而是隐藏着各种陷阱和困难。如果企业选择云计算服务,那么这些技术人员很多将被解聘。 如今,越来越多的大企业禁不住应用软件厂商的诱惑,开始考虑将原来运行在私有数据中心的大型应用系统迁移到云端。而关于云计算的商业价值,形形色色 的云计算服务商通常会告诉企业:云计算可以帮助企业节省成本,增强IT系统与业务灵活性,加快应用部署速度,增强业务创新能力…相...

    cncoder 评论0 收藏0
  • 阿里云服务器使用教程,新手上云必备功课

    摘要:对于新手使用云服务器的时候,总会遇到各种问题,例如远程连接更换操作系统磁盘扩容配置升降配使用快照和镜像等,下面分享一些阿里云服务器常见操作的使用教程,希望对大家有所帮助。阿里云服务器重置实例密码。对于新手使用云服务器 的时候,总会遇到各种问题,例如远程连接、更换操作系统、磁盘扩容、配置升降配、使用快照和镜像等,下面分享一些阿里云服务器常见操作的使用教程,希望对大家有所帮助。 远程连接在 EC...

    Jonathan Shieber 评论0 收藏0

发表评论

0条评论

IT那活儿

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<