You are on page 1of 6

What's ASM and how it works?

This article provides a general insight on working of Oracle ASM and the associated admin tasks.
Oracle ASM is a volume manager and a file system for Oracle database files that supports
single-instance Oracle Database and Oracle Real Application Clusters (Oracle RAC)
configurations.
Oracle ASM uses disk groups to store data files; an Oracle ASM disk group is a collection of
disks that Oracle ASM manages as a unit. Within a disk group, Oracle
ASM exposes a file system interface for Oracle database files. The content of files that are stored
in a disk group is evenly distributed to eliminate hot spots and to provide uniform performance
across the disks. The performance is comparable to the performance of raw devices.
The Oracle ASM normal and high redundancy disk groups enable two-way and three-way
mirroring respectively. You can use external redundancy to
enable a Redundant Array of Independent Disks (RAID) storage subsystem to perform the
mirroring protection function.
You can add or remove disks from a disk group while a database continues to access files from
the disk group. When you add or remove disks from a disk group, Oracle ASM automatically
redistributes the file contents and eliminates the need for downtime when redistributing the
content.
Oracle ASM also uses the Oracle Managed Files (OMF) feature to simplify database file
management. OMF automatically creates files in designated locations. OMF also names files and
removes them while relinquishing space when tablespaces or files are deleted.

Oracle ASM Files


Files that are stored in Oracle ASM disk groups are called Oracle ASM files. Each Oracle ASM
file is contained within a single Oracle ASM disk group. Oracle Database communicates with
Oracle ASM in terms of files. This is similar to the way Oracle Database uses files on any file
system. You can store the various file types in Oracle ASM disk groups, including:
Control files
Data files, temporary data files, and data file copies
SPFILEs
Online redo logs, archive logs, and Flashback logs
RMAN backups
Disaster recovery configurations
Change tracking bitmaps
Data Pump dumpsets

Striping in ASM explained :

Oracle ASM striping has two primary purposes:


To balance loads across all of the disks in a disk group
To reduce I/O latency

Coarse-grained striping provides load balancing for disk groups while fine-grained striping
reduces latency for certain file types by spreading the load more widely.
Lets first understand how the files are stored in ASM.
The lowest level of granularity in ASM in "Allocation Unit " (AU) . When you create a disk group,
you can set the Oracle ASM allocation unit size with the AU_SIZE disk group attribute. The
values can be 1, 2, 4, 8, 16, 32, or 64 MB, depending on the specific disk group compatibility
level. Larger AU sizes typically provide performance advantages for data warehouse applications
that use large sequential reads
Next comes the EXTENT . All files in ASM are stored as set or collection of extents. An extent is
made up of multiple Allocations units (AU) . Each extent fits in one single disk. To accommodate
increasingly larger files, Oracle ASM uses variable size extents.
OK with the above AU and Extents explained, lets continue with Striping :
To stripe data, Oracle ASM separates files into stripes and spreads data evenly across all of the
disks in a disk group. The fine-grained stripe size always equals 128 KB in any configuration; this
provides lower I/O latency for small I/O operations. The coarse-grained stripe size is always
equal to the AU size (not the data extent size).
Figures 1 is illustrations of Oracle ASM file striping. In both illustrations, the allocation unit size
has been set to 1 M (AU_SIZE = 1M) for the disk
group which consists of 8 disks. The Oracle ASM instance is release 11.2 and the disk group
compatibility attributes for ASM and RDBMS have been set to 11.2, so variable extents are
shown in the graphic

Figure 1

Discovering Disks in ASM


The disk discovery process locates the operating system names for disks that Oracle ASM can
access. Disk discovery finds all of the disks that comprise a disk group to be mounted. The set of
discovered disks also includes disks that could be added to a disk group.

An Oracle ASM instance requires an ASM_DISKSTRING initialization parameter value to specify


its discovery strings. Only path names that the Oracle ASM instance has permission to open are
discovered. The exact syntax of a discovery string depends on the platform, ASMLIB libraries,
and whether Oracle Exadata disks are used.
For example:
For general storage :
For Exadata:

ASM_DISKSTRING = '/dev/raw/disk*'
ASM_DISKSTRING = 'o/*/data*'

Make sure to change the device permissions to read/write and ownership to grid:asmadmin or
oracle:dba ( the owner of the disk devices should be the same as the owner of the Oracle binary
software. The group ownership should be OSDBA of the Oracle ASM instance, which is defined
at installation)
How to maintain it?
Lets talk about some general administrative tasks that you would be doing.

Some useful queries


Checking which instances are served by the ASM and which diskgroups belong to which DB,
with V$ASM_CLIENT view
SQL> SELECT dg.name AS diskgroup, SUBSTR(c.instance_name,1,12) AS instance,
SUBSTR(c.db_name,1,12) AS dbname, SUBSTR(c.SOFTWARE_VERSION,1,12) AS software,
SUBSTR(c.COMPATIBLE_VERSION,1,12) AS compatible
FROM V$ASM_DISKGROUP dg, V$ASM_CLIENT c
WHERE dg.group_number = c.group_number;

Checking which disks belong to the Diskgroups with v$ASM_DISKGROUP and v$ASM_DISK
SQL> SELECT SUBSTR(d.name,1,16) AS asmdisk, d.mount_status, d.state,
dg.name AS diskgroup FROM V$ASM_DISKGROUP dg, V$ASM_DISK d
WHERE dg.group_number = d.group_number;

Check available free space in disk groups


SQL> select group_number "Group", disk_number "Disk",
path "Path", header_status,
trunc(free_mb/1024) "Free GB",
trunc(total_mb/1024) "Total GB",
round(free_mb/total_mb, 3)*100 "Pct Free"
from v$asm_disk
/

Viewing Intelligent Data Placement information with V$ASM_FILE


SQL> SELECT dg.name AS diskgroup, f.file_number, f.primary_region, f.mirror_region,
f.hot_reads,

f.hot_writes, f.cold_reads, f.cold_writes


FROM V$ASM_DISKGROUP dg, V$ASM_FILE f
WHERE dg.group_number = f.group_number and dg.name = 'DATA';

Create GRID Disks


For Exadata only :
CellCLI> CREATE GRIDDISK ALL PREFIX=sales, size=75G
Create Disk Groups
The SQL statement in Example below creates a disk group named data with normal redundancy
consisting of two failure groups controller1 or controller2 with
four disks in each failure group. The data disk group is typically used to store database data files.
Creating the DATA disk group
CREATE DISKGROUP data NORMAL REDUNDANCY
FAILGROUP controller1 DISK
'/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2,
'/devices/diska3' NAME diska3,
'/devices/diska4' NAME diska4
FAILGROUP controller2 DISK
'/devices/diskb1' NAME diskb1,
'/devices/diskb2' NAME diskb2,
'/devices/diskb3' NAME diskb3,
'/devices/diskb4' NAME diskb4
ATTRIBUTE 'au_size'='4M',
'compatible.asm' = '11.2',
'compatible.rdbms' = '11.2',
'compatible.advm' = '11.2';
Checking ASM alert log
All the ASM related files are stored under $ORACLE_BASE/diag or the directory that you list in
the init.ora DIAGNOSTIC_DEST initialization parameter
$ ls $ORACLE_BASE/diag/asm/+asm/+ASM
alert cdump hm incident incpkg ir lck metadata stage sweep trace
Note : You can do all the tasks using oracle database console or Enterprise manager grid control
GUI.
General Helpful commands:
# Start / Stop ASM and Listener
srvctl stop listener

srvctl start listener


srvctl stop asm
srvctl start asm
srvctl status asm
# Connect to local/remote ASM isntance
$ sqlplus / as sysasm
(local connection )
$ sqlplus sys@\"myhost.mydomain.com:1521/+ASM\" AS SYSASM

(remote connection)

Other considerations:
Disk Sizing
The number of disks required depends on the size of your database.
At the minimum its recommended to have two disk groups. One for Data and one for Recovery
area. Each diskgroup should have a minimum of four grid disks for better performance.
Keep all the disks of same size and performance in the diskgroup.
ASM Disk Rebalancing
Oracle ASM automatically initiates a rebalance after storage configuration changes, such as
when you add, drop, or resize disks. The power setting parameter determines the speed with
which rebalancing operations occur.
You can minimize the impact on database performance with the setting of the POWER_LIMIT
initialization parameter.
Backup the ASM binaries and init.ora files
Remember to backup your ORACLE_HOME and GRID_INFRASTRUCTURE binaries using OS
backup tools.
For 11.2 you can move the ASM init.ora to one of the diskgroups. The disk group
COMPATIBLE.ASM should be set to 11.2
$ sqlplus / as sysasm
SQL> CREATE SPFILE = '+DATA/asmspfile.ora' FROM PFILE =
'$ORACLE_HOME/dbs/asmpfile.ora';
If you create the spfile to some other location then, create a PFILE with one line in it that
identifies the path to the SPFILE.
For example:
Create the /u01/oracle/dbs/spfileasm_init.ora file that contains:
SPFILE='+DATA/asm/asmparameterfile/asmspfile.ora'
Alternatively use the ASMCMD to fix the auto lookup
ASMCMD> spset +DATA/asm/asmparameterfile/asmspfile.ora
Restart the ASM to read the new spfile.

Please see the 2 day DBA series note for ASM management : http://orax2.blogspot.com/2011/05/oracle-by-example-2-day-dba-asm.html
For Further details please check the Oracle ASM
Documentation:http://download.oracle.com/docs/cd/E11882_01/server.112/e16102/toc.htm