FAILGROUP和REDUNDANCY之間的關係關係!

warehouse發表於2011-02-07

我們知道asm裡提供了3種redundancy方式:normal,high和external,同事它又提供了template的概念,template裡也有redundancy的概念,而且template的redundancy特性優先發揮作用與diskgroup的redundancy特性,這樣其實就存在一個問題,當diskgroup處於normal方式並且只存在2個failgroup而位於該diskgroup

的asm file的redundancy方式是high的時候,oracle又是如何解決這一矛盾的呢

[@more@]

ASMCMD> ls -l control01.ctl
Type Redund Striped Time Sys Name
N control01.ctl => +DG1/ASMDB/CONTROLFILE/Current.256.741435505
ASMCMD> pwd
+dg1/asmdb
ASMCMD>
--========================
SQL> col type format a15
SQL> select group_number,file_number,type,redundancy,striped,redundancy_lowered from v$asm_file where file_number=256 and group_number=1;

GROUP_NUMBER FILE_NUMBER TYPE REDUNDANCY STRIPED RE
------------ ----------- --------------- ------------ ------------ --
1 256 CONTROLFILE HIGH FINE Y
--=====================================
SQL> col name format a20
SQL> select * from v$asm_template where group_number=1 and name='CONTROLFILE';

GROUP_NUMBER ENTRY_NUMBER REDUNDANCY STRIPE SY NAME
------------ ------------ ------------ ------------ -- --------------------
1 2 HIGH FINE Y CONTROLFILE

--=========================================
SQL> select group_number,type from v$asm_diskgroup;

GROUP_NUMBER TYPE
------------ ---------------
1 NORMAL
2 EXTERN
3 EXTERN
4 NORMAL

SQL>
--===============================
SQL> col failgroup format a10
SQL> select group_kffxp,xnum_kffxp,lxn_kffxp,disk_kffxp,failgroup
2 from x$kffxp x,v$asm_disk d
3 where number_kffxp=256 and group_kffxp=1
4 and d.disk_number(+)=x.disk_kffxp
5 and d.group_number(+)=x.group_kffxp
6 order by xnum_kffxp,lxn_kffxp,disk_kffxp,failgroup
7 ;

GROUP_KFFXP XNUM_KFFXP LXN_KFFXP DISK_KFFXP FAILGROUP
----------- ---------- ---------- ---------- ----------
1 0 0 1 DG1_0001
1 0 1 2 DG1_0002
1 0 2 65534
1 1 0 0 DG1_0001
1 1 1 2 DG1_0002
1 1 2 65534
1 2 0 2 DG1_0002
1 2 1 0 DG1_0001
1 2 2 65534
1 3 0 1 DG1_0001
1 3 1 2 DG1_0002
1 3 2 65534
1 4 0 2 DG1_0002
1 4 1 1 DG1_0001
1 4 2 65534
1 5 0 0 DG1_0001
1 5 1 2 DG1_0002
1 5 2 65534
1 6 0 2 DG1_0002
1 6 1 0 DG1_0001
1 6 2 65534
1 7 0 2 DG1_0002
1 7 1 1 DG1_0001
1 7 2 65534

已選擇24行。

SQL>
--=============================
由於controlfile01.ctl所在的diskgroup dg1的redundancy方式是normal,而且
dg1裡面有2個failgroup,事實上儘管controlfile01.ctl繼承了系統自帶的模板
CONTROLFILE的屬性REDUNDANCY:HIGH,但是由於dg1裡目前有2個failgroup,所以
controlfile01.ctl的data copy其實還是2份,也就是normal mirror,而不是HIGH
,這一點從上面的查詢v$asm_file的欄位redundancy_lowered=Y其實也可以看的出來:
檢視v$asm_file的欄位redundancy_lowered的解釋如下:
REDUNDANCY_LOWERED VARCHAR2(1) Indicates whether a file has lower redundancy than what was expected (Y) or not (N). Redundancy is said to have been lowered for a file when one or more data extents in that file are not mirrored at the level specified by the administrator. In case of unprotected files, data extents could be missing altogether. Another possible value for this column is (U), which means that it is unknown.
--==============================
所以說congtrolfile的data copy其實最終還是normal mirror也就是存在2份,但是我們透過
上面的x$kffxp x,v$asm_disk d關聯查詢出來的是3個au,但是我們注意到有1個DISK_KFFXP
=65534,對應的FAILGROUP為null,也說明了這一點,其實其中LXN_KFFXP=2對應的AU目前應該是
一個虛的,下面我們再來增加一塊disk,同事增加一個failgroup,之後看看情況:
--=============================
SQL> alter diskgroup dg1 add disk 'g:asmdiskDISK9' name disk9;

