Fbird.zp
===========================================================
ASM学习
===========================================================
ASM初学。

    ASM(Automatic Storage Management )ORACLE10g以后推出的新特性,它能协助DBA简化管理数据库controlfilelogfiledatafile的存储。可以说,它简化了DBA的工作.

    可以把ASM理解为一个简单的INSTANCE,它有自己的ORACLE_SID。实际上,ASM INSTANCE管理的就是裸设备,它通过DISK GROUP管理各个物理盘(physical disk),并将各个physical disk标记为自己识别的ASM DISK NAME

  1. ASM提供的数据保护级别(level of redundancy)

    ASM在创建DISK GROUP时,提供了以下3种级别的冗余镜像来保护数据。

    • NORMAL REDUNDANCY Two-way mirroring, requiring two failure groups.提供2路镜像保护,也是ASM的默认方式,需要2failure group
    • HIGH REDUNDANCY- Three-way mirroring, requiring three failure groups.
      提供3路镜像,需要2failure group
    • EXTERNAL REDUNDANCY- No mirroring for disks that are already protected using hardware mirroring or RAID.ORACLE不提供多路镜像保护,而是通过外部存储的镜像或RAID技术实现数据冗余保护。
  2. ASM的命令行

    主机export ASM的环境后,ASM提供了asmcmd的接口进入ASM的命令行。

    Oracle10g版本上,ASM的命令行提供了'ls -l', 'cd','find','rm'4组命令。

  3. ASM INSTANCE的常用SQL

    A. DISKGROUP相关操作

    -- Create DISKGROUP

      需要注意的是:

    1. 创建diskgroup,如果没有指明,默认是normal redundancy
    2. 前面提到多路镜像需要创建多组failuer group。在执行创建diskgroupSQL语句时,如果省略了failuer group的部分,并且你选择的是normalhigh redundancy,则ASM同样会默认创建failure group
    3. 创建external redundancy级别的diskgroup时,因为不需要镜像,所以SQL语句中也不能添加failure group部分。
    4. SQL>CREATE DISKGROUP dgroup_name DISK 'disk1','disk2';

    --Drop diskgroup

    SQL>DROP DISKGROUP diskgroup_name INCLUDING CONTENTS;

    B. disk相关操作

    --Add/drop a disk to/from diskgroup

      SQL> alter diskgroup diskgroup_name add disk '/dev/rhdisk1' rebalance power N; ---add a disk

      SQL> alter diskgroup diskgroup_name drop disk disk_name rebalance power N; ---drop a disk

      SQL> alter diskgroup diskgroup_name undrop disk disk_name ; ---undrop disk

      注意:

    1. ASM physical disk做了stripe,所有的数据读写IO是平均分配在各块盘上的,数据分布也是平均的。当添加或删除一块盘的时候,ASM会重新rebalance所有的数据。
    2. ARBx进程负责rebalance diskgroup的资源。而参数ASM_POWER_LIMIT参数控制 ASM 后台进程ARBx的数量,你可以从011进行选择,默认是1
    3. rebalance是非常消耗IO资源的,所以加盘减盘一定要慎重。
    4. undrop 操作必须是在dropdiskrebalance操作还没完成之前进行。
    5. 如果不指明,ASM按照默认的power值自动rebalancerebalance时会生成标记为RBALtrac文件;如果没有,检查alert.log及ASM_POWER_LIMIT参数,进行手工rebalance。命令如下:

      SQL>alter diskgroup diskgroup_name rebalance power N;

  4. ASM里的常用视图

    View

    ASM Instance

    DB Instance

    V$ASM_ALIAS

    Displays a row for each alias present in every disk group mounted by the ASM instance.

    Returns no rows

    V$ASM_CLIENT

    Displays a row for each database instance using a disk group managed by the ASM instance.

    Displays a row for the ASM instance if the database has open ASM files.

    V$ASM_DISK

    Displays a row for each disk discovered by the ASM instance, including disks which are not part of any disk group.

    Displays a row for each disk in disk groups in use by the database instance.

    V$ASM_DISKGROUP

    Displays a row for each disk group discovered by the ASM instance.

    Displays a row for each disk group mounted by the local ASM instance.

    V$ASM_FILE

    Displays a row for each file for each disk group mounted by the ASM instance.

    Displays no rows.

    V$ASM_OPERATION

    Displays a row for each file for each long running operation executing in the ASM instance.

    Displays no rows.

    V$ASM_TEMPLATE

    Displays a row for each template present in each disk group mounted by the ASM instance.

    Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communicates.

fbirdzp 发表于:2008.05.24 16:42 ::分类: ( ORACLE ) ::阅读:(82次) :: 评论 (0)

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...