发表于: 2008.05.24 16:42
分类: ORACLE
出处: http://fbirdzp.itpub.net/post/5714/462716
---------------------------------------------------------------
- ASM提供的数据保护级别(level of redundancy)
ASM在创建DISK GROUP时,提供了以下3种级别的冗余镜像来保护数据。
- NORMAL REDUNDANCY Two-way mirroring, requiring two failure groups.提供2路镜像保护,也是ASM的默认方式,需要2组failure group。
- HIGH REDUNDANCY- Three-way mirroring, requiring three failure groups.
提供3路镜像,需要2组failure group。 - EXTERNAL REDUNDANCY- No mirroring for disks that are already protected using hardware mirroring or RAID.ORACLE不提供多路镜像保护,而是通过外部存储的镜像或RAID技术实现数据冗余保护。
- ASM的命令行
主机export 到ASM的环境后,ASM提供了asmcmd的接口进入ASM的命令行。
Oracle10g版本上,ASM的命令行提供了'ls -l', 'cd','find','rm'共4组命令。
- ASM INSTANCE的常用SQL
A. DISKGROUP相关操作
-- Create DISKGROUP
- 创建diskgroup,如果没有指明,默认是normal redundancy
- 前面提到多路镜像需要创建多组failuer group。在执行创建diskgroup的SQL语句时,如果省略了failuer group的部分,并且你选择的是normal或high redundancy,则ASM同样会默认创建failure group
- 创建external redundancy级别的diskgroup时,因为不需要镜像,所以SQL语句中也不能添加failure group部分。
需要注意的是:
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
- ASM 对physical disk做了stripe,所有的数据读写IO是平均分配在各块盘上的,数据分布也是平均的。当添加或删除一块盘的时候,ASM会重新rebalance所有的数据。
- ARBx进程负责rebalance diskgroup的资源。而参数ASM_POWER_LIMIT参数控制 ASM 后台进程ARBx的数量,你可以从0至11进行选择,默认是1。
- rebalance是非常消耗IO资源的,所以加盘减盘一定要慎重。
- undrop 操作必须是在drop掉disk后rebalance操作还没完成之前进行。
- 如果不指明,ASM按照默认的power值自动rebalance。rebalance时会生成标记为RBAL的trac文件;如果没有,检查alert.log及ASM_POWER_LIMIT参数,进行手工rebalance。命令如下:
SQL>alter diskgroup diskgroup_name rebalance power N;
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
注意:
- 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.
ASM(Automatic Storage Management )是ORACLE10g以后推出的新特性,它能协助DBA简化管理数据库controlfile,logfile,datafile的存储。可以说,它简化了DBA的工作.
可以把ASM理解为一个简单的INSTANCE,它有自己的ORACLE_SID。实际上,ASM INSTANCE管理的就是裸设备,它通过DISK GROUP管理各个物理盘(physical disk),并将各个physical disk标记为自己识别的ASM DISK NAME。