磁碟組已變更。

SQL> select group_number,disk_number,name,failgroup from v$asm_disk
2 where group_number=1
3 order by group_number,disk_number
4 ;

GROUP_NUMBER DISK_NUMBER NAME FAILGROUP
------------ ----------- -------------------- ----------
1 0 DG1_0000 DG1_0001
1 1 DG1_0001 DG1_0001
1 2 DG1_0002 DG1_0002
1 3 DISK9 DISK9

SQL>
--================================
SQL> select group_kffxp,xnum_kffxp,lxn_kffxp,disk_kffxp,failgroup
2 from x$kffxp x,v$asm_disk d
3 where number_kffxp=256 and group_kffxp=1
4 and d.disk_number(+)=x.disk_kffxp
5 and d.group_number(+)=x.group_kffxp
6 order by xnum_kffxp,lxn_kffxp,disk_kffxp,failgroup
7 ;

GROUP_KFFXP XNUM_KFFXP LXN_KFFXP DISK_KFFXP FAILGROUP
----------- ---------- ---------- ---------- ----------
1 0 0 1 DG1_0001
1 0 1 2 DG1_0002
1 0 2 3 DISK9
1 1 0 0 DG1_0001
1 1 1 2 DG1_0002
1 1 2 3 DISK9
1 2 0 2 DG1_0002
1 2 1 0 DG1_0001
1 2 2 3 DISK9
1 3 0 1 DG1_0001
1 3 1 2 DG1_0002

GROUP_KFFXP XNUM_KFFXP LXN_KFFXP DISK_KFFXP FAILGROUP
----------- ---------- ---------- ---------- ----------
1 3 2 3 DISK9
1 4 0 2 DG1_0002
1 4 1 1 DG1_0001
1 4 2 3 DISK9
1 5 0 0 DG1_0001
1 5 1 2 DG1_0002
1 5 2 3 DISK9
1 6 0 2 DG1_0002
1 6 1 0 DG1_0001
1 6 2 3 DISK9
1 7 0 2 DG1_0002

GROUP_KFFXP XNUM_KFFXP LXN_KFFXP DISK_KFFXP FAILGROUP
----------- ---------- ---------- ---------- ----------
1 7 1 1 DG1_0001
1 7 2 3 DISK9

已選擇24行。

SQL>
--============================
新增了一塊disk之後,準確的說是多了一個failgroup:DISK9,從上面查詢可以看的出來系統自動對controlfile做了
HIGH redundancy,同事我們注意到下面查詢v$asm_file的欄位redundancy_lowered的值也變成了N
SQL> select group_number,file_number,type,redundancy,striped,redundancy_lowered from v$asm_file where file_number=256 and group_number=1;

GROUP_NUMBER FILE_NUMBER TYPE REDUNDANCY STRIPED RE
------------ ----------- --------------- ------------ ------------ --
1 256 CONTROLFILE HIGH FINE N

SQL>

--==================================

這裡其實已經非常清楚了,asm file的redundancy方式其實和diskgroup的redundancy沒有太多的關係(除了diskgroup 的external方式),只和diskgroup裡的failgroup的數量有關係。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1045656/,如需轉載,請註明出處,否則將追究法律責任。

相關文章