這篇文章將為大家詳細(xì)講解有關(guān)如何遷移OCR和VotingDisk并刪除原ASM磁盤組,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
蒲城網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、自適應(yīng)網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營維護(hù)。創(chuàng)新互聯(lián)公司公司2013年成立到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)公司。
由于存儲(chǔ)問題,需要將系統(tǒng)遷移到別的存儲(chǔ)上承載,OCR和VotingDisk遷移之前也做過幾次,但是沒有找到實(shí)操記錄,這里重新記一次。
本身OCR和VotingDisk遷移是可以在線完成的,這個(gè)很好,可惜的是ASM的spfile的遷移需要重啟ASM實(shí)例,這個(gè)比較麻煩;不知道有沒有辦法在線遷移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
---下面在另外一個(gè)節(jié)點(diǎn)將磁盤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.
----上面是創(chuàng)建磁盤組操作,下面進(jìn)行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
---這個(gè)時(shí)候直接刪除舊的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實(shí)例才生效,重啟后:
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
重啟以后,磁盤組并未自動(dòng)mount,需要在其中一個(gè)節(jié)點(diǎn)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).
至此,遷移操作已經(jīng)完成,刪除舊的磁盤組即可。
關(guān)于“如何遷移OCR和VotingDisk并刪除原ASM磁盤組”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。