Disk Array Migration for ASM Databases

This blog identifies the DBA steps required to migrate databases from one disk array to another.
Identify the ASM diskgroups and their disk (LUN) sizes
Login to the ASM instance and identify the LUNs allocated to server.
SQL> SET PAGES 999
SQL> col name format a15

For 11g ASM:

SQL> select d.group_number, g.name, d.os_mb
from v$asm_disk d left outer join v$asm_diskgroup g
on (d.group_number = g.group_number)
order by g.group_number, d.os_mb;

For 10g ASM:

SQL> select d.group_number, g.name, d.total_mb
from v$asm_disk d left outer join v$asm_diskgroup g
on (d.group_number = g.group_number)
order by g.group_number, d.total_mb;

You may discard LUNs with group number 0, as they are not part of any diskgroup. Request Sysadmin team to provision the new LUNs to the server, same LUN size or total of multiple LUNs in the group is equal or more to what is allocated to the group. 

 To find out what is allocated and free in each diskgroup, you may use:
SQL> select name, total_mb, free_mb from v$asm_diskgroup;

Once LUNs are provisioned by Unix team, use OEM or SQL to add the LUNs to respective diskgroups [existing diskgroup]. NO outage required for this step. Remember to login to 11g ASM using the SYSASM privilege, for 10g login using SYSDBA privilege.

SQL> ALTER DISKGROUP ADD DISK ‘/full_path_of_device’;

To find out which LUNs are available to add, you may use SQL:

SQL> col path format a40
SQL> select path, os_mb from v$asm_disk where group_number = 0;
{for 10g ASM, please substitute os_mb with total_mb}
Then, go ahead and drop the old LUNs. No need to wait for the add operation to complete.
SQL> ALTER DISKGROUP DROP DISK name_of_old_LUN;

The name of the LUN can be found by querying the V$ASM_DISK…

SQL> select path,name from v$asm_disk where group_number=3;

Keep the rebalance power low, so that the migration activity does not impact database performance.

You may check the progress of rebalance periodically using V$ASM_OPERATION, once no rows are in this view, you may advice SYSADMIN team to pull out the old LUNs from the server. V$ASM_OPERATION also shows the work so far completed and how long it will take to complete the work.

Rename Diskgroup in ASM

Rename ASM Diskgroup [11gR2]
In 11gR2 it is possible to rename an ASM diskgroup. This is especially useful when performing database copy using OS level LUN mirroring technologies.
The renamedg command is used to rename diskgroups. It has the following options:
$ renamedg -help
Parsing parameters..
phase                           Phase to execute,
                                (phase=ONE|TWO|BOTH), default BOTH
dgname                          Diskgroup to be renamed
newdgname                       New name for the diskgroup
config                          intermediate config file
check                           just check-do not perform actual operation,
                                (check=TRUE/FALSE), default FALSE
confirm                         confirm before committing changes to disks,
                                (confirm=TRUE/FALSE), default FALSE
clean                           ignore errors,
                                (clean=TRUE/FALSE), default TRUE
asm_diskstring                  ASM Diskstring (asm_diskstring=’discoverystring’,
                                ‘discoverystring1’ …)
verbose                         verbose execution,
                                (verbose=TRUE|FALSE), default FALSE
keep_voting_files               Voting file attribute,
                                (keep_voting_files=TRUE|FALSE), default FALSE
To rename a diskgroup, it must be stopped [or unmounted].
$ srvctl stop diskgroup -g oops1
$ renamedg dgname=oops1 newdgname=good1 verbose=true
$ srvctl start diskgroup –g good1
You must manually rename all database files on the diskgroup to reflect the new name using ALTER DATABSE RENAME FILE command.
Even after successful rename command, old diskgroup resources in Oracle Restart must be manually removed using the srvctl command.