Oracle ASM 的redundancy与failgroup

12 篇文章 0 订阅

redundancy与failgroup

 

1.关于redundancy 与fail group官方说明

 

http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5008.htm#SQLRF53929

http://docs.oracle.com/cd/E11882_01/server.112/e18951/toc.htm

 

REDUNDANCYClause

The REDUNDANCY clause lets you specify theredundancy level of the disk group.

  • NORMAL REDUNDANCY requires the existence of at least two failure groups (see the FAILGROUP clause that follows). Oracle ASM provides redundancy for all files in the disk group according to the attributes specified in the disk group templates. NORMAL REDUNDANCY disk groups can tolerate the loss of one group. Refer to ALTER DISKGROUP ... diskgroup_template_clauses for more information on disk group templates.

NORMAL REDUNDANCY is the default if you omitthe REDUNDANCY clause.Therefore, if you omit this clause, you must create at least two failuregroups, or the create operation will fail.

  • HIGH REDUNDANCY requires the existence of at least three failure groups. Oracle ASM fixes mirroring at 3-way mirroring, with each extent getting two mirrored copies. HIGH REDUNDANCY disk groups can tolerate the loss of two failure groups.
  • EXTERNAL REDUNDANCY indicates that Oracle ASM does not provide any redundancy for the disk group. The disks within the disk group must provide redundancy (for example, using a storage array), or you must be willing to tolerate loss of the disk group if a disk fails (for example, in a test environment). You cannot specify the FAILGROUP clause if you specify EXTERNAL REDUNDANCY.

FAILGROUPClause

·        Use this clause to specify a name for one or more failuregroups. If you omit this clause, and you have specified NORMAL or HIGH REDUNDANCY, then Oracle Database automatically adds each disk in thedisk group to its own failure group. The implicit name of the failure groupis the same as the operating system independent disk name (see "NAME Clause").

·        You cannot specify this clause if you are creating an EXTERNAL REDUNDANCY disk group.

 

2.说明

         一直在使用ASM,这2个概念也是经常用到,但有时有些混乱,搞不清楚它们之间的关系。今天通过实验来理一下思路。

redundancy

指的是diskgroup的failgroup的冗余级别(注意并不是disk的冗余),冗余通过failgroup实现。

Normal: 至少要2个failgroup。

Diskgroup的可用大小:如果是2个或3个failgroup组,则是(单个failgroup的大小)-(mirror消耗/fiailgroup数)的大小。如果是4个,则是上面的结果的2倍。

 

High:       至少要3个failgroup。

Diskgroup的可用大小:如果是3个或小于6个failgroup组,则是(单个failgroup的大小)-(mirror消耗/fiailgroup数)的大小。如果是6个,则是上面的结果的2倍。

 

 

External :          ASM级不使用冗余。Diskgroup的可用大小等于所有disk的和。

 

在external可以指定failgroup吗?

·        Youcannot specify this clause if you are creating an EXTERNAL REDUNDANCY disk group.

failgroup:

上面normal和high时要用到,也可以不明确写,不指定时,每1个disk当成1个failgroup。

 

3.相关视图说明:

V$asm_diskgroup视图中部分字段说明

GROUP_NUMBER NAME            TOTAL_MBREQUIRED_MIRROR_FREE_MB    FREE_MBUSABLE_FILE_MB ALLOCATION_UNIT_SIZE

------------ ------------- --------------------------------- ---------- -------------- --------------------

 

Total_MB就是diskgroup里所有的disk的空间总和,和mirror没有任何关系
Free_MB是diskgroup里所有的disk的free空间总和,和mirror也没有任何关系
REQUIRED_MIRROR_FREE_MB考虑了mirorr,是指为了使diskgroup能在一个或多个磁盘损坏后能够restore冗余(redundancy),磁盘组中应该保留的剩余空间.

USABLE_FILE_MB:当前实际可以用的空间,此大小是镜像完后的大小再减去已经使用的大小。

 

TOTAL_MB NUMBER Total capacity of the diskgroup (in megabytes) 
FREE_MB NUMBER Unused capacity of the disk group (in megabytes) 
REQUIRED_MIRROR_FREE_MB NUMBER Amount of space that is required to be availablein a given disk group in order to restore redundancy after one or more diskfailures. The amount of space displayed in this column takes mirroring effectsinto account. 
USABLE_FILE_MB NUMBER Amount of free space that can be safely utilized takingmirroring into account, and yet be able to restore redundancy after a diskfailure 

 

4.实验测试:

共有9块盘用于测试,从/dev/asm-diske到/dev/asm-diskm  。每块的大小均为1G。

[grid@OEL63 grid]$ sqlplus / as sysasm

col GROUP_NUMBER for 999

col DISK_NUMBER for 999

col NAME for a13

col FAILGROUP for a13

col PATH for a20

set lines 1000

 

SQL> select * from V$version;

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE   11.2.0.3.0      Production

TNS for Linux: Version 11.2.0.3.0 -Production

NLSRTL Version 11.2.0.3.0 - Production

EXTERNAL

 

SQL> create diskgroup data1  external redundancy disk '/dev/asm-diske';

SQL> create diskgroup data2external redundancy disk '/dev/asm-diskf','/dev/asm-diskg';

SQL> create diskgroup data3 external redundancy disk'/dev/asm-diskh','/dev/asm-diski','/dev/asm-diskj';

 

SQL> select group_number,name, TOTAL_MB, REQUIRED_MIRROR_FREE_MB, FREE_MB , USABLE_FILE_MB,ALLOCATION_UNIT_SIZE fromV$asm_diskgroup;

 

SQL> select group_number,disk_number,name,failgroup,create_date,path fromv$asm_disk order by  FAILGROUP;

 疑惑:normal下为何为生成不同的failgroup组名?

 

 

External下不支持failgroup

 

SQL> create diskgroup data2b externalredundancy failgroup fail1 disk '/dev/asm-diskf','/dev/asm-diskg';

create diskgroup data2b external redundancyfailgroup fail1 disk '/dev/asm-diskf','/dev/asm-diskg'

*

ERROR at line 1:

ORA-15018: diskgroup cannot be created

ORA-15067: command or option incompatiblewith diskgroup redundancy

SQL> create diskgroup data2b externalredundancy failgroup fail1 disk '/dev/asm-diskf','/dev/asm-diskg'

 2  failgroup fail2 disk'/dev/asm-diskm','/dev/asm-diskj';

create diskgroup data2b external redundancyfailgroup fail1 disk '/dev/asm-diskf','/dev/asm-diskg'

*

ERROR at line 1:

ORA-15018: diskgroup cannot be created

ORA-15067: command or option incompatiblewith diskgroup redundancy

 

NORMAL
不指明failgroup创建不同的磁盘组

drop diskgroup data1;

drop diskgroup data2;

drop diskgroup data3;

SQL> create diskgroup datan1 normalredundancy disk '/dev/asm-diske','/dev/asm-diskf';

SQL> create diskgroup datan2 normalredundancy

disk '/dev/asm-diskg','/dev/asm-diskh','/dev/asm-diski';

SQL> create diskgroup datan3 normalredundancy

disk '/dev/asm-diskj','/dev/asm-diskk','/dev/asm-diskl','/dev/asm-diskm';

查看大小

SQL> select group_number,name, TOTAL_MB, REQUIRED_MIRROR_FREE_MB, FREE_MB , USABLE_FILE_MB,ALLOCATION_UNIT_SIZE fromV$asm_diskgroup;

再来看看使用后的变化情况

SQL> create tablespace data3 datafile '+DATAN3/QING/datafile/data301.dbf'size 10m;

SQL> conn tan/tan

SQL> create table test1 tablespace data3as select * from dba_objects;

查看failgroup

SQL> selectgroup_number,disk_number,name,failgroup,create_date,path

from v$asm_disk order by  FAILGROUP;

不明确写明failgroup时,将为每 1个磁盘创建1failgroup组。

 

指明failgroup创建不同的磁盘组

SQL> drop tablespace data3 includingcontents and datafiles;

drop diskgroup datan1;

drop diskgroup datan2;

drop diskgroup datan3;

 

SQL> create diskgroup datan1 normalredundancy

   failgroup faildg1 disk '/dev/asm-diske' name fail1

   failgroup faildg2 disk '/dev/asm-diskf' name fail2;

 

SQL> create diskgroup datan2 normalredundancy

   failgroup faildg1 disk '/dev/asm-diskg' namefail1

   failgroup faildg2 disk '/dev/asm-diskh' namefail2

   failgroup faildg3 disk '/dev/asm-diski' namefail3;  

 

SQL> create diskgroup datan3 normalredundancy

    failgroup fail1 disk '/dev/asm-diskm','/dev/asm-diskj'

failgroup fail2disk '/dev/asm-diskk','/dev/asm-diskl';

 

drop前做一次查询,查询结果在后面一起列出。

drop diskgroup datan1;

drop diskgroup datan2;

drop diskgroup datan3;

 

SQL> create diskgroup datan4 normalredundancy

   failgroup faildg1 disk '/dev/asm-diskg' namefail1

   failgroup faildg2 disk '/dev/asm-diskh' namefail2

   failgroup faildg3 disk '/dev/asm-diski' namefail3

failgroup faildg4 disk '/dev/asm-diske' name fail4;  

 

查看failgroup

SQL> selectgroup_number,disk_number,name,failgroup,create_date,path

from v$asm_disk order by  group_number;

查看大小

SQL> select group_number,name, TOTAL_MB, REQUIRED_MIRROR_FREE_MB, FREE_MB , USABLE_FILE_MB,ALLOCATION_UNIT_SIZE fromV$asm_diskgroup;

Normal redundancy得至少2个fail group

 

SQL> create diskgroup data1 normalredundancy disk '/dev/asm-diske';

 create diskgroup data3 normal redundancy disk'/dev/asm-diske'

*

ERROR at line 1:

ORA-15018: diskgroup cannot be created

ORA-15072: command requires at least 2regular failure groups, discovered only 1

 

HIGH

drop diskgroup datan4;

SQL> create diskgroup datah1 highredundancy

   failgroup faildg1 disk '/dev/asm-diske' name fail1

failgroupfaildg2 disk '/dev/asm-diskf' name fail2

   failgroup faildg3 disk '/dev/asm-diskg' name fail3;

SQL> create diskgroup datah2 highredundancy

   failgroup faildg1 disk '/dev/asm-diskh' name failh21

failgroupfaildg2 disk '/dev/asm-diski' name failh22

   failgroup faildg3 disk '/dev/asm-diskj' name failh23

failgroup faildg4disk '/dev/asm-diskk' name failh24;

 

drop前做一次查询,查询结果在后面一起列出。

 

drop diskgroup datah1;

drop diskgroup datah2;

SQL> create diskgroup datah3 highredundancy

failgroup faildg1 disk '/dev/asm-diske'name fail1

failgroup faildg2 disk '/dev/asm-diskf'name fail2

failgroup faildg3 disk '/dev/asm-diskg'name fail3

failgroup faildg4 disk '/dev/asm-diskh'name fail4

failgroup faildg5 disk '/dev/asm-diski'name fail5;

 

drop diskgroup datah3;

SQL> create diskgroup datah4high redundancy

failgroup faildg1 disk'/dev/asm-diske' name fail1

failgroup faildg2 disk'/dev/asm-diskf' name fail2

failgroup faildg3 disk'/dev/asm-diskg' name fail3

failgroup faildg4 disk'/dev/asm-diskh' name fail4

failgroup faildg5 disk'/dev/asm-diski' name fail5

failgroup faildg6 disk'/dev/asm-diskj' name fail6;

 

drop diskgroup datah4;

create diskgroup datah5 highredundancy

failgroup fail1 disk'/dev/asm-diskm','/dev/asm-diskj'

failgroup fail2 disk'/dev/asm-diskk','/dev/asm-diskl'

failgroup fail3 disk'/dev/asm-diske','/dev/asm-diskf';

 

drop diskgroup datah5;

create diskgroup datah6 high redundancy

failgroup fail1 disk '/dev/asm-diskm','/dev/asm-diskj','/dev/asm-diskg'

failgroup fail2 disk '/dev/asm-diskk','/dev/asm-diskl','/dev/asm-diskh'

failgroup fail3 disk '/dev/asm-diske','/dev/asm-diskf','/dev/asm-diski';

 

查看failgroup

SQL> selectgroup_number,disk_number,name,failgroup,create_date,path

from v$asm_disk order by  group_number,failgroup;

 

查看大小

SQL> select group_number,name, TOTAL_MB, REQUIRED_MIRROR_FREE_MB, FREE_MB , USABLE_FILE_MB,ALLOCATION_UNIT_SIZE fromV$asm_diskgroup;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值