ASM磁盘组支持动态扩展,我们可以向现有的磁盘组动态加入新的磁盘,新磁盘加入后,Oracle通过后台RBAL进行Rebalance,将当前的数据均衡到新增加的磁盘上。Drop磁盘亦会Rebalance。

asm_power_limit参数用于控制Rebalance的速度,取值 1~11,数字越大,平衡速度越快,默认值是1。如果该数字很大,则可能因为Rebalance而影响性能。也可以通过在alter diskgroup .. add/drop disk命令中通过rebalance power [1~11]选项控制Rebalance的速度。

 

Ora10gASM-> sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 28 20:11:39 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> col name format a15

SQL> col failgroup format a20

SQL> col path format a30

SQL> select name,failgroup,path from v$asm_disk;

NAME FAILGROUP PATH

--------------- -------------------- ------------------------------

ORCL:VOL4

VOL1 VOL1 ORCL:VOL1

VOL2 VOL2 ORCL:VOL2

VOL3 VOL3 ORCL:VOL3

SQL> select name from v$asm_diskgroup;

NAME

---------------

DATA

FRA

DATA2

SQL> select name,total_mb,free_mb from v$asm_disk;

NAME TOTAL_MB FREE_MB

--------------- ---------- ----------

511 0

VOL1 4094 1872

VOL2 4094 3867

VOL3 511 358

加入磁盘ORCL:VOL4到DATA2磁盘组

SQL> alter diskgroup DATA2 add disk 'ORCL:VOL4' rebalance power 1;

Diskgroup altered.

Rebalance后磁盘空间使用情况

SQL> select name,total_mb,free_mb from v$asm_disk;

NAME TOTAL_MB FREE_MB

--------------- ---------- ----------

VOL1 4094 1872

VOL2 4094 3867

VOL3 511 433
VOL4 511 434

Drop 磁盘操作

SQL> alter diskgroup DATA2 drop disk 'ORCL:VOL4' rebalance power 11;

alter diskgroup DATA2 drop disk 'ORCL:VOL4' rebalance power 11

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15054: disk "ORCL:VOL4" does not exist in diskgroup "DATA2"

SQL> select name,failgroup,path from v$asm_disk;

NAME FAILGROUP PATH

--------------- -------------------- ------------------------------

VOL1 VOL1 ORCL:VOL1

VOL2 VOL2 ORCL:VOL2

VOL3 VOL3 ORCL:VOL3

VOL4 VOL4 ORCL:VOL4

SQL> alter diskgroup DATA2 drop disk 'VOL4' rebalance power 11;

Diskgroup altered.

SQL> select name,failgroup,path from v$asm_disk;

NAME FAILGROUP PATH

--------------- -------------------- ------------------------------

VOL1 VOL1 ORCL:VOL1

VOL2 VOL2 ORCL:VOL2

VOL3 VOL3 ORCL:VOL3

VOL4 VOL4 ORCL:VOL4

SQL> select name,total_mb,free_mb from v$asm_disk;

NAME TOTAL_MB FREE_MB

--------------- ---------- ----------

511 0

VOL1 4094 1872

VOL2 4094 3867

VOL3 511 358

SQL> select name,failgroup,path from v$asm_disk;

NAME FAILGROUP PATH

--------------- -------------------- ------------------------------

ORCL:VOL4

VOL1 VOL1 ORCL:VOL1

VOL2 VOL2 ORCL:VOL2

VOL3 VOL3 ORCL:VOL3

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

Ora10gASM-> ps -ef | grep rbal

oracle 5291 1 0 19:30 ? 00:00:03 asm_rbal_+ASM

oracle 5469 1 0 19:44 ? 00:00:01 ora_rbal_benbo

oracle 5970 4700 0 20:25 pts/1 00:00:00 grep rbal

Ora10gASM->