大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章将为大家详细讲解有关如何迁移OCR和VotingDisk并删除原ASM磁盘组,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
蒲城网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、自适应网站建设等网站项目制作,到程序开发,运营维护。创新互联公司公司2013年成立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司。
由于存储问题,需要将系统迁移到别的存储上承载,OCR和VotingDisk迁移之前也做过几次,但是没有找到实操记录,这里重新记一次。
本身OCR和VotingDisk迁移是可以在线完成的,这个很好,可惜的是ASM的spfile的迁移需要重启ASM实例,这个比较麻烦;不知道有没有办法在线迁移ASM的spfile的。
# oracleasm listdisks
DATADG1
OCR1
OCR2
OCR3
/etc/init.d/oracleasm createdisk NOCR1 /dev/sde1
/etc/init.d/oracleasm createdisk NOCR2 /dev/sdf1
/etc/init.d/oracleasm createdisk NOCR3 /dev/sdg1
# oracleasm listdisks
DATADG1
NOCR1
NOCR2
NOCR3
OCR1
OCR2
OCR3
SQL> col name for a10
SQL> col path for a40
SQL> select name ,path from v$asm_disk;
NAME PATH
---------- ----------------------------------------
ORCL:NOCR1
ORCL:NOCR2
ORCL:NOCR3
DATADG1 ORCL:DATADG1
OCR1 ORCL:OCR1
OCR2 ORCL:OCR2
OCR3 ORCL:OCR3
7 rows selected.
SQL> set linesize 200
SQL> col name for a20
SQL> select inst_id,name,allocation_unit_size,state,total_mb,free_mb,usable_file_mb from gv$asm_diskgroup;
INST_ID NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB USABLE_FILE_MB
---------- -------------------- -------------------- ---------------------- ---------- ---------- --------------
2 DATADG 1048576 MOUNTED 8189 6484 6484
2 OCRDG 1048576 MOUNTED 6141 5215 1584
1 DATADG 1048576 MOUNTED 8189 6484 6484
1 OCRDG 1048576 MOUNTED 6141 5215 1584
SQL> select name,allocation_unit_size,state,total_mb,free_mb,usable_file_mb,type from v$asm_diskgroup;
NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB USABLE_FILE_MB TYPE
-------------------- -------------------- ---------------------- ---------- ---------- -------------- ------------
DATADG 1048576 MOUNTED 8189 6484 6484 EXTERN
OCRDG 1048576 MOUNTED 6141 5215 1584 NORMAL
SQL> select failgroup, name from v$asm_disk where group_number=(select group_number from v$asm_diskgroup where name = 'OCRDG');
FAILGROUP NAME
------------------------------------------------------------ --------------------
OCR1 OCR1
OCR2 OCR2
OCR3 OCR3
create diskgroup NOCRDG normal redundancy
FAILGROUP fgocr1 disk 'ORCL:NOCR1'
FAILGROUP fgocr2 disk 'ORCL:NOCR2'
FAILGROUP fgocr3 disk 'ORCL:NOCR3' ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';
SQL> create diskgroup NOCRDG normal redundancy
2 FAILGROUP fgocr1 disk 'NOCR1'
3 FAILGROUP fgocr2 disk 'NOCR2'
4 FAILGROUP fgocr3 disk 'NOCR3' ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';
create diskgroup NOCRDG normal redundancy
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15031: disk specification 'NOCR3' matches no disks
ORA-15031: disk specification 'NOCR2' matches no disks
ORA-15031: disk specification 'NOCR1' matches no disks
SQL>
SQL> create diskgroup NOCRDG normal redundancy
2 FAILGROUP fgocr1 disk 'ORCL:NOCR1'
3 FAILGROUP fgocr2 disk 'ORCL:NOCR2'
4 FAILGROUP fgocr3 disk 'ORCL:NOCR3' ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='1M';
Diskgroup created.
SQL> select inst_id,name,allocation_unit_size,state,total_mb,free_mb,usable_file_mb from gv$asm_diskgroup;
INST_ID NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB USABLE_FILE_MB
---------- -------------------- -------------------- ---------------------- ---------- ---------- --------------
2 DATADG 1048576 MOUNTED 8189 6484 6484
2 OCRDG 1048576 MOUNTED 6141 5215 1584
2 NOCRDG 0 DISMOUNTED 0 0 0
1 DATADG 1048576 MOUNTED 8189 6484 6484
1 OCRDG 1048576 MOUNTED 6141 5215 1584
1 NOCRDG 1048576 MOUNTED 6141 5988 1970
6 rows selected.
SQL> alter diskgroup NOCRDG mount;
alter diskgroup NOCRDG mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15017: diskgroup "NOCRDG" cannot be mounted
ORA-15013: diskgroup "NOCRDG" is already mounted
---下面在另外一个节点将磁盘mount上。
SQL> alter diskgroup NOCRDG mount;
Diskgroup altered.
SQL> select inst_id,name,allocation_unit_size,state,total_mb,free_mb,usable_file_mb from gv$asm_diskgroup;
INST_ID NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB USABLE_FILE_MB
---------- -------------------- -------------------- ---------------------- ---------- ---------- --------------
1 DATADG 1048576 MOUNTED 8189 6484 6484
1 OCRDG 1048576 MOUNTED 6141 5215 1584
1 NOCRDG 1048576 MOUNTED 6141 5862 1907
2 DATADG 1048576 MOUNTED 8189 6484 6484
2 OCRDG 1048576 MOUNTED 6141 5215 1584
2 NOCRDG 1048576 MOUNTED 6141 5862 1907
6 rows selected.
SQL> select name,compatibility from gv$asm_diskgroup;
NAME COMPATIBILITY
-------------------- ---------------------------------------------
DATADG 11.2.0.0.0
OCRDG 11.2.0.0.0
NOCRDG 11.2.0.0.0
DATADG 11.2.0.0.0
OCRDG 11.2.0.0.0
NOCRDG 11.2.0.0.0
6 rows selected.
SQL> select name,state from v$asm_disk;
NAME STATE
-------------------- ----------------
DATADG1 NORMAL
NOCR1 NORMAL
NOCR2 NORMAL
NOCR3 NORMAL
OCR1 NORMAL
OCR2 NORMAL
OCR3 NORMAL
7 rows selected.
----上面是创建磁盘组操作,下面进行OCR迁移---
[grid@rac11g01 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2952
Available space (kbytes) : 259168
ID : 869504304
Device/File Name : +OCRDG
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磁盘组
$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 66d6304135f94f2ebf810423579f56f5 (ORCL:OCR1) [OCRDG]
2. ONLINE 7686f167dfe84fe6bfac809a732a3216 (ORCL:OCR2) [OCRDG]
3. ONLINE 0d1bd4c060464f5cbf4d0ae08855db33 (ORCL:OCR3) [OCRDG]
# /u01/app/11.2/grid/bin/ocrconfig -manualbackup
rac11g01 2018/04/13 16:43:00 /u01/app/11.2/grid/cdata/backup_20180413_164300.ocr
rac11g01 2018/04/13 16:36:01 /u01/app/11.2/grid/cdata/backup_20180413_163601.ocr
rac11g01 2018/04/13 16:31:53 /u01/app/11.2/grid/cdata/backup_20180413_163153.ocr
rac11g01 2018/04/13 16:30:56 /u01/app/11.2/grid/cdata/backup_20180413_163056.ocr
rac11g01 2018/04/13 16:30:40 /u01/app/11.2/grid/cdata/backup_20180413_163040.ocr
# /u01/app/11.2/grid/bin/ocrconfig -showbackup
[root@rac11g01 bin]# ./ocrconfig -add +NOCRDG
[root@rac11g01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3064
Available space (kbytes) : 259056
ID : 869504304
Device/File Name : +OCRDG
Device/File integrity check succeeded
Device/File Name : +NOCRDG
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@rac11g01 bin]# ./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 66d6304135f94f2ebf810423579f56f5 (ORCL:OCR1) [OCRDG]
2. ONLINE 7686f167dfe84fe6bfac809a732a3216 (ORCL:OCR2) [OCRDG]
3. ONLINE 0d1bd4c060464f5cbf4d0ae08855db33 (ORCL:OCR3) [OCRDG]
Located 3 voting disk(s).
--替换OCR
---这个时候直接删除旧的OCR指定旧的磁盘组即可,不需要再替换。
---这里的删除只代表OCR不在使用该磁盘组,但是Voting还在使用,还需迁移。
# ./ocrconfig -replace +OCRDG -replacement +NOCRDG
PROT-29: The Oracle Cluster Registry location is already configured
---删除旧的磁盘组
# ./ocrconfig -delete +OCRDG
[root@rac11g01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3064
Available space (kbytes) : 259056
ID : 869504304
Device/File Name : +NOCRDG
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
---迁移Voting Disk,只需要grid用户替换即可,无需root用户操作
[grid@rac11g01 ~]$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 66d6304135f94f2ebf810423579f56f5 (ORCL:OCR1) [OCRDG]
2. ONLINE 7686f167dfe84fe6bfac809a732a3216 (ORCL:OCR2) [OCRDG]
3. ONLINE 0d1bd4c060464f5cbf4d0ae08855db33 (ORCL:OCR3) [OCRDG]
Located 3 voting disk(s).
[grid@rac11g01 ~]$ crsctl replace votedisk +NOCRDG
Successful addition of voting disk 7d7aa071dcb44f18bfdc26f87f04462d.
Successful addition of voting disk 1063860a39224ff4bf667d5d1e31b765.
Successful addition of voting disk 65056f3f96494fc4bfa7214b3265cbd3.
Successful deletion of voting disk 66d6304135f94f2ebf810423579f56f5.
Successful deletion of voting disk 7686f167dfe84fe6bfac809a732a3216.
Successful deletion of voting disk 0d1bd4c060464f5cbf4d0ae08855db33.
Successfully replaced voting disk group with +NOCRDG.
CRS-4266: Voting file(s) successfully replaced
[grid@rac11g01 ~]$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 7d7aa071dcb44f18bfdc26f87f04462d (ORCL:NOCR1) [NOCRDG]
2. ONLINE 1063860a39224ff4bf667d5d1e31b765 (ORCL:NOCR2) [NOCRDG]
3. ONLINE 65056f3f96494fc4bfa7214b3265cbd3 (ORCL:NOCR3) [NOCRDG]
Located 3 voting disk(s).
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 8189 6454 0 6454 0 N DATADG/
MOUNTED NORMAL N 512 4096 1048576 6141 5217 2047 1585 0 Y NOCRDG/
MOUNTED NORMAL N 512 4096 1048576 6141 5311 2047 1632 0 N OCRDG/
---迁移ASM spfile
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
spfile string +OCRDG/rac11g-scan/asmparamete
rfile/registry.253.973341853
SQL> create pfile='/tmp/asmpfile.ora' from spfile;
File created.
SQL> create spfile='+NOCRDG' from pfile='/tmp/asmpfile.ora';
File created.
SQL>
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
spfile string +OCRDG/rac11g-scan/asmparamete
rfile/registry.253.973341853
SQL>
--这里需要重启ASM实例才生效,重启后:
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
spfile string +NOCRDG/rac11g-scan/asmparamet
erfile/registry.253.973596011
SQL> select group_number,name,state,path,total_mb,free_mb,redundancy from v$asm_disk order by 1;
GROUP_NUMBER NAME STATE PATH TOTAL_MB FREE_MB REDUNDANCY
------------ ---------- ---------- -------------------- ---------- ---------- --------------
0 NORMAL ORCL:OCR1 0 0 UNKNOWN
0 NORMAL ORCL:OCR2 0 0 UNKNOWN
0 NORMAL ORCL:OCR3 0 0 UNKNOWN
1 DATADG1 NORMAL ORCL:DATADG1 8189 6444 UNKNOWN
2 NOCR1 NORMAL ORCL:NOCR1 2047 1738 UNKNOWN
2 NOCR2 NORMAL ORCL:NOCR2 2047 1738 UNKNOWN
2 NOCR3 NORMAL ORCL:NOCR3 2047 1739 UNKNOWN
7 rows selected.
SQL> col name for a10
SQL> select name ,free_mb,total_mb from v$asm_diskgroup;
NAME FREE_MB TOTAL_MB
---------- ---------- ----------
DATADG 6444 8189
NOCRDG 5215 6141
OCRDG 0 0
重启以后,磁盘组并未自动mount,需要在其中一个节点mount并删除。
SQL> alter diskgroup OCRDG mount;
Diskgroup altered.
SQL> drop diskgroup OCRDG including contents;
Diskgroup dropped.
SQL> col name for a10
SQL> select name ,free_mb,total_mb from v$asm_diskgroup;
NAME FREE_MB TOTAL_MB
---------- ---------- ----------
DATADG 6444 8189
NOCRDG 5215 6141
SQL> select name ,free_mb,total_mb from gv$asm_diskgroup;
NAME FREE_MB TOTAL_MB
---------- ---------- ----------
DATADG 6444 8189
NOCRDG 5215 6141
DATADG 6444 8189
NOCRDG 5215 6141
[grid@rac11g01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATADG.dg ora....up.type ONLINE ONLINE rac11g01
ora....ER.lsnr ora....er.type ONLINE ONLINE rac11g01
ora....N1.lsnr ora....er.type ONLINE ONLINE rac11g01
ora.NOCRDG.dg ora....up.type ONLINE ONLINE rac11g01
ora.asm ora.asm.type ONLINE ONLINE rac11g01
ora.cvu ora.cvu.type ONLINE ONLINE rac11g02
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac11g01
ora.oc4j ora.oc4j.type ONLINE ONLINE rac11g02
ora.ons ora.ons.type ONLINE ONLINE rac11g01
ora....SM1.asm application ONLINE ONLINE rac11g01
ora....01.lsnr application ONLINE ONLINE rac11g01
ora....g01.gsd application OFFLINE OFFLINE
ora....g01.ons application ONLINE ONLINE rac11g01
ora....g01.vip ora....t1.type ONLINE ONLINE rac11g01
ora....SM2.asm application ONLINE ONLINE rac11g02
ora....02.lsnr application ONLINE ONLINE rac11g02
ora....g02.gsd application OFFLINE OFFLINE
ora....g02.ons application ONLINE ONLINE rac11g02
ora....g02.vip ora....t1.type ONLINE ONLINE rac11g02
ora.scan1.vip ora....ip.type ONLINE ONLINE rac11g01
ora.ty11g.db ora....se.type ONLINE ONLINE rac11g01
[grid@rac11g01 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 3056
Available space (kbytes) : 259064
ID : 869504304
Device/File Name : +NOCRDG
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
[grid@rac11g01 ~]$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 7d7aa071dcb44f18bfdc26f87f04462d (ORCL:NOCR1) [NOCRDG]
2. ONLINE 1063860a39224ff4bf667d5d1e31b765 (ORCL:NOCR2) [NOCRDG]
3. ONLINE 65056f3f96494fc4bfa7214b3265cbd3 (ORCL:NOCR3) [NOCRDG]
Located 3 voting disk(s).
至此,迁移操作已经完成,删除旧的磁盘组即可。
关于“如何迁移OCR和VotingDisk并删除原ASM磁盘组”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。