在已创建好的Diskgroup中增加磁盘,可以为磁盘组增加容量;也可以在磁盘组中删除磁盘,减少容量。
$ export ORACLE_SID=+ASM1
$ export PATH=$PATH:/u01/app/12.1.0/grid/bin/
$ export ORACLE_HOME=/u01/app/12.1.0/grid
以sysadm身份登录Oracle
$ sqlplus / as sysasm
SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 10 17:52:05 2014
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit
Production
With the Real Application Clusters and Automatic Storage Management
options
SQL> select group_number,name from v$asm_diskgroup;
GROUP_NUMBER NAME
------------ ------------------------------
1 DATA1
创建磁盘组ASMGRP, 冗余设为nornal,至少有两个failgroup
SQL> create diskgroup ASMGRP normal redundancy
FAILGROUP fg1 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6A00F6d0s0'
name disk1
FAILGROUP fg2 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6B00F7d0s0'
name disk2
ATTRIBUTE 'au_size'='8M', 'compatible.asm' = '11.2','compatible.rdbms'
= '11.2';
2 3 4
Diskgroup created.
在每个failgroup中增加两个磁盘
SQL> alter diskgroup ASMGRP add
FAILGROUP fg1 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6300EDd0s0'
name disk12
FAILGROUP fg1 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6500F0d0s0'
name disk13
FAILGROUP fg2 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6400EEd0s0'
name disk22
FAILGROUP fg2 DISK '/dev/rdsk/c0t600144F094C10BA3000053641E6600F1d0s0'
name disk23
rebalance power 1;
2 3 4 5 6
Diskgroup altered.
查看磁盘组再平衡的进度
SQL>select group_number,operation,state,power,est_minutes from
v$asm_operation;
GROUP_NUMBER OPERA STAT POWER EST_MINUTES
------------ ----- -------------- -----------
2 REBAL EST1 0
2 REBAL WAIT1 0
2 REBAL WAIT1 0
查看failgroup中的成员,确认磁盘增加成功
SQL> select DISK_NUMBER, name, FAILGROUP, FAILGROUP_TYPE
from v$asm_disk;
DISK_NUMBER NAME
FAILGROUPFAILGRO
----------- ------------------------
--------------------- ----------------
0 REGULAR
1 REGULAR
2 REGULAR
0 DATA1_0000 DATA1_0000REGULAR
2 DISK12
FG1REGULAR
4 DISK22
FG2REGULAR
3 DISK13
FG1REGULAR
5 DISK23
FG2REGULAR
0 DISK11
FG1REGULAR
1 DISK21
FG2REGULAR
10 rows selected.
在每个failgroup中删除一个磁盘
SQL> alter diskgroup ASMGRP drop DISK disk12,disk22 rebalance power
1;
Diskgroup altered.
查看failgroup中的成员,确认磁盘删除成功
SQL> select DISK_NUMBER, name, FAILGROUP, FAILGROUP_TYPE from
v$asm_disk;
DISK_NUMBER NAME FAILGROUPFAILGRO
----------- ------------------------
------------------ ------------
0 REGULAR
1 REGULAR
2 REGULAR
3REGULAR
4REGULAR
0 DATA1_0000 DATA1_0000REGULAR
3 DISK13
FG1REGULAR
5 DISK23
FG2REGULAR
0 DISK11
FG1REGULAR
1 DISK21
FG2REGULAR
10 rows selected.