RAC – Automatic Storage Management (ASM)

Let’s see something about Automatic Storage Management (ASM). As explained in perevious post, ASM is used to setup the disks once we choose a shared storage medium. With ASM, all the disks that are available in the storage medium are logically grouped together as groups called ‘ASM Disk Groups’. New disks can be added to the existing Disk Groups as storage grows.

These Disk Groups are used to store Oracle related files. Remember that the Disk Groups are logical volumes and the files that are created on it are not normal files, but striped files. So, while creating file you need to specify the diskgroup that the file needs to be created in, Oracle will then create a striped file across all the disks within the mentioned diskgroup. So the catch is without ASM, no operation can be performed on these files.

ASM files are Oracle Managed Files (OMF), meaning you specify diskgroup in which the database automatically creates, names, and manages files at the database object level.

For example, you need only specify that you want to create a tablespace; you do not need to specify the name and path of the tablespace’s datafile with the DATAFILE clause. Just specify diskgroup and tablespace, that’s it!!!

So how all these things are managed by ASM – Well !!! by means of ‘ASM Instance’.

Let’s see what an ‘ASM Instance’ is – it’s not a full database instance, just the memory structures and as such is very small and lightweight. it has its own processes and pfile or spfile. It does not mount any datafiles and even no data dictionary. It normally only needs about 100MB of disk space and will consume about 25MB of memory for the SGA.

The main parameters in the instance parameter file will be

*Instance_type (RDBMS or ASM )
*Instance_name (Name of ASM instance)
*asm_power_limit (range is 1 – 11 (11-fastest))
*asm_diskstring (location for disk discovery)
*asm_diskgroups (DG’s that mount automatically)

You can start an ASM instance with nomount, mount but not open. When shutting down a ASM instance this passes the shutdown command to the RDBMS (normal, immediate, etc)instances.

Once an ASM instance is present disk groups can be used for the following parameters in normal database instances (INSTANCE_TYPE=RDBMS) to allow ASM file creation:

•DB_CREATE_FILE_DEST
•DB_CREATE_ONLINE_LOG_DEST_n
•DB_RECOVERY_FILE_DEST
•CONTROL_FILES
•LOG_ARCHIVE_DEST_n
•LOG_ARCHIVE_DEST
•STANDBY_ARCHIVE_DEST

So, in brief ASM constitues the following 3 components –

* ASM Instnace
* ASM Disk Groups
* ASM Files

While explaining about Disk Groups, it was mentioned that all the disks in the storge medium are formed as groups, this is to provide the features like Disk Striping and Mirroring.

ASM Striping

ASM stripes files across all the disks within the disk group thus increasing performance, each stripe is called an ‘allocation unit’. ASM offers two types of stripping which is dependent on the type of database file.

Coarse Stripping for datafile,archive logs
Fine Stripping for onlineredo,control,flashback files

ASM Mirroring

Disk mirroring provides data redundancy, Oracle mirrors at the extent level, so you have a primary extent and a mirrored extent. When a disk fails, ASM rebuilds the failed disk using mirrored extents from the other disks within the group, this may have a slight impact on performance as the rebuild takes place.

All disks that share a common controller are in what is called a failure group, you can ensure redundancy by mirroring disks on separate failure groups which in turn are on different controllers, ASM will ensure that the primary extent and the mirrored extent are not in the same failure group. When mirroring you must define failure groups otherwise the mirroring will not take place.

There are three forms of Mirroring –

•External redundancy with no-mirroring strategy
•Normal redundancy with two failure groups
•High redundancy with three failure groups

Ok – Till now our discussion is focused on the concepts of ASM, now let’s see what to do to run Automatic Storage Management (ASM).

As explained before to use ASM for managing database files you must be running both ASM and normal database instances.

ASM is integrated into the Oracle database server and you do not need to install ASM as a separate product. You can configure the ASM using DBCA, SRVCTL or OEM.

Note: In any installation, non-ASM managed operating system storage repositories are required, and are used for swap files, execution libraries, and user file systems. The Oracle database and ASM executable files and libraries must reside on the server’s operating system file system and cannot reside in an ASM files.

ASM Operations

Once ASM instance is created, start it as follows –

#sqlplus /nolog;
sql>connect /as sysdba;
sql>startup nomount pfile=init+asm.ora
ASM instance started

Total System Global Area 125829120 bytes
Fixed Size 1301456 bytes
Variable Size 124527664 bytes
Database Buffers 0 bytes
Redo Buffers 0 bytes

SQL>

Note: sometimes you get a ora-15110 which means that the diskgroups are not created yet.

The ASM instance is now ready to use for creating and mounting disk groups.

Disk groups are created using the CREATE DISKGROUP statement. This statement allows you to specify the level of redundancy i.e. Normal/High/External.

In addition failure groups and preferred names for disks can be defined. If the NAME clause is omitted the disks are given a system generated name like “DG_1_0001”.

SQL>CREATE DISKGROUP DG_1 NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK
‘/devices/diska1’ NAME diska1,
‘/devices/diska2’ NAME diska2

FAILGROUP failure_group_2 DISK
‘/devices/diskb1’ NAME diskb1,
‘/devices/diskb2’ NAME diskb2;

To drop a disk group following command is used –

SQL>drop diskgroup DG_1 including contents;

To add a disk to the existing diskgroup use the alter command as follows –

SQL>alter diskgroup DG_1 add disk
‘/devices/diskc1’;

To drop a disk from the existing diskgroup use –

SQL>alter diskgroup DG_1 drop disk diska1;

You can even resize the size of the disk using alter DISKGROUP statement –

SQL>alter diskgroup DG_1 resize disk diska1 size 100G;

To resize all disks in a diskgroup –

SQL>alter diskgroup DG_1 resize all size 100G;

To resize all disks in a failure group –

SQL>alter diskgroup DG_1 resize disks in failgroup failure_group_1 size 100G;

Disk groups can be rebalanced manually using the REBALANCE clause of the ALTER DISKGROUP statement. If the POWER clause is omitted the ASM_POWER_LIMIT parameter value is used. Rebalancing is only needed when the speed of the automatic rebalancing is not appropriate.

SQL>alter diskgroup DG_1 rebalance power 5;

We can even manually mount/dismount diskgroups –

SQL>ALTER DISKGROUP ALL DISMOUNT;
SQL>ALTER DISKGROUP ALL MOUNT;
SQL>ALTER DISKGROUP DG_1 DISMOUNT;
SQL>ALTER DISKGROUP DG_1 MOUNT;

You can also create/modify/rename/drop Templates, Directories and Aliases.

Files are not deleted automatically if they are created using aliases, as they are not Oracle Managed Files (OMF), or if a recovery is done to a point-in-time before the file was created. For these circumstances it is necessary to manually delete the files.

The internal consistency of disk group metadata can be checked in a number of ways using the CHECK clause of the ALTER DISKGROUP statement.

To check metadata for all disks in a diskgroup –

SQL>alter diskgroup DG_1 check all;

To check metadata for specific disk –

SQL>alter diskgroup DG_1 check disk diska1;

To check metadata for a specific failure group –

SQL>alter diskgroup DG_1 check failgroup failure_group_1;

You can obtain diskgroup information using following queries –

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

SQL>select group_number, disk_number, name, failgroup, create_date, path, total_mb
from v$asm_disk;

SQL>select group_number, operation, state,
power,actual,sofar,est_work,est_rate,
est_minutes from v$asm_operation;

So with this i conclude ASM part here and in next post discuss about OCR & Voting disk.

Advertisements
This entry was posted in Oracle - RAC. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s