Tuesday, February 28, 2012

How to Add/Drop Disk in ASM

Its not that quite often your SA asks you to release one of the disks that you been using it for a while for your database but if they do then you need to know how to remove the disk and add a new disk from your ASM.

Here are the steps to Add and Drop a Disk from ASM Diskgroup. Note that asm_power_limit parameter once set is permanent as it writes to both spfile as well (check alert log when you do alter session set asm_power_limit = 10 command to see that it converts it into scope=both).

What's asm_power_limit parameter? 
In simple words, Think that you are increasing the work force to finish the job (re-balancing the disk(s)) quicker. You can read more in Oracle Docs.

OK, Coming to simple steps to Add a Disk:

  1. Assign the disk to ORACLEASM
    1. /etc/init.d/oracleasm createdisk TIER2_DATA03 /dev/mapper/mpath14p1
  2. ScanDisk in ALL NODES
    1. /etc/init.d/oracleasm scandisks
  3. Check the header_status in v$asm_disks to make sure that the disk can be added (check below for each status description)
    1. Login as sqlplus / as sysasm – note SYSASM here… (for 11g)
    2. set lines 200
    3. select group_number, substr(path,1,20) path, substr(name,1,20) disk_name, total_mb, free_mb, state, header_status, mode_status from v$asm_disk;
  4. Now Add the Disk to diskgroup.
    1. alter diskgroup TIER2_DATA add disk 'ORCL:TIER2_DATA03'; --At this point the new disk is added to the group and Re-Balancing is occurring in the background (basically spreading the data across all the disks along with the new one in that diskgroup)
  5. Check the status in v$asm_operations for rebalancing action.
    1. select * from v$asm_operation;
  6. You are ready to start using the new disk.
  7. Drop the old Disk
    1. alter diskgroup TIER2_DATA drop disk TIER2_DATA01; --At this point, all the data on disk that you are dropping is being distributed to other disks within that diskgroup.
    2. select *from v$asm_operation; --to check the status on rebalancing while dropping the disk
  8. Once dropped from ASM, delete from oracleasm library:
    1. [root@ndhdbd1 disks]# /etc/init.d/oracleasm deletedisk TIER2_DATA01
  9. Removing ASM disk "TIER2_DATA01":                          [  OK  ]
  10. ScanDisk in ALL NODES
    1. /etc/init.d/oracleasm scandisks
V$ASM_DISK Header_Status Info:

  • UNKNOWN - Automatic Storage Management disk header has not been read
  • CANDIDATE - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement
  • INCOMPATIBLE - Version number in the disk header is not compatible with the Automatic Storage Management software version.
  • PROVISIONED - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement. The PROVISIONED header status is different from the CANDIDATE header status in that PROVISIONED implies that an additional platform-specific action has been taken by an administrator to make the disk available for Automatic Storage Management.
  • MEMBER - Disk is a member of an existing disk group. No attempt should be made to add the disk to a different disk group. The ALTER DISKGROUP statement will reject such an addition unless overridden with the FORCE option
  • FORMER - Disk was once part of a disk group but has been dropped cleanly from the group. It may be added to a new disk group with the ALTER DISKGROUP statement.
  • CONFLICT - Automatic Storage Management disk was not mounted due to a conflict
  • FOREIGN - Disk contains data created by an Oracle product other than ASM. This includes datafiles, logfiles, and OCR disks.


 

No comments:

Post a Comment