您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關oracle中如何解決asm磁盤添加失敗問題,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
生產環境存儲劃盤并做了多路徑聚合,由于經驗生疏忘記需要配置udev。
在添加磁盤到diskgroup時,數據庫報錯權限不足,簡單以為只是對應的字符設備的權限是root:disk導致無法添加到diskgroup。
所以嘗試使用chown命令在兩個節點將該字符設備修改權限為grid:oinstall后,由于suse系統udev內部機制問題,在添加該字符設備到diskgroup過程中,字符設備的權限自動由grid:oinstall變為root:disk,導致添加磁盤失敗。此時該磁盤盤頭已寫入部分信息,HEADER_STATUS為NUMBER,導致無法重新添加到diskgroup,也無法從磁盤組踢出,進退兩難。
由于是生產環境,不敢隨意操作,故在測試環境模擬問題并解決。
問題重現:
1 確認/dev/raw/raw6的HEADER_STATUS是CANDIDATE狀態,說明可以添加到asm磁盤組。
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw6 0 0 NORMAL CLOSED CANDIDATE ONLINE
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
2 查看磁盤組,模擬將/dev/raw/raw6加進磁盤組DATA。
SQL> select GROUP_NUMBER,NAME from v$asm_diskgroup;
GROUP_NUMBER NAME
------------ --------------------
1 DATA1
2 DATA
3 將/dev/raw/raw6加入磁盤組DATA的過程中(約等待3s),另開窗口,將/dev/raw/raw6的權限由grid:asmadmin改為root:disk,此時報錯如下:
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15075: disk(s) are not visible cluster-wide
4 重啟udev(即:將/dev/raw/raw6 權限重新改為grid:asmadmin) 并重新查詢。
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw6 0 0 NORMAL CLOSED MEMBER ONLINE
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
5 此時嘗試再次將/dev/raw/raw6加入DATA中,出現報錯,模擬故障成功。
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk '/dev/raw/raw6' belongs to diskgroup "DATA"
解決方法:
查了oracle官方文檔,提供了如下三種解決方法(1453285.1):
方法一:
1 備份問題磁盤
dd if=/dev/oracleasm/disks/EMCORA43 of=/tmp/EMCORA43.txt bs=1M count=10
2 修改磁盤權限
chmod 000 /dev/oracleasm/disks/EMCORA47
3 重新掛載diskgroup,確認diskgroup可以正常掛載,則可以使用dd命令清除盤頭信息,并重新添加該磁盤。
dd if=/dev/zero of=/dev/oracleasm/disks/EMCORA43 bs=1M count=1
方法二:
使用oracleasm刪除磁盤
/etc/init.d/oracleasm deletedisk EMCORA43
方法三:
使用force選項強制重新掛載該磁盤。
alter diskgroup XXXX add disk '/dev/oracleasm/disks/EMCORA43' force;
本次實驗采用第三種方法:
具體如下:
SQL> select NAME, TOTAL_MB, FREE_MB, (TOTAL_MB - FREE_MB)
USED_MB, to_char((TOTAL_MB - FREE_MB) * 100 / TOTAL_MB,'99.99') || '%'
USED_PRECENT from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB USED_MB USED_PRECENT
-------------------- ---------- ---------- ---------- --------------
DATA1 1998 1901 97 4.85%
DATA 2997 630 2367 78.98%
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw6 0 0 NORMAL CLOSED MEMBER ONLINE
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
6 rows selected.
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk '/dev/raw/raw6' belongs to diskgroup "DATA"
SQL> alter diskgroup DATA add disk '/dev/raw/raw6' force;
Diskgroup altered.
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw6 DATA_0005 5 2 NORMAL CACHED MEMBER ONLINE
6 rows selected.
SQL> select NAME, TOTAL_MB, FREE_MB, (TOTAL_MB - FREE_MB) USED_MB, to_char((TOTAL_MB - FREE_MB) * 100 / TOTAL_MB,'99.99') || '%' USED_PRECENT from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB USED_MB USED_PRECENT
-------------------- ---------- ---------- ---------- --------------
DATA1 1998 1901 97 4.85%
DATA 3497 1128 2369 67.74%
實際測試中,第一和第三種方法都可行(因本測試環境未使用oracleasm,故不測試第二種)。
因第一種方法較為穩妥,故選擇第一種方法在生產環境修復問題。
后續:
1、 幾天后在生產環境pboss2-rdb1/2 江蘇庫使用第一種方法修復成功。但是引出一個問題:suse系統和rhel系統在udev上有一些差異,rhel修改完 /etc/udev/rules.d/下的 rules文件,通過命令start_udev啟動udev即可。但是suse則需要如下操作/etc/init.d/boot.udev restart 重啟udev配置,然后模擬拔插 udevadm test /sys/block/xxx 才能使設置生效。當時沒發現這個差異,只能通過重啟系統生效。
2、在asmdisk加進diskgroup后,正在做rebalance過程中,使用兩種方法改變asmdisk權限。一種是直接操作系統chown命令改變兩個節點的asmdisk,結果發現rebalance正常進行,diskgroup不受影響。另一種是使用udev改變asmdisk屬性,重啟udev使之生效,結果發現diskgroup異常,直接unmount,數據庫實例down,把asmdisk權限修改回來后,重新alter diskgroup xxx mount后,發現rebalance繼續進行,數據庫重啟后正常。
關于“oracle中如何解決asm磁盤添加失敗問題”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。