Wednesday, December 2, 2015

Creating ASM Diskgroups

In this article I would explain how to create new ASM diskgroups. Process is same for Unix based platforms or Windows systems, and also for other Oracle versions.
Before we move forward, you may have a look at my articles related to
stamping ASM disks on windows and creating ASM disks using ASMLib on Linux to know how we create disks which are used for ASM diskgroups.
Log into the system as Grid Infrastructure software owner (ORA_DBA OS group member on Windows), and connect to the ASM instance as SYSASM user
[grid@salman1 ~]$ sqlplus /nolog

SQL*Plus: Release Production on Wed Dec 2 14:21:25 2015

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

SQL> conn sys as sysasm
Enter password:

Query v$asm_disk to list all available disks that can be used to create a diskgroup.
SQL> select path,header_status,state,os_mb from v$asm_disk;

PATH                 HEADER_STATU      STATE              OS_MB
-------------------- ------------ -------- ----------     ---------------------------
ORCL:DISK5           FORMER              NORMAL         4094
ORCL:DISK1           FORMER              NORMAL         4094
ORCL:DISK2           FORMER              NORMAL         4094
ORCL:DISK10         PROVISIONED  NORMAL         4094
ORCL:DISK4           FORMER              NORMAL         4094
ORCL:DISK8           FORMER              NORMAL         4094
ORCL:DISK6           FORMER              NORMAL         4094
ORCL:DISK3           FORMER              NORMAL         4094
ORCL:DISK7           FORMER              NORMAL         4094
ORCL:DISK9           FORMER              NORMAL         4094

We see here total 10 disks having 4G size each (these are virtual disks on my virtual machine). Header status is FORMER if this disk was already part of a diskgroup, and PROVISIONED if this is a new disk.

External Redundancy Diskgroup

Now we create an ASM disk group with external redundancy which means that mirroring will not be done at ASM level. We create diskgroups with external redundancy if we are handling mirroring at RAID level for fault tolerance.

ATTRIBUTE 'compatible.asm' = '', 'compatible.rdbms' = '';

SQL> select group_number,name,type,total_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                           TYPE             TOTAL_MB
------------ ------------------------------ ------ ----------------------------------------
           2 DATA                                               EXTERN       8188
compatible.asm attributes specifies the diskgroup compatibility with the ASM version. compatible.asm= would mean that we can utilize all the ASM options introduced in compatible.rdbms is used to specify the version of database that can be stored in this diskgroup.
lsdg command of ASMCMD can also be used to see the information of the diskgroup.
[grid@salman1 ~]$ asmcmd
ASMCMD> lsdg data
State               Type         Rebal   Sector  Block    AU             Total_MB    Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED   EXTERN  N         512      4096      1048576     8188             8132          0                             8132                      0                      N                   DATA/

Failure Groups in Normal or High Redundancy Diskgroups

We specify failure groups while creating a diskgroup. If we don’t specify failure groups then each disk would be in its own failure group. For example if we create a normal redundancy diskgroup with 10 disks and don’t specify any failure groups; each disk would be in its own failure group, and 2 copies of each ASM extent (not database extent) would be maintained on any 2 different disks. In case of High Redundancy Diskgroup, 3 copies would be maintained on 3 different disks.
If we specify failure groups; suppose 5 disks in failuregroup1 and 5 disks in failuregroup2, one copy of ASM extent would be on any of the 5 disks in failuregroup1 and second copy would be on any disk in failuregroup2.
Usually we group disks together in a failure group that have tendency of failing together. For example if we have 2 disk controllers having 5 disks each, we would like to group disks in controller 1 together in failure group 1 and disks in controller 2 together in failure group 2. This way there will be 2 mirrored copies of each ASM extent are maintained on different disk controller’s disks. If controller 1 fails and all disks are not accessible, second copy of ASM extent would remain accessible from other failure group that is on controller 2 

Normal Redundancy Diskgroup

In a diskgroup with normal redundancy; 2 copies of each ASM extent (not database extent) are maintained on 2 different disks in 2 different failure groups. Normal redundancy diskgroup requires at least 2 failure groups.
ATTRIBUTE 'compatible.asm' = '', 'compatible.rdbms' = '';

High Redundancy Diskgroup

In a diskgroup with high redundancy; 3 copies of each ASM extent (not database extent) are maintained on 3 different disks in 3 different failure groups. High redundancy diskgroup requires at least 3 failure groups.

create diskgroup data high redundancy failgroup failuregroup1 disk 'ORCL:DISK1','ORCL:DISK2','ORCL:DISK3'
failgroup failuregroup2 disk 'ORCL:DISK4','ORCL:DISK5','ORCL:DISK6'
failgroup failuregroup3 disk 'ORCL:DISK7','ORCL:DISK8','ORCL:DISK9' ;

No comments:

Post a Comment