normal redundancy Diskgroup裡required_mirror_free_mb值的變化規律

oliseh發表於2014-09-29

環境:Oracle 11g R2 GI Standalone Server

實驗目的:v$asm_diskgroup. REQUIRED_MIRROR_FREE_MB值隨不同的Failgroup策略所組成的Normal Redundancy Diskgroup而變化的規律,關於REQUIRED_MIRROR_FREE_MB的取值ASM Guide中是這樣定義的,強調了是在不加儲存的情況下為了能restore redundancy所必須留出的空閒容量:

REQUIRED_MIRROR_FREE_MB indicates the amount of space that must be available in a disk group to restore full redundancy after the worst failure that can be tolerated by the disk group without adding additional storage

ASM disk包括5hdiskpower

/dev/rhdiskpower5      0DCB 09C:1 16B:C10 2-Way Mir     N/Grp'd  (M) RW   46478

/dev/rhdiskpower6      0DCF 09C:1 01D:D4  2-Way Mir     N/Grp'd  (M) RW   46478

/dev/rhdiskpower7      0DD3 09C:1 02C:DA  2-Way Mir     N/Grp'd  (M) RW   46478

/dev/rhdiskpower8      0DD7 09C:1 16A:D12 2-Way Mir     N/Grp'd  (M) RW   46478

/dev/rhdiskpower9      0DDB 09C:1 16D:D1  2-Way Mir     N/Grp'd  (M) RW   46478

 

場景1:兩個Failgroup,每個Failgroup一塊磁碟

create diskgroup chhdg1 normal redundancy disk '/dev/rhdiskpower5','/dev/rhdiskpower6' attribute 'compatible.asm'='11.2.0.0.0';

 

select * from v$asm_diskgroup where name='CHHDG1' --required_mirror_free_mb值為0

     GROUP_NUMBER   NAME       SECTOR_SIZE   BLOCK_SIZE     ALLOCATION_UNIT_SIZE         STATE        TYPE         TOTAL_MB         FREE_MB          HOT_USED_MB       COLD_USED_MB     REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB    OFFLINE_DISKS         COMPATIBILITY        DATABASE_COMPATIBILITY    VOTING_FILES

  1  CHHDG1  512  4096         1048576  MOUNTED       NORMAL 92954       92848       0       106  0       46424       0       11.2.0.0.0         10.1.0.0.0         N

結論:一共只有兩塊盤,壞掉一塊只剩一塊,無論如何都無法實現normal redundancyREQUIRED_MIRROR_FREE_MB=0

 

場景2:兩個Failgroup,第一個Failgroup一塊磁碟,第二個Failgroup兩塊磁碟

drop diskgroup chhdg1;

create diskgroup chhdg1 normal redundancy disk '/dev/rhdiskpower5' failgroup fg1 disk '/dev/rhdiskpower6', '/dev/rhdiskpower7' attribute 'compatible.asm'='11.2.0.0.0';

 

select * from v$asm_diskgroup where name='CHHDG1' --required_mirror_free_mb值為最小的那個failgroup大小

GROUP_NUMBER   NAME       SECTOR_SIZE   BLOCK_SIZE     ALLOCATION_UNIT_SIZE         STATE        TYPE         TOTAL_MB         FREE_MB          HOT_USED_MB       COLD_USED_MB     REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB    OFFLINE_DISKS         COMPATIBILITY        DATABASE_COMPATIBILITY    VOTING_FILES

1       CHHDG1  512  4096         1048576  MOUNTED       NORMAL 139431     139323     0       108  46477       46423       0       11.2.0.0.0         10.1.0.0.0         N

結論:兩個Failgroup是比較特殊的情況, Oracle文件中只提及Normal redundancy disk group with more than two failure groups的情況下會以最大的那個Failgroup大小作為REQUIRED_MIRROR_FREE_MB的值。在此例中可以看到兩個Failgroup 的情況下,以最小的那個Failgroup作為REQUIRED_MIRROR_FREE_MB的取值,所有兩個Failgroup組成的normal redundancy diskgroup對應的REQUIRED_MIRROR_FREE_MB取值一定都是一塊盤的大小。

 

場景3:兩個Failgroup,每個Failgroup各兩塊磁碟

drop diskgroup chhdg1;

create diskgroup chhdg1 normal redundancy failgroup fg1 disk '/dev/rhdiskpower5','/dev/rhdiskpower6' failgroup fg2 disk '/dev/rhdiskpower7','/dev/rhdiskpower8' attribute 'compatible.asm'='11.2.0.0.0';

 

select * from v$asm_diskgroup where name='CHHDG1'

GROUP_NUMBER   NAME       SECTOR_SIZE   BLOCK_SIZE     ALLOCATION_UNIT_SIZE         STATE        TYPE         TOTAL_MB         FREE_MB          HOT_USED_MB       COLD_USED_MB     REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB    OFFLINE_DISKS         COMPATIBILITY        DATABASE_COMPATIBILITY    VOTING_FILES

1       CHHDG1  512  4096         1048576  MOUNTED       NORMAL 185908     185798     0       110  46477       69660       0       11.2.0.0.0         10.1.0.0.0         N

結論:required_mirror_free_mb值為最小的那個failgroup裡一塊盤的大小,之所以不是整個failgroup的大小,REQUIRED_MIRROR_FREE_MB 的值代表了不增加額外儲存的情況下能達到的容錯效果,所以在最保守的情況下當然是能夠在一塊盤Fail的情況下restore redundancy

 

場景4:兩個Failgroup,第一個Failgroup兩塊磁碟,第二個Failgroup三塊磁碟

SQL> drop diskgroup chhdg1;

 

Diskgroup dropped.

 

SQL> create diskgroup chhdg1 normal redundancy failgroup fg1 disk '/dev/rhdiskpower5','/dev/rhdiskpower6' failgroup fg2 disk '/dev/rhdiskpower7','/dev/rhdiskpower8','/dev/rhdiskpower9' attribute 'compatible.asm'='11.2.0.0.0';

 

Diskgroup created.

 

SQL>select name,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where name='CHHDG1'

 

NAME       TOTAL_MB       FREE_MB          REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB

CHHDG1  232385     232273     46477       92898

 

結論:兩個Failgroup的情況下,REQUIRED_MIRROR_FREE_MB只等於failgroup中單塊盤的大小,

 

 

場景5:三個Failgroup,有兩個Failgroup各兩塊磁碟,一個Failgroup只有一塊磁碟

drop diskgroup chhdg1;

create diskgroup chhdg1 normal redundancy failgroup fg1 disk '/dev/rhdiskpower5','/dev/rhdiskpower6' failgroup fg2 disk '/dev/rhdiskpower7','/dev/rhdiskpower8' failgroup fg3 disk '/dev/rhdiskpower9' attribute 'compatible.asm'='11.2.0.0.0';

 

select * from v$asm_diskgroup where name='CHHDG1'

GROUP_NUMBER   NAME       SECTOR_SIZE   BLOCK_SIZE     ALLOCATION_UNIT_SIZE         STATE        TYPE         TOTAL_MB         FREE_MB          HOT_USED_MB       COLD_USED_MB     REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB    OFFLINE_DISKS         COMPATIBILITY        DATABASE_COMPATIBILITY    VOTING_FILES

1       CHHDG1  512  4096         1048576  MOUNTED       NORMAL 232385     232222     0       163  92954       69634       0       11.2.0.0.0         10.1.0.0.0         N

結論:required_mirror_free_mb值為最大的failgroup的大小

 

場景6:三個Failgroup,前兩個Failgroup各一塊磁碟,第三個Failgroup有三塊磁碟

drop diskgroup chhdg1;

create diskgroup chhdg1 normal redundancy failgroup fg1 disk '/dev/rhdiskpower5' failgroup fg2 disk '/dev/rhdiskpower6' failgroup fg3 disk '/dev/rhdiskpower7','/dev/rhdiskpower8','/dev/rhdiskpower9' attribute 'compatible.asm'='11.2.0.0.0';

 

select * from v$asm_diskgroup where name='CHHDG1'

GROUP_NUMBER   NAME       SECTOR_SIZE   BLOCK_SIZE     ALLOCATION_UNIT_SIZE         STATE        TYPE         TOTAL_MB         FREE_MB          HOT_USED_MB       COLD_USED_MB     REQUIRED_MIRROR_FREE_MB      USABLE_FILE_MB    OFFLINE_DISKS         COMPATIBILITY        DATABASE_COMPATIBILITY    VOTING_FILES

1       CHHDG1  512  4096         1048576  MOUNTED       NORMAL 232385     232222     0       163  139431     46395       0       11.2.0.0.0         10.1.0.0.0         N

 

值為最大的failgroup的大小--這個如何解釋?顯然不合情理啊,如何兩個總量小於它的failgroup去冗餘這個最大的Failgroup 

 

 

場景7:兩個Failgroup,第一個Failgroup兩塊磁碟(256M512M),第二個Failgroup三塊磁碟(768M1024M1280M)

SQL>  create diskgroup testdg22 normal redundancy failgroup f1 disk '/dev/rchhlv30','/dev/rchhlv31' failgroup f2 disk '/dev/rchhlv32','/dev/rchhlv33','/dev/rchhlv34' attribute 'compatible.asm'='11.2.0.0.0','compatible.rdbms'='11.2.0.0.0';

Diskgroup created.
SQL> select name,FAILGROUP,total_mb,path from v$asm_disk where group_number=13;

NAME                           FAILGROUP                        TOTAL_MB PATH
------------------------------ ------------------------------ ---------- ----------------------------------------
TESTDG22_0003                  F2                                   1024 /dev/rchhlv33
TESTDG22_0004                  F2                                   1280 /dev/rchhlv34
TESTDG22_0000                  F1                                    256 /dev/rchhlv30
TESTDG22_0001                  F1                                    512 /dev/rchhlv31
TESTDG22_0002                  F2                                    768 /dev/rchhlv32

SQL> select name,required_mirror_free_mb from  v$asm_diskgroup where name='TESTDG22';

NAME                           REQUIRED_MIRROR_FREE_MB
------------------------------ -----------------------
TESTDG22                                          1280

結論:required_mirror_free_mb值為最大的那塊盤的大小,由上面這些例子可以看出當failgroup數量>2時,required_mirror_free_mb值等於最大的那個failgroup大小,當failgroup數量<3時且required_mirror_free_mb!=0的情況下,required_mirror_free_mb值等於最大的那塊盤的大小

 


 詢問oracle community的結果是對於normal/high redundancydiskgroup應該滿足所有FG裡的盤數相等、盤大小相等的設計原則。所以場景6這種情況下是不能保證壞盤情況下還能restore redundancy的要求

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

相關文章