摘自:http://blog.sina.com.cn/s/blog_7c5a82970101fpbd.html
在SQLPLUS中对ASM实例进行操作
<wbr></wbr>
1、查看ASM磁盘组状况
SELECT GROUP_NUMBER, NAME, TYPE, STATE, TOTAL_MB, FREE_MB, OFFLINE_DISKS FROM V$ASM_DISKGROUP;
GROUP_NUMBER NAME<wbr><wbr><wbr><wbr><wbr><wbr>TYPE<wbr><wbr>STATE<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>TOTAL_MB<wbr><wbr><wbr>FREE_MB OFFLINE_DISKS<br> ------------ ---------- ------ ----------- ---------- ---------- -------------<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1 DG1<wbr><wbr><wbr><wbr><wbr><wbr><wbr>NORMAL MOUNTED<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>102365<wbr><wbr><wbr><wbr>102208</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr></wbr>
2、查看ASM磁盘信息
SELECT GROUP_NUMBER, DISK_NUMBER, LABEL, STATE, FAILGROUP, NAME, PATH, TOTAL_MB, FREE_MB FROM V$ASM_DISK;
GROUP_NUMBER DISK_NUMBER LABEL STATE<wbr><wbr><wbr>FAILGROUP<wbr>NAME<br> ------------ ----------- ----- -------- ---------- ----------<br> PATH<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>TOTAL_MB<wbr><wbr><wbr>FREE_MB<br> ------------------------- ---------- ----------<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>4<wbr><wbr><wbr><wbr><wbr><wbr>NORMAL<wbr><wbr>DG1_0004<wbr><wbr>DG1_0004<br> /dev/oracleasm/disks/D5<wbr><wbr><wbr><wbr><wbr><wbr><wbr>20473<wbr><wbr><wbr><wbr><wbr>20443</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>3<wbr><wbr><wbr><wbr><wbr><wbr>NORMAL<wbr><wbr>DG1_0003<wbr><wbr>DG1_0003<br> /dev/oracleasm/disks/D4<wbr><wbr><wbr><wbr><wbr><wbr><wbr>20473<wbr><wbr><wbr><wbr><wbr>20443</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>2<wbr><wbr><wbr><wbr><wbr><wbr>NORMAL<wbr><wbr>DG1_0002<wbr><wbr>DG1_0002<br> /dev/oracleasm/disks/D3<wbr><wbr><wbr><wbr><wbr><wbr><wbr>20473<wbr><wbr><wbr><wbr><wbr>20442</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
GROUP_NUMBER DISK_NUMBER LABEL STATE<wbr><wbr><wbr>FAILGROUP<wbr>NAME<br> ------------ ----------- ----- -------- ---------- ----------<br> PATH<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>TOTAL_MB<wbr><wbr><wbr>FREE_MB<br> ------------------------- ---------- ----------<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr>NORMAL<wbr><wbr>DG1_0001<wbr><wbr>DG1_0001<br> /dev/oracleasm/disks/D2<wbr><wbr><wbr><wbr><wbr><wbr><wbr>20473<wbr><wbr><wbr><wbr><wbr>20439</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>0<wbr><wbr><wbr><wbr><wbr><wbr>NORMAL<wbr><wbr>DG1_0000<wbr><wbr>DG1_0000<br> /dev/oracleasm/disks/D1<wbr><wbr><wbr><wbr><wbr><wbr><wbr>20473<wbr><wbr><wbr><wbr><wbr>20441<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
3、增加磁盘组:
CREATE DISKGROUP dgd NORMAL REDUNDANCY
FAILGROUP failgroup1 DISK
'/dev/raw/raw1' NAME diskA1 SIZE 120G FORCE,
'/dev/raw/raw2',
'/dev/raw/raw3'
FAILGROUP failgroup2 DISK
'/dev/raw/raw4',
'/dev/raw/raw5',
'/dev/raw/raw6';
4、增加fail组:
ALTER DISKGROUP dg1 ADD FAILGROUP fail3 DISK '/dev/raw/raw22' name disk5 REBALANCE POWER 11;
5、添加ASM磁盘:
ALTER DISKGROUP dg1 add failgroup fail1 DISK '/dev/raw/raw19' name disk3;
6、删除ASM磁盘:
ALTER DISKGROUP dg1 DROP DISK disk4;
7、卸载磁盘组,要先关闭安装在ASM上的rdbms数据库实例
ALTER DISKGROUP dg2 DISMOUNT;
8、检测磁盘组或磁盘:
ALTER DISKGROUP dg1 CHECK ALL;
ALTER DISKGROUP DG1 CHECK DISK VOL1;
7、控制均衡容错组数据的速度:
ALTER DISKGROUP dg2 REBALANCE POWER 11;
平衡速度控制参数:
asm_power_limit = 1~11
8、检查数据库平衡速度:
SELECT GROUP_NUMBER, OPERATION, STATE, EST_WORK, SOFAR, EST_RATE, EST_MINUTES FROM V$ASM_OPERATION;
9、删除磁盘组:
DROP DISKGROUP GROUP1 INCLUDING CONTENTS;
10、取消删除:
ALTER DISKGROUP group1 UNDROP DISKS;
11、添加目录:
ALTER DISKGROUP DG1 ADD DIRECTORY '+DG1/ad';
CREATE TABLESPACE T1 DATAFILE '+DG1/ad/t1.dbf' SIZE 100M AUOEXTEND ON;
12、重命名目录:表空间不受任何影响
ALTER DISKGROUP DG1 RENAME DIRECTORY '+DG1/ad' to '+DG1/add';
13、删除目录:
ALTER DISKGROUP DG1 DROP DIRECTORY '+DG1/ad/demo' FORCE;
14、创建别名:
ALTER DISKGROUP DG1 ADD ALIAS '+DG1/ad/spfilead.ora' FOR '+DG1/ad/parameterfile/spfile.269.777212438';
15、重命名别名:
alter diskgroup dg1 rename alias'+DG1/ASMDB/spfile.ora' to '+DG1/ASMDB/spfileasmdb.ora';
16、删除别名:删除别名文件不会被删除
DROP DISKGROUP DG1 DROP ALIAS '+DG1/ASMDB/spfileasmdb.ora';