As downtime (planned and unplanned) trends lower and SLAs continue to increase, it is important to be able maximize online operations as much as possible. In this article, we will be looking at performing a storage upgrade or refresh online, which is possible if you are running on Oracle Automatic Storage Management (ASM).
In order to keep this simple, let’s assume that our database is running on one ASM disk group: DATA. That disk group is composed of one ASM disk: SPINNING. We’re going to create a new disk, FLASH, on our brand new, all-flash storage array. In the example below, you’ll see us migrate from SPINNING to FLASH with no downtime at all.
We’re using ASMLib to manage our ASM infrastructure, so we need to create a new ASM disk to use:
$ oracleasm listdisks
SPINNING
$ oracleasm createdisk FLASH /dev/sdh1
Writing disk header: done
Instantiating disk: done
$ oracleasm listdisks
SPINNING
FLASH
Now that the new ASM disk has been created, we can migrate the database onto the new storage:
SQL> SELECT g.name "Group", d.name "Disk", d.mode_status "Status"
2 FROM v$asm_disk d, v$asm_diskgroup g
3 WHERE d.group_number = g.group_number;
Group Disk Status
------------------------------ ------------------------------ -------
DATA SPINNING ONLINE
SQL> SHOW PARAMETER asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------
asm_diskstring string
SQL> ALTER SYSTEM SET asm_diskstring='ORCL:*' scope=both;
SQL> SET LINESIZE 200 PAGESIZE 2000
SQL> COLUMN PATH FORMAT A30
SQL> SELECT path, header_status, mode_status
2 FROM v$asm_disk;
PATH HEADER_STATU MODE_ST
----------------------------- ------------ -------
ORCL:FLASH PROVISIONED ONLINE
ORCL:SPINNING MEMBER ONLINE
Now we can add the new disk to the disk group:
SQL> ALTER DISKGROUP data ADD DISK 'ORCL:FLASH' REBALANCE POWER 11;
Diskgroup altered.
SQL> SELECT group_number, operation, est_minutes
2 FROM v$asm_operation;
GROUP_NUMBER OPERA EST_MINUTES
------------ ----- -----------
2 REBAL 33
Depending on the size of the database and the rebalance power used, it could take a while to complete the operation. It is also extremely important to note that a higher rebalance power could impact performance on the database itself, so use it wisely.
Once the rebalance operation is complete, the old disk can be dropped from the disk group:
SQL> ALETR DISKGROUP data DROP DISK spinning REBALANCE POWER 11;
Diskgroup altered.
SQL> SELECT g.name "Group", d.name "Disk", d.mode_status "Status"
2 FROM v$asm_disk d, v$asm_diskgroup g
3 WHERE d.group_number = g.group_number;
Group Disk Status
------------------------------ ------------------------------ -------
DATA SPINNING OFFLINE
DATA FLASH ONLINE
SQL> SELECT group_number, operation, est_minutes
2 FROM v$asm_operation;
GROUP_NUMBER OPERA EST_MINUTES
------------ ----- -----------
2 REBAL 20
Once the second rebalance operation is complete, you will see the SPINNING disk no long appears with the DATA disk group and can be dropped from the O/S:
SQL> SELECT g.name "Group", d.name "Disk", d.mode_status "Status"
2 FROM v$asm_disk d, v$asm_diskgroup g
3 WHERE d.group_number = g.group_number;
Group Disk Status
------------------------------ ------------------------------ -------
DATA FLASH ONLINE
SQL> exit
$ oracleasm listdisks
SPINNING
FLASH
$ oracleasm deletedisk SPINNING
Clearing disk header: done
Dropping disk: done
$ oracleasm listdisks
FLASH