ITPub博客

首页 > 数据库 > Oracle > Oracle ASM 的redundancy与failgroup

Oracle ASM 的redundancy与failgroup

Oracle 作者:pentium 时间:2018-12-21 10:49:24 0 删除 编辑

redundancy与failgroup



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

 





 

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个磁盘创建1个failgroup组。

 
指明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;

 
---------------------
作者:bamuta
来源:CSDN
原文:https://blog.csdn.net/bamuta/article/details/32120945
版权声明:本文为博主原创文章,转载请附上博文链接!

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

上一篇: SCAN
请登录后发表评论 登录
全部评论

注册时间:2010-09-30

  • 博文量
    191
  • 访问量
    286554