When a disk is dropped, the disk group is rebalanced by moving all of the file extents from the dropped disk
to other disks in the disk group.
Use below syntax to add and drop disks in a single command:
Login into ASM instance as sysasm:
SQL> alter diskgroup <DG_NAME_1> add disk '<disk path>' <DISK_NAME1> drop disk <DISK_NAME_TO_BE_DROPPED>;
Multiple disks can be added and dropped and make sure that the size of the disks to be added and dropped should be the same.
Example:
- Check the candidate disks to be added disk in ASM Diskgroup:
grid@UATDB:~$ sqlplus / as sysasm SQL*Plus: Release 12.1.0.2.0 Production on Wed Nov 16 11:13:44 2022 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> SQL> set line 400 SQL> select DISK_NUMBER, GROUP_NUMBER, HEADER_STATUS,PATH from v$asm_disk; DISK_NUMBER GROUP_NUMBER HEADER_STATU PATH ----------- ------------ ------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0 0 CANDIDATE /dev/rdsk/c1d7s6 1 0 CANDIDATE /dev/rdsk/c1d10s6 2 0 CANDIDATE /dev/rdsk/c1d12s6 3 0 CANDIDATE /dev/rdsk/c1d13s6 4 0 CANDIDATE /dev/rdsk/c1d11s6 5 0 CANDIDATE /dev/rdsk/c1d15s6 6 0 CANDIDATE /dev/rdsk/c1d9s6 0 2 MEMBER /dev/rdsk/c1d18s6 1 2 MEMBER /dev/rdsk/c1d19s6 3 2 MEMBER /dev/rdsk/c1d20s6 2 2 MEMBER /dev/rdsk/c1d21s6 DISK_NUMBER GROUP_NUMBER HEADER_STATU PATH ----------- ------------ ------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 1 MEMBER /dev/rdsk/c1d22s6 4 2 MEMBER /dev/rdsk/c1d23s6 5 2 MEMBER /dev/rdsk/c1d24s6 14 rows selected. --------------------------
2. ADD and Drop disks from and to ‘DATA’ Disk group:
SQL> alter diskgroup DATA add disk '/dev/rdsk/c1d15s6','/dev/rdsk/c1d11s6','/dev/rdsk/c1d13s6','/dev/rdsk/c1d12s6','/dev/rdsk/c1d7s6','/dev/rdsk/c1d9s6' drop disk DATA_0000,DATA_0001,DATA_0002,DATA_0003,DATA_0004,DATA_0005 rebalance power 10;
3.Check the rebalance status:
SQL> select INST_ID, OPERATION, STATE, POWER, SOFAR, EST_WORK, EST_RATE, EST_MINUTES from GV$ASM_OPERATION; INST_ID OPERA STAT POWER SOFAR EST_WORK EST_RATE EST_MINUTES ---------- ----- ---- ---------- ---------- ---------- ---------- ----------- 1 REBAL RUN 10 56121 274196 23946 9 1 REBAL WAIT 10 0 0 0 0 1 REBAL WAIT 10 1 REBAL WAIT 10
4.After finishing the rebalancing the dropped disks status will be changed to ‘Former’:
SQL> set line 400; SQL> / DISK_NUMBER GROUP_NUMBER HEADER_STATU PATH ----------- ------------ ------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0 0 FORMER /dev/rdsk/c1d19s6 1 0 FORMER /dev/rdsk/c1d24s6 7 0 FORMER /dev/rdsk/c1d21s6 6 0 FORMER /dev/rdsk/c1d22s6 5 0 FORMER /dev/rdsk/c1d18s6 4 0 FORMER /dev/rdsk/c1d16s6 3 0 FORMER /dev/rdsk/c1d20s6 2 0 FORMER /dev/rdsk/c1d23s6 1 1 MEMBER /dev/rdsk/c1d10s6 7 2 MEMBER /dev/rdsk/c1d11s6 9 2 MEMBER /dev/rdsk/c1d12s6 DISK_NUMBER GROUP_NUMBER HEADER_STATU PATH ----------- ------------ ------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8 2 MEMBER /dev/rdsk/c1d13s6 6 2 MEMBER /dev/rdsk/c1d15s6 10 2 MEMBER /dev/rdsk/c1d7s6 11 2 MEMBER /dev/rdsk/c1d9s6 15 rows selected. SQL>
5.And the rebalance status will return zero rows:
SQL> select INST_ID, OPERATION, STATE, POWER, SOFAR, EST_WORK, EST_RATE, EST_MINUTES from GV$ASM_OPERATION; no rows selected SQL>