Oracle ASM Diskgroups : Create and Alter diskgroup

Last updated on May 15th, 2019 at 05:26 pm

Oracle ASM Diskgroups

Once the disks are discovered, a diskgroup can be created that will encapsulate one or more of these disks.
It is collection of disks that can managed as logical unit.A diskgroup, which is the highest-level data structure in ASM, is comparable to a LVM’s volume group.The creation of a diskgroup involves the validation of the disks to be added. These disks must have the
following attributes:
o Cannot already be in use by another diskgroup
o Must not have a pre-existing ASM header
o Cannot have an Oracle file header (from a Oracle raw device datafile)

What happen behind the scene when the diskgroup is created

1) After Disk group is created, metadata is stored in SGA on each disk header and include Creation data,Disk Group name and Redundancy type is stored in SGA and on each Disk header
2)When a diskgroup becomes mounted, ASM registers the diskgroup name, the instance name, and the
corresponding Oracle Home path name with Cluster Synchronization Services (CSS). This registered data
is then used by the database instance to build the TNS connect string

How to create the Oracle ASM diskgroups

After the ASM disks are prepared, we can create the diskgroup using below syntax

CREATE DISKGROUP <disk group name> EXTERNAL REDUNDANCY DISK '<YOUR CANDIDATE DISK>';

Example

CREATE DISKGROUP TEST EXTERNAL REDUNDANCY DISK '/dev/rhdisk4','/dev/rhdisk5','/dev/rhdisk6','/dev/rhdisk7';

ALTER DISKGROUP TEST MOUNT;

How to add disk to Oracle ASM diskgroups

ALTER DISKGROUP DATA ADD DISK '/dev/rhdisk10' REBALANCE POWER 10;

ALTER DISKGROUP TEST ADD DISK '/dev/rhdisk10','/dev/rhdisk11','/dev/rhdisk12' REBALANCE POWER 10;

How to drop disk from Oracle ASM diskgroups

First identify the disk to be dropped

col name format a12
col path format a25
col mount_status format a7
col header_status format a12
col mode_status format a7
col state format a8
SELECT D.NAME, D.PATH, D.MOUNT_STATUS, D.HEADER_STATUS, D.MODE_STATUS, D.STATE
FROM V$ASM_DISK D, V$ASM_DISKGROUP G
WHERE G.NAME = '&1'
AND D.GROUP_NUMBER = G.GROUP_NUMBER;

Now after you have identify the name of the disk to be dropped

ALTER DISKGROUP DATA DROP DISK  ;

ALTER DISKGROUP DATA DROP DISK DATA_000 ;

Some good Queries

1) Suppose you have added few disk in diskgroup and Now you want to know the status of it,then following query would be useful

col name format a12
col path format a25
col mount_status format a7
col header_status format a12
col mode_status format a7
col state format a8
SELECT D.NAME, D.PATH, D.MOUNT_STATUS, D.HEADER_STATUS, D.MODE_STATUS, D.STATE
FROM V$ASM_DISK D, V$ASM_DISKGROUP G
WHERE G.NAME = '&1'
AND D.GROUP_NUMBER = G.GROUP_NUMBER;

2) Adding new disks to an existing ASM disk group.

ALTER DISKGROUP DATA ADD DISK '/asmdisks/ctdgg'  ;

3) Resizing an ASM disk group.

ALTER DISKGROUP DATA RESIZE ALL SIZE 2000M;

4) Check all disks in a specific disk group; don’t repair them — even if a problem is found

ALTER DISKGROUP DATA CHECK ALL NOREPAIR;

5) Check a specific disk in a specific disk group, and repair the disk if needed

ALTER DISKGROUP DATA CHECK DISK dg_5 ;

6) Manually rebalancing an ASM disk group

ALTER DISKGROUP DATA REBALANCE POWER 10;

7) Mounting and dismounting ASM disk groups

ALTER DISKGROUP DATA DISMOUNT;
ALTER DISKGROUP DATA MOUNT;

8) “Undrop” a recently-dropped disk

ALTER DISKGROUP DATA UNDROP DISK DATA_005 ;

Related Links

Oracle ASM (Automatic Storage Management ) Introduction and How it works

ASM Initialization Parameters: ASM_DISKSTRING,ASM_DISKGROUPS

Top 46 Oracle ASM Interview Questions

How to prepare the Oracle ASM disks

How Oracle ASM Rebalance works

How ASM Failure Groups and CSS provides high availability

Leave a Reply