ASM如何删除/增加磁盘
1,进入asm环境
[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 5 14:22:46 2011
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, Real Application Clusters, OLAP and Data Mining options
2,查看当前的状态
SQL> select group_number, name, total_mb, free_mb, total_mb-free_mb used_mb from v$asm_disk_stat;
GROUP_NUMBER NAME TOTAL_MB FREE_MB USED_MB
------------ ------------------------------ ---------- ---------- ----------
0 1019 0 1019
0 101 0 101
0 101 0 101
1 DATA_0001 1019 565 454
1 DATA_0000 3067 2129 938
SQL> select name, total_mb, free_mb from v$asm_disk_stat;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
1019 0
101 0
101 0
DATA_0001 1019 565
DATA_0000 3067 2129
SQL> select * from v$asm_operation;
no rows selected
3,开始删除磁盘DATA_0001
SQL> alter diskgroup data drop disk DATA_0001;
Diskgroup altered.
4,磁盘做rebalance操作
SQL> select * from v$asm_operation
2 ;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES
-----------
1 REBAL RUN 1 1 67 453 390
0
SQL> set linesize 200;
SQL> /
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 1 1 167 456 414 0
SQL> select name, total_mb, free_mb from v$asm_disk_stat;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
1019 0
101 0
101 0
DATA_0001 1019 732
DATA_0000 3067 1962
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 1 1 381 454 411 0
5,继续等待磁盘已经删除
SQL> select * from v$asm_operation;
no rows selected
SQL> select * from v$asm_operation;
no rows selected
SQL> select name, total_mb, free_mb from v$asm_disk_stat;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
1019 0
101 0
101 0
DATA_0000 3067 1677
SQL> select path,group_number, disk_number,mount_status,header_status,mode_status,state from v$asm_disk;
PATH GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST STATE
---------------------------------------- ------------ ----------- ------- ------------ ------- --------
/dev/raw/raw5 0 0 CLOSED FORMER ONLINE NORMAL
/dev/raw/raw3 0 1 CLOSED CANDIDATE ONLINE NORMAL
/dev/raw/raw2 0 2 CLOSED FOREIGN ONLINE NORMAL
/dev/raw/raw1 0 4 CLOSED FOREIGN ONLINE NORMAL
/dev/raw/raw4 1 0 CACHED MEMBER ONLINE NORMAL
6,增加一个asm磁盘
SQL> ALTER DISKGROUP DATA ADD DISK '/dev/raw/raw5';
Diskgroup altered.
SQL> select path,group_number, disk_number,mount_status,header_status,mode_status,state from v$asm_disk;
PATH GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST STATE
---------------------------------------- ------------ ----------- ------- ------------ ------- --------
/dev/raw/raw3 0 1 CLOSED CANDIDATE ONLINE NORMAL
/dev/raw/raw2 0 2 CLOSED FOREIGN ONLINE NORMAL
/dev/raw/raw1 0 4 CLOSED FOREIGN ONLINE NORMAL
/dev/raw/raw5 1 1 CACHED MEMBER ONLINE NORMAL
/dev/raw/raw4 1 0 CACHED MEMBER ONLINE NORMAL
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 1 1 181 350 501 0
SQL> select name, total_mb, free_mb from v$asm_disk_stat;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
1019 0
101 0
101 0
DATA_0001 1019 671
DATA_0000 3067 2023
SQL> select * from v$asm_operation;
no rows selected