在Oracle 11g 的ASM 執行個體上刪除diskgroup 操作。
刪除時報錯ORA-15027: active use of diskgroup precludes its dismount ,如下:
SQL> drop diskgroup webdg including contents;
drop diskgroup webdg including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15027: active use of diskgroup "WEBDG" precludes its dismount
在刪除之前我已經關閉了資料庫執行個體,ASM 執行個體上還會有什麼用戶端串連呢?
SQL> select * from v$asm_client;
GROUP_NUMBER INSTANCE_NAME
------------ ----------------------------------------------------------------
DB_NAME STATUS
-------- ------------
SOFTWARE_VERSION
------------------------------------------------------------
COMPATIBLE_VERSION
------------------------------------------------------------
1 +ASM2
+ASM CONNECTED
11.2.0.1.0
11.2.0.1.0
GROUP_NUMBER INSTANCE_NAME
------------ ----------------------------------------------------------------
DB_NAME STATUS
-------- ------------
SOFTWARE_VERSION
------------------------------------------------------------
COMPATIBLE_VERSION
------------------------------------------------------------
2 +ASM2
asmvol CONNECTED
11.2.0.1.0
11.2.0.1.0
磁碟組webdg 的group_number 值是2 ,這執行個體+ASM2 上有一個asmvol 串連。這是11g 中的新功能,在磁碟組上建立的邏輯卷。我在建立ASM 執行個體時,出於測試的目的,建立ASM 卷組,並以ACFS 的檔案格式掛載到了作業系統上。
SQL> host;
[grid@serv2 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p3 39G 8.5G 29G 23% /
/dev/cciss/c0d0p6 185G 157G 20G 90% /oradata
/dev/cciss/c0d0p2 291G 46G 230G 17% /u01
/dev/cciss/c0d0p1 99M 12M 82M 13% /boot
tmpfs 12G 224M 12G 2% /dev/shm
/dev/asm/vg1-229 40G 146M 40G 1% /u01/app/grid/acfsmounts/webdg_vg1
192.168.15.56:/u02 1008G 383G 574G 41% /u02
[grid@serv2 ~]$ exit
因此,需要將該掛載點umount 掉,再disable 邏輯卷組才能刪除磁碟組webdg 。
在RAC 的兩個節點上使用umount 命令umount 掉所有掛載點。
[root@serv2 ~]# /bin/umount -t acfs -a
再次使用drop diskgroup webdg including contents; 命令刪除磁碟組webdg 。
SQL> drop diskgroup webdg including contents;
drop diskgroup webdg including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15073: diskgroup WEBDG is mounted by another ASM instance
這次報錯顯示的是在另外一個ASM 執行個體上還mounted 了該磁碟組。這是RAC 常見的錯誤,因為在RAC 中磁碟組是同時掛載在兩個ASM 執行個體上的。
在兩個ASM 執行個體上同時dismount 掉磁碟組,這裡使用了force 選項。
SQL> alter diskgroup webdg dismount force;
Diskgroup altered.
在其中一個ASM 執行個體上drop 磁碟組,沒有force 會不成功,繼續加force 。
SQL> drop diskgroup webdg including contents;
drop diskgroup webdg including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15001: diskgroup "WEBDG" does not exist or is not mounted
SQL> drop diskgroup webdg force including contents;
Diskgroup dropped.
SQL>
至此,磁碟組終於刪除掉了。
更多Oracle相關資訊見Oracle 專題頁面 http://www.bkjia.com/topicnews.aspx?tid=12