We know what is ASM in Oracle. Today we have look on diskgroups. In this article we have discussed the technical definition on ASM  diskgroup in first two paragraphs after that we have the steps which we use to add ASM diskgroup
The main components of ASM are diskgroups, each of which comprises of several physical disks that are controlled as a single unit. The physical disks are known as ASM disks, while the files that reside on the disks are known as ASM files. The locations and names for the files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
 
Diskgroup is a terminology used for a logical structure which holds the database files. Each diskgroup consists of disks/raw devices where the files are actually stored. Any ASM file (and it’s redundant copy) is completely contained within a single diskgroup. A diskgroup might contain files belonging to several databases and a single database can use files from multiple diskgroups.

Adding a disk to an ASM diskgroup is really simple, just an alter command. But when if you are doing this in a production database, then before adding we have to make sure that the disk is healthy.

We will follow below steps to confirm that the disk is healthy.

1.First, create the disk using ASMLIB

# /etc/init.d/oracleasm createdisk DATA02 /dev/mapper/mpathagp1
Marking disk "DATA02" as an ASM disk: [ OK ]

-- Do Scandisk on the all the nodes (if RAC)

/etc/init.d/oracleasm scandisks

-- check whether the disk DATA02 has been created.

/etc/init.d/oracleasm listdisk

NOTE – If this is Solaris or HP, then the 1st step is not required, as it doesn’t need ASMLIB.

2. Check the visibility of the disks at OS level🙁 as grid owner from all the nodes)

dd if=/dev/oracleasm/disks/DATA02 of=/dev/null count=100 bs=8192

3. Use kfed to read the disks:(as grid owner from all the nodes)

kfed read /dev/oracleasm/disks/DATA02

If you are getting an error like kfbh.type: 0 ; 0x002: KFBTYP_INVALID, then you can ignore it safely.

4. Now create a diskgroup for testing purpose:

CREATE DISKGROUP TESTDG EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/DATA02';

5. Create a tablespace on this diskgroup:

SQL>Create tablespace TEST_TS datafile '+TESTDG' size 5G;

Tablespace created

As tablespace created, we can confirm that the disk is healthy. We can clean the diskgroup.
6.Let’s drop the tablespace and the diskgroup:

DROP TABLESPACE TEST_TS;

ALTER DISKGROUP TESTDG DISMOUNT; --(from all the ASM instances, except from one).

DROP DISKGROUP TESTDG; --(from the ASM instance, which the diskgroup is still mounted).

Note:- If you try to drop the diskgroup, without dismounting the diskgroup from all instance, except one, then you will hit the error.

ORA-15073: diskgroup TESTDG is mounted by another ASM instance

Now we have cleaned up diskgroup, after confirming that disk is perfectly healthy. So let’s proceed and add that disk to your required existing diskgroup.

7.Add the disk to existing diskgroup:

SQL> ALTER DISKGROUP PROD_DG ADD DISK '/dev/oracleasm/disks/DATA02';

About The Author

Comments

  1. MD salman

    Asm instances should be in mount status while adding diskgroups ?
    When can we add a disk to diskgroup and
    Weather asm instance should in mount or open ? Plz help on thanks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.