Wednesday, December 26, 2007

Add/Remove Disks from ASM disk group on live database

ASM will allow the adding and removing of volumes from a disk group while disk group is still in use by a database. This will allow the replacement of disk volumes from olds disk to new without having to bring the database down.

Steps:

1. Find out or disk groups

SQL> select group_number, name from v$asm_diskgroup ;
GROUP_NUMBER NAME
------------ ------------------------------
1 P1CSM2_ASM_DG1

SQL>


2. Find the disk volumes that make up the ASM diskgroup that we want to work with. In this example we will be replacing the 3 old disk volumes with 3 new ones.

SQL> select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ;

DISK_NUMBER MODE_ST NAME
----------- ------- ------------------------------
PATH
-----------------------------------------------------------
0 ONLINE P1CSM2_ASM_DG1_0000
/dev/rhdisk2
1 ONLINE P1CSM2_ASM_DG1_0001
/dev/rhdisk3
2 ONLINE P1CSM2_ASM_DG1_0002
/dev/rhdisk4

SQL>

3. Make sure our new volumes can be seen by asm as our disk string will be different.

SQL> alter system set ASM_DISKSTRING='/dev/rhdisk*','/dev/rrawlv*' scope=both ;

System altered.

SQL>

4. Add new disks to our disk group

SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 ADD DISK '/dev/rrawlv01' NAME P1CSM2_ASM_DG1_0010 NOFORCE ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- ----------

EST_RATE EST_MINUTES
-------- -----------

1 REBAL RUN 1 1 910 1167
1577 0

SQL> select * from v$asm_operation ; no rows selected SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 ADD DISK '/dev/rrawlv02' NAME P1CSM2_ASM_DG1_0011 NOFORCE ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------
EST_RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 413 1881
1498 0

SQL> select * from v$asm_operation ;

no rows selected

SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 ADD DISK '/dev/rrawlv03' NAME P1CSM2_ASM_DG1_0012 NOFORCE ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------
EST_RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 254 1786
1514 1

SQL> select * from v$asm_operation ;

no rows selected

SQL>


5. Check that our new disk volumes are now part of our disk group.

SQL> select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ;

DISK_NUMBER MODE_ST NAME
----------- ------- ------------------------------
PATH
-----------------------------------------------------------
0 ONLINE P1CSM2_ASM_DG1_0000
/dev/rhdisk2
1 ONLINE P1CSM2_ASM_DG1_0001
/dev/rhdisk3
2 ONLINE P1CSM2_ASM_DG1_0002
/dev/rhdisk4
3 ONLINE P1CSM2_ASM_DG1_0010
/dev/rrawlv01
4 ONLINE P1CSM2_ASM_DG1_0011
/dev/rrawlv02
5 ONLINE P1CSM2_ASM_DG1_0012
/dev/rrawlv03

6 rows selected.

SQL>


6. Remove the disks we want to remove from the group
SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 DROP DISK P1CSM2_ASM_DG1_0000 ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------

EST_RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 548 2884

1588 1

SQL> select * from v$asm_operation ;


no rows selected

SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 DROP DISK P1CSM2_ASM_DG1_0001 ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------

EST RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 906 3274

1731 1


SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------

EST_RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 3020 3226

1972 0


SQL> select * from v$asm_operation ;

no rows selected

SQL> ALTER DISKGROUP P1CSM2_ASM_DG1 DROP DISK P1CSM2_ASM_DG1_0002 ;

Diskgroup altered.

SQL> select * from v$asm_operation ;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK
------------ ----- ---- ----- ------ ----- --------

EST_RATE EST_MINUTES
-------- -----------
1 REBAL RUN 1 1 1513 3197

1957 0

SQL> select * from v$asm_operation ; no rows selected SQL>



7. Check the removal of the disk volumes.
SQL> select disk_number, mode_status, name, path from v$asm_disk where group_number = 1 order by disk_number, name ;


DISK_NUMBER MODE_ST NAME
----------- ------- ------------------------------
PATH
------------------------------------------------------------------
3 ONLINE P1CSM2_ASM_DG1_0010
/dev/rrawlv01
4 ONLINE P1CSM2_ASM_DG1_0011
/dev/rrawlv02
5 ONLINE P1CSM2_ASM_DG1_0012
/dev/rrawlv03

SQL>

2 comments:

sap implementation guide said...

You can add or remove disks from ASM disk group on live database and this is the best feature of ASM. The code is written for both adding and removing disks in this post. The code is easy so you don't find it difficult to implement.

Satya Thirumani said...

Thanks..
nice steps

-Satya
http://satya-dba.blogspot.com/2010/03/automatic-storage-management-asm-10g.html