Monday, February 4, 2013

Adding new ASM disk into existing diskgroup.

Note : My Below demonstrations is based on SOLARIS box.

Adding a new disk into existing Diskgroup is quite simple but before that we need to check the consistency of that new disk.
Get the New ASM disk information like below. A newly created ASM disk header status will be of CANDIDATE in all unix box and PROVISONED on Linux.
Since my host is based on Unix box the header status is on CANDIDATE.

SQL> select path,os_mb/1024,header_Status from v$asm_Disk where header_Status!='MEMBER';

PATH                                               OS_MB/1024 HEADER_STATU
-------------------------------------------------- ---------- ------------
/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0  99.9941406 CANDIDATE
/dev/rdsk/c5t600601606F402D00BE1B9579B244E211d0s0  99.9941406 CANDIDATE
Before to add any new disk into existing diskgroup or while creating a new diskgroup, we need create a dummy diskgroup with that new disks and check If we are able to mount it successfully if we don't get any issue then the is no issue with these disk and it can be added into diskgroup.

To create dummy disk group do the following:

oracle:+ASM@soltst01 /oracle > sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Wed Jan 30 01:55:50 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL>select name Diskgroup,round(total_mb/1024,2) "Total_TB",round(free_mb/1024,2) "Free_GB",round(((free_mb/total_mb)*100),2) "Available%" from v$asm_diskgroup;

DISKGROUP    Total_GB    Free_GB Available%
---------- ---------- ---------- ----------
ARCHLOG            50      49.88      99.76
LOG2               10       9.68      96.87
LOG1               10       9.68      96.87
DATAFILE       299.98      41.17      13.73

SQL> select path,os_mb/1024,header_Status from v$asm_Disk where header_Status!='MEMBER';

PATH                                               OS_MB/1024 HEADER_STATU
-------------------------------------------------- ---------- ------------
/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0  99.9941406 CANDIDATE
/dev/rdsk/c5t600601606F402D00BE1B9579B244E211d0s0  99.9941406 CANDIDATE

SQL> create diskgroup siva_test_DG external redundancy disk '/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0','/dev/rdsk/c5t600601606F402D00BE1B9579B244E211d0s0';

Diskgroup created.

SQL> select name,state from v$asm_Diskgroup;

NAME          STATE
------------- --------
ARCHLOG       MOUNTED
LOG2          MOUNTED
LOG1          MOUNTED
DATAFILE      MOUNTED
SIVA_TEST_DG  MOUNTED


SQL> drop diskgroup SIVA_TEST_DG;

Diskgroup dropped.

SQL> select path,os_mb/1024,header_Status from v$asm_Disk where header_Status!='MEMBER';

PATH                                               OS_MB/1024 HEADER_STATU
-------------------------------------------------- ---------- ------------
/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0  99.9941406 FORMER
/dev/rdsk/c5t600601606F402D00BE1B9579B244E211d0s0  99.9941406 FORMER
As you can see after removing above two disks from diskgroup the disk's header status has changed to FORMER.
ASM disk with the header status of Former indicates that those disk were already part of the diskgroup and now it can be added into existing diskgroup or New diskgroup.

Now we can add that new disk into existing diskgroup with appropriate rebalance power limit.

Note: Please be caution while using value for power limit parameter. It should be given based on number of CPU available on the host.
SQL> alter diskgroup DATAFILE add disk '/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0' rebalance power 6;

Diskgroup altered.

After we issued above command we can monitor the rebalance operation by queriyng v$asm_operation view.

SQL> Select operation, state, power, est_rate, est_minutes, round((sofar/EST_WORK)*100,2) pct_comp  From v$asm_operation;

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       4912           2      16.72

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       4119           3      19.81

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       4280           2       27.3

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       4418           2       31.4

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       4477           2       37.4

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       5080           1      41.26

SQL> /

OPERA STAT      POWER   EST_RATE EST_MINUTES   PCT_COMP
----- ---- ---------- ---------- ----------- ----------
REBAL RUN           6       5014           1      55.99

SQL> /

no rows selected
When it returns "no rows selected" which means that there is no re-balance activity currently in progress.
SQL>select name Diskgroup,round(total_mb/1024,2) "Total_TB",round(free_mb/1024,2) "Free_GB",round(((free_mb/total_mb)*100),2) "Available%" from v$asm_diskgroup;

DISKGROUP    Total_GB    Free_GB Available%
---------- ---------- ---------- ----------
ARCHLOG            50      49.88      99.76
LOG2               10       9.68      96.87
LOG1               10       9.68      96.87
DATAFILE       399.97     141.16      35.29

SQL> select path,os_mb/1024,header_Status from v$asm_Disk where group_number=4;

PATH                                               OS_MB/1024 HEADER_STATU
-------------------------------------------------- ---------- ------------
/dev/rdsk/c5t600601606F402D001E157973B244E211d0s0  99.9941406 MEMBER
/dev/rdsk/c5t600601606F402D0020157973B244E211d0s0  99.9941406 MEMBER
/dev/rdsk/c5t600601606F402D0022157973B244E211d0s0  99.9941406 MEMBER
/dev/rdsk/c5t600601606F402D00C01B9579B244E211d0s0  99.9941406 MEMBER
After we add the new disk DATAFILE diskgroup capacity got increased and header status of that new disk also got changed to MEMBER!

I Hope this article helped to you. I am expecting your suggestions/feedback.

7 comments:

  1. Can you please tell me How to add a datafile to an existing Disk Suppose disk name is '+DATAFILE' and diskgroup is ASM_DG_DATA

    ReplyDelete
    Replies
    1. Hi Ram,

      You can use below sql to add new DF to existing DG.

      DG Name : ASM_DG_DATA
      TBS Name : Users

      SQL> alter tablespace users add datafile '+ASM_DG_DATA(datafile)' size 10g;

      while adding new DF to existing DG you just need to specify the DG name followed by the file type.
      you dont need to worry about DISK name!.

      Regards,
      Sivakumar

      Delete
    2. Hello Shivakumar Can you please tell me what happens, if the objects(Tables,views,...) are going to max extens

      Delete
  2. Hi Ram,

    Datafiles in ASM storage is similar to DF's in Filesystem storage. Once DF has been created, it can grow upto its max size after that it will trow error like "Unable to extend Table".

    Regards,
    Sivakumar

    ReplyDelete
    Replies
    1. Hi Shivakumar
      can you please tell me how we can switchover from a two node RAC Environment to a single instance database ,both system are in asm.

      Delete