您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關如何理解ASM Failure Group,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
用perl創建了兩個RAW的1G文件,準備做failure group
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP DISK MOUNT HEADER MODE TOTAL FREE
NUMBER NUMBER INCARNATION STATUS STATUS STATUS STATE REDUNDANC MB MB NAME FAILGROUP
------ ------ ----------- ------- --------- ------- ------ --------- ----- ----- ---------------- ----------------
0 0 0 CLOSED CANDIDATE ONLINE NORMAL UNKNOWN 1023 0
0 1 0 CLOSED CANDIDATE ONLINE NORMAL UNKNOWN 1023 0
1 0 4042421333 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2391 DISK_GROUP1_0000 DISK_GROUP1_0000
1 1 4042421334 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2399 DISK_GROUP1_0001 DISK_GROUP1_0001
2 0 4042421335 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2665 DISK_GROUP2_0000 DISK_GROUP2_0000
2 1 4042421336 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2668 DISK_GROUP2_0001 DISK_GROUP2_0001
已選擇6行。
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6' ;
CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15072: command requires at least 2 failure groups, discovered only 1
如果只有一個磁盤(failure group)是不可以做冗余策略(FAILURE GROUPS).
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6'
3 FAILGROUP controller1 DISK 'D:\ASM DISK\DISK_FILE_DISK5' NAME disk5 SIZE 1023 M FORCE ;
CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15034: disk 'D:\ASM DISK\DISK_FILE_DISK5' does not require the FORCE option
因為磁盤5從來沒有被ASM格式化過,所以不能用force選項,如果已經被ASM格式化過,就可以通過FORCE跳過格式化.
SQL> CREATE DISKGROUP DISK_GROUP3 NORMAL REDUNDANCY
2 FAILGROUP controller2 DISK 'D:\ASM DISK\DISK_FILE_DISK6'
3 FAILGROUP controller1 DISK 'D:\ASM DISK\DISK_FILE_DISK5' NAME disk5 SIZE 1023 M;
Diskgroup created.
磁盤組已經創建,faigroup分別命名controller1 ,controller2 .其中一個failgroup被命名為disk5
SQL> select GROUP_NUMBER,NAME,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,
2 TYPE,TOTAL_MB,FREE_MB,REQUIRED_MIRROR_FREE_MB,
3 USABLE_FILE_MB,OFFLINE_DISKS,UNBALANCED from v$asm_diskgroup;
REQUIRED USABLE
GROUP SECTOR BLOCK ALLOCATION TOTAL FREE MIRROR FILE
NUMBER NAME SIZE SIZE UNIT_SIZE STATE TYPE MB MB FREE_MB MB OFFLINE_DISKS UN
------ ------------ ------ ----- ---------- -------- ------ ----- ----- ---------- ---------- ------------- --
1 DISK_GROUP1 512 4096 1048576 MOUNTED EXTERN 6144 4790 0 4790 0 N
2 DISK_GROUP2 512 4096 1048576 MOUNTED EXTERN 6144 5333 0 5333 0 N
3 DISK_GROUP3 512 4096 1048576 MOUNTED NORMAL 2046 1944 0 972 0 N
可以看到磁盤組是normal類型
查看磁盤的狀態和名稱:
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP DISK MOUNT HEADER MODE TOTAL FREE
NUMBER NUMBER INCARNATION STATUS STATUS STATUS STATE REDUNDANC MB MB NAME FAILGROUP
------ ------ ----------- ------- --------- ------- -------- --------- ----- ----- ---------------- ----------------
1 0 4042421333 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2391 DISK_GROUP1_0000 DISK_GROUP1_0000
1 1 4042421334 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2399 DISK_GROUP1_0001 DISK_GROUP1_0001
2 0 4042421335 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2665 DISK_GROUP2_0000 DISK_GROUP2_0000
2 1 4042421336 CACHED MEMBER ONLINE NORMAL UNKNOWN 3072 2668 DISK_GROUP2_0001 DISK_GROUP2_0001
3 1 4042421348 CACHED MEMBER ONLINE NORMAL UNKNOWN 1023 972 DISK5 CONTROLLER1
3 0 4042421349 CACHED MEMBER ONLINE NORMAL UNKNOWN 1023 972 DISK_GROUP3_0000 CONTROLLER2
6 rows selected.
磁盤都是normal了
SQL> alter diskgroup disk_group3 dismount;
Diskgroup altered.
因為沒有數據,可以在線dismount.
SQL> select state from v$asm_diskgroup where name='DISK_GROUP3';
STATE
------------------
DISMOUNTED
SQL> alter diskgroup disk_group3 mount;
Diskgroup altered.
SQL> alter diskgroup disk_group3 drop disk disk5;
磁盤組已變更。
刪除一個磁盤,由于磁盤組要是normal的話,必須有兩個磁盤,但是這個動作仍然可以完成.
SQL> select GROUP_NUMBER,DISK_NUMBER,INCARNATION,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,REDUNDANCY,
2 TOTAL_MB,FREE_MB,NAME,FAILGROUP from v$asm_disk;
GROUP_NUMBER DISK_NUMBER INCARNATION MOUNT_STATUS HEADER_STATUS MODE_STATUS STATE REDUNDANCY
------------ ----------- ----------- -------------- ------------------------ -------------- ---------------- --------
1 0 4042862971 CACHED MEMBER ONLINE NORMAL UNKNOWN
1 1 4042862972 CACHED MEMBER ONLINE NORMAL UNKNOWN
2 0 4042862973 CACHED MEMBER ONLINE NORMAL UNKNOWN
2 1 4042862974 CACHED MEMBER ONLINE NORMAL UNKNOWN
3 1 4042862975 CACHED MEMBER ONLINE HUNG UNKNOWN
3 0 4042862976 CACHED MEMBER ONLINE NORMAL UNKNOWN
已選擇6行。
我們看到這個磁盤是HUNG狀態.
SQL> select * from v$asm_diskgroup;
GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB U COMP
------------ --------------- ----------- ---------- -------------------- ----------- ------ ---------- ---------- - ----
1 DISK_GROUP1 512 4096 1048576 CONNECTED EXTERN 6144 4790 N 10.1
2 DISK_GROUP2 512 4096 1048576 CONNECTED EXTERN 6144 5333 N 10.1
3 DISK_GROUP3 512 4096 1048576 CONNECTED NORMAL 2046 1936 N 10.1
SQL>
SQL> ALTER DISKGROUP DISK_GROUP3 CHECK DISK DISK5;
磁盤組已變更。
SQL> conn / as sysdba
已連接。
SQL> select file_name from dba_data_files;
FILE_NAME
---------------------------------------------------------------------------
+DISK_GROUP1/devdb/datafile/users.291.652996483
+DISK_GROUP1/devdb/datafile/sysaux.293.652996483
+DISK_GROUP1/devdb/datafile/undotbs1.292.652996483
+DISK_GROUP1/devdb/datafile/system.260.652996483
+DISK_GROUP1/devdb/datafile/example.256.652996665
D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\O1_MF_TEST2_42QWS6VO_.DBF
+DISK_GROUP3/devdb/datafile/teste.256.655147089
已選擇8行。
SQL> create table scott.user_session_t as select * from v$session;
表已創建。
SQL> alter tablespace teste offline;
表空間已更改。
表空間offline以后,磁盤組卸載:
SQL> ALTER DISKGROUP DISK_GROUP3 DISMOUNT;
磁盤組已變更。
SQL> ALTER DISKGROUP DISK_GROUP3 MOUNT;
磁盤組已變更。
SQL> alter diskgroup disk_group3 rebalance power 2;
磁盤組已變更。
SQL> alter tablespace teste online;
表空間已更改。
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 200m;
alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 200m
*
第 1 行出現錯誤:
ORA-01237: 無法擴展數據文件 8
ORA-01110: 數據文件 8: '+DISK_GROUP3/devdb/datafile/teste.256.655147089'
ORA-17505: ksfdrsz: 1 未能將文件大小調整為大小為 25600 的塊
ORA-15041: diskgroup space exhausted
我們發現不能擴展數據文件
SQL> select GROUP_NUMBER,name,TOTAL_MB,FREE_MB,OFFLINE_DISKS,STATE from v$asm_diskgroup;
GROUP_NUMBER NAME TOTAL_MB FREE_MB OFFLINE_DISKS STATE
------------ ------------------------------ ---------- ---------- ------------- -----------
1 DISK_GROUP1 6144 4790 0 CONNECTED
2 DISK_GROUP2 6144 5333 0 CONNECTED
3 DISK_GROUP3 2046 1936 0 CONNECTED
空間是夠的
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 10m;
alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 10m
*
第 1 行出現錯誤:
ORA-01237: 無法擴展數據文件 8
ORA-01110: 數據文件 8: '+DISK_GROUP3/devdb/datafile/teste.256.655147089'
ORA-17505: ksfdrsz: 1 未能將文件大小調整為大小為 1280 的塊
ORA-15041: diskgroup space exhausted
SQL> shutdown immediate
數據庫已經關閉。
已經卸載數據庫。
ORACLE 例程已經關閉。
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1295152 bytes
Variable Size 57425104 bytes
ASM Cache 25165824 bytes
ASM 磁盤組已裝載
SQL> alter diskgroup disk_group3 undrop disks;
磁盤組已變更。
這個時候,我們發現是可以取消這個刪除動作
SQL> select * from v$asm_disk;
GROUP_NUMBER DISK_NUMBER COMPOUND_INDEX INCARNATION MOUNT_STATUS HEADER_STATUS MODE_STATUS STATE
------------ ----------- -------------- ----------- -------------- ------------------------ -------------- -------------
1 0 16777216 4041340299 CACHED MEMBER ONLINE NORMAL
1 1 16777217 4041340300 CACHED MEMBER ONLINE NORMAL
2 0 33554432 4041340301 CACHED MEMBER ONLINE NORMAL
2 1 33554433 4041340302 CACHED MEMBER ONLINE NORMAL
3 1 50331649 4041340303 CACHED MEMBER ONLINE NORMAL
3 0 50331648 4041340304 CACHED MEMBER ONLINE NORMAL
已選擇6行。
SQL> alter database datafile '+DISK_GROUP3/devdb/datafile/teste.256.655147089' resize 12m;
數據庫已更改。
其實,我們做drop disk以后,并沒有刪除disk,我們看看hung狀態的解釋:
HUNG - Disk drop operation cannot continue because there is insufficient space to relocate the data from the disk being dropped
我們看到由于是failure group需要把數據轉移到其他的failura group,而只有2個disk,所以這個數據并沒有轉移,而是停在那
以上就是如何理解ASM Failure Group,小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。