ITPub博客

受困于v$asm_dksigroup里的字段REQUIRED_MIRROR_FREE_MB!

原创 IT综合 作者:warehouse 时间:2011-02-12 11:56:38 0 删除 编辑
这个字段困扰了我很久,现在理解的也是稀里糊涂的,记录一个测试过程和大致的结论。[@more@]

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- -------------------- ----------------------------------------
1024 730 DISK2 DG1_0001 G:ASMDISKDISK2
2048 1494 DG1_0002 DG1_0002 G:ASMDISKDISK1
512 365 DISK12 DG1_0002 G:ASMDISKDISK12
1024 747 DISK11 DG1_0003 G:ASMDISKDISK11
2048 1518 DG1_0003 DG1_0003 G:ASMDISKDISK14
512 362 DG1_0004 DG1_0004 G:ASMDISKDISK13

已选择6行。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 7168 5216 3072 1072

SQL> alter diskgroup dg1 add failgroup DG1_0005 disk 'g:asmdiskdisk15' name DISK15;

磁盘组已变更。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 10668 8714 3500 2607

SQL> alter diskgroup dg1 add failgroup DG1_0006 disk 'g:asmdiskdisk16' name DISK16;

磁盘组已变更。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 14168 12212 3500 4356

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 14168 12212 3500 4356

SQL> alter diskgroup dg1 rebalance;

磁盘组已变更。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 14168 12212 3500 4356

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- -------------------- ----------------------------------------
1024 879 DISK2 DG1_0001 G:ASMDISKDISK2
2048 1765 DG1_0002 DG1_0002 G:ASMDISKDISK1
512 437 DISK12 DG1_0002 G:ASMDISKDISK12
1024 880 DISK11 DG1_0003 G:ASMDISKDISK11
2048 1766 DG1_0003 DG1_0003 G:ASMDISKDISK14
512 437 DG1_0004 DG1_0004 G:ASMDISKDISK13
3500 3025 DISK15 DG1_0005 G:ASMDISKDISK15
3500 3023 DISK16 DG1_0006 G:ASMDISKDISK16

已选择8行。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
-------------------- ---------- ---------- ----------------------- --------------
NORMAL 14168 12212 3500 4356

SQL>
我不知道oracle是如何计算REQUIRED_MIRROR_FREE_MB 的值的,如何才能使REQUIRED_MIRROR_FREE_MB 变成0,diskgroup 1目前可用空间是12212 ,但是由于oracle考虑了diskgroup 组里的disk failure之后的mirror redundancy情况,所以通过dbca使用diskgroup 1时真实的可用空间只有 4356

4356=(12212 - 3500)/2

--=======================================
SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 879 DISK2 DG1_0001 G:ASMDISKDISK2
2048 1765 DG1_0002 DG1_0002 G:ASMDISKDISK1
512 437 DISK12 DG1_0002 G:ASMDISKDISK12
1024 880 DISK11 DG1_0003 G:ASMDISKDISK11
2048 1766 DG1_0003 DG1_0003 G:ASMDISKDISK14
512 437 DG1_0004 DG1_0004 G:ASMDISKDISK13
3500 3025 DISK15 DG1_0005 G:ASMDISKDISK15
3500 3023 DISK16 DG1_0006 G:ASMDISKDISK16

已选择8行。

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 14168 12212 3500 4356

--==================================================
--此处省略大约78个字...
--把disk都删除只剩下disk15和disk16,这2块disk都是3500m,而且分别在2个failgroup里,目前required_mirror_free_mb变成了0
--==================================================
SQL> alter diskgroup dg1 drop disk DG1_0003;

磁盘组已变更。

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
3500 2572 DISK15 DG1_0005 G:ASMDISKDISK15
3500 2572 DISK16 DG1_0006 G:ASMDISKDISK16

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 7000 5144 0 2572
--================================
--下面增加2块1g的disk继续测试,3500的disk太大了,rebalance有些慢
SQL> alter diskgroup dg1 add failgroup DG1_0008 disk 'G:asmdiskDISK20' name DISK20;

磁盘组已变更。

SQL>
SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
3500 2661 DISK15 DG1_0005 G:ASMDISKDISK15
3500 2661 DISK16 DG1_0006 G:ASMDISKDISK16
1024 756 DISK20 DG1_0008 G:ASMDISKDISK20

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 8024 6078 3500 1289

SQL>
SQL> alter diskgroup dg1 add failgroup DG1_0009 disk 'G:asmdiskDISK22' name DISK22;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
3500 2751 DISK15 DG1_0005 G:ASMDISKDISK15
3500 2751 DISK16 DG1_0006 G:ASMDISKDISK16
1024 798 DISK20 DG1_0008 G:ASMDISKDISK20
1024 800 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 9048 7100 3500 1800

SQL> alter diskgroup dg1 drop disk DISK16;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
3500 2572 DISK15 DG1_0005 G:ASMDISKDISK15
1024 515 DISK20 DG1_0008 G:ASMDISKDISK20
1024 515 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 5548 3602 3500 51

SQL>
SQL> alter diskgroup dg1 drop disk DISK15;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 96 DISK20 DG1_0008 G:ASMDISKDISK20
1024 96 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 2048 192 0 96

SQL>
--==================================
上面查询结果已经显示目前有2个failgroup,里面分别有1块大小为1g的disk,目前REQUIRED_MIRROR_FREE_MB为0,
否则REQUIRED_MIRROR_FREE_MB的值就是failgroup里disk总和最大的那个值...有些不可思议...
--===================================
SQL> alter diskgroup dg1 add failgroup DG1_00010 disk 'G:asmdiskDISK23' name DISK23;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 376 DISK23 DG1_00010 G:ASMDISKDISK23
1024 375 DISK20 DG1_0008 G:ASMDISKDISK20
1024 375 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 3072 1126 1024 51

SQL>
SQL> alter diskgroup dg1 add failgroup DG1_00011 disk 'G:asmdiskDISK24' name DISK24;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 536 DISK23 DG1_00010 G:ASMDISKDISK23
1024 539 DISK24 DG1_00011 G:ASMDISKDISK24
1024 536 DISK20 DG1_0008 G:ASMDISKDISK20
1024 537 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 4096 2148 1024 562

SQL>
--=====================================
--上面又增加了2个failgroup,里面分别有1块1g的disk,required_mirror_free_mb依然不为0
--=====================================
SQL> alter diskgroup dg1 drop disk DISK24;

Diskgroup altered.

SQL> alter diskgroup dg1 drop disk DISK23;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 96 DISK20 DG1_0008 G:ASMDISKDISK20
1024 96 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 2048 192 0 96

SQL>
--===================================
SQL> alter diskgroup dg1 add failgroup DG1_0008 disk 'G:ASMDISKDISK25' name DISK25;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 558 DISK20 DG1_0008 G:ASMDISKDISK20
1024 560 DISK25 DG1_0008 G:ASMDISKDISK25
1024 96 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 3072 1214 1024 95

SQL>
SQL> alter diskgroup dg1 add failgroup DG1_0009 disk 'G:ASMDISKDISK26' name DISK26;

Diskgroup altered.

SQL> select total_mb,free_mb,name,failgroup,path from v$asm_disk where group_number=1 order by failgroup;

TOTAL_MB FREE_MB NAME FAILGROUP PATH
---------- ---------- -------------------- ---------- ------------------------------
1024 559 DISK25 DG1_0008 G:ASMDISKDISK25
1024 559 DISK20 DG1_0008 G:ASMDISKDISK20
1024 560 DISK26 DG1_0009 G:ASMDISKDISK26
1024 558 DISK22 DG1_0009 G:ASMDISKDISK22

SQL> select type,total_mb,free_mb,required_mirror_free_mb,usable_file_mb from v$asm_diskgroup where group_number=1;

TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------------ ---------- ---------- ----------------------- --------------
NORMAL 4096 2236 1024 606

SQL>
--===================================
--上面分别又往failgroup里添加了2块1g大小的disk,REQUIRED_MIRROR_FREE_MB还是1024,我无法理解oracle
是如何考虑REQUIRED_MIRROR_FREE_MB的?
--====================================
--最后只能得出一个这样的结论:要想不"浪费空间",所谓的不浪费空间就是指REQUIRED_MIRROR_FREE_MB为0,
那么在normal type的redundancy方式下,我们只能做2个failgroup,同时每个failgroup里只能有1块disk;
如果是high type的redundancy方式下,我觉得应该是3个failgroup,同时每个failgroup里只能有1块disk。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-1045887/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-07

  • 博文量
    715
  • 访问量
    5058949