Automatic Storage Management (ASM) in Oracle

ASM (Automatic Storage Management) in Oracle

ASM is used by Oracle to manage the diskgroups and diskgroups use to store to the data files. It will help to manage the disk groups and
provide the feature of ASM for striping and mirroring to provide balanced performance and security to the storage. ASM is managed with ASM instance.
ASM instance is like the oracle database instance, it only allocate memory structure in RAM area it does not have its own database,it will use information from its PFILE or SPFILE.
When you add or remove disks from a disk group, Oracle ASM automatically redistributes the data.

Few points for configure ASM:
1. All ASM disks in a disk group have similar storage performance and availability. If one disk is slow caused I/O bottleneck.
2. ALL ASM disks in a disk group have the same capacity to maintain balance because its distribute data according to capacity.

In 11g, ASM introduced two compatibility attributes that determine the version of the ASM and database software that can use specific disk groups
COMPATIBLE.ASM – minimum version of the ASM software that can access the disk group default setting is 10.1.
COMPATIBLE.RDBMS – minimum COMPATIBLE database initialization parameter setting for any database instance that uses the disk group default setting is 10.1.

Check compatible as following:

SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;
SELECT software_version ,compatible_version FROM v$asm_client;

PFILE Parameters:
INSTANCE_TYPE: ASM or RDBMS, let you know instance is of ASM or Database
DB_UNIQUE_VALUE: +ASM ,Global unique name for the database. but in this case it name of automatic storage management
ASM_POWER_LIMIT: value from 1 to 11, used for rebalance operation after storage configuration changes, such as when you add, drop, or resize disks. Default value is 1, it’s represent the speed with which rebalancing operations occur.
ASM_DISKGROUPS: diskgroup1,diskgroup2 List of diskgroups which is mounted automatic at startup. you can set manually after instance startup “ALTER SYSTEM SET ASM_DISKGROUPS = DISKGRP1, DISKGRP2;”
ASM_DISKSTRING: initialization parameter specify its discovery strings like ASM_DISKSTRING = ‘/dev/rdsk/*disk3’, ‘/dev/rdsk/*disk4’ wildcard character is used for discovery disk. Only disks that match one of the strings are discovered.
Default value is NULL, NULL value causes Oracle ASM to search a default path for all disks in the system to which the Oracle ASM instance has read and write access.

Start the ASM instance:
1. You have the pfile for start the asm

create spfile from pfile;

2. Start the ASM in nomount state as database
Note: ASM instance is started

startup nomount

3. For mount the ASM diskgroup which is present in ASM_DISKGROUPS parameter in spfile or pfile.

alter database mount;

Stop the ASM instance:
Shutdown the instance as normal database with shutdown command.

SHUTDOWN
--The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down.
SHUTDOWN iMMEDIATE
--The ASM instance waits for any SQL transactions to complete then shuts down. It doesn't wait for sessions to exit.

Disks group is configured with CREATE or ALTER DISKGROUP statement,you have following option to choose the redundancy level of diskgroups:
EXTERNAL REDUNDANCY means no mirroring for the disks. They may be protected at hardware level mirroring RAID or customer no need of mirroring
NORMAL REDUNDANCY means two way mirroring, required two failure group for configure disk in normal redundancy mode.
HIGH REDUNDANCY means three-way mirroring, required three failure groups for mirroring the data in high redundancy.

Following are the useful command used in ASM:

Create the diskgroup of EXTERNAL Redundancy

CREATE DISKGROUP diskgroup1 EXTERNAL REDUNDANCY
FAILGROUP failuregroup1 DISK
'/raw/devices/diska1' NAME diska1,
'/raw/devices/diska2' NAME diska2

Create the diskgroup of Normal Redundancy:

CREATE DISKGROUP diskgroup2 NORMAL REDUNDANCY
FAILGROUP failuregroup1 DISK
'/raw/devices/diska1' NAME diska1,
'/raw/devices/diska2' NAME diska2
FAILGROUP failuregroup2 DISK
'/raw/devices/diskb1' NAME diskb1,
'/raw/devices/diskb2' NAME diskb2;

Create the diskgroup of High Redundancy

CREATE DISKGROUP diskgroup3 high REDUNDANCY
FAILGROUP failuregroup1 DISK
'/raw/devices/diska1' NAME diska1,
'/raw/devices/diska2' NAME diska2
FAILGROUP failuregroup2 DISK
'/raw/devices/diskb1' NAME diskb1,
'/raw/devices/diskb2' NAME diskb2;
FAILGROUP failuregroup3 DISK
'/raw/devices/diskc1' NAME diskc1,
'/raw/devices/diskc2' NAME diskc2;

Check the diskgroup present

SELECT name, failgroup FROM v$asm_disk;
NAME FAILGROUP
-------------- ---------------
diska1 failuregroup1
diska2 failuregroup1

Mount or dismount the diskgroup with sqlplus

ALTER DISKGROUP diskgroup1 DISMOUNT;
ALTER DISKGROUP diskgroup1 MOUNT;
ALTER DISKGROUP diskgroup1 MOUNT FORCE;
-- For all disk mounted
ALTER DISKGROUP ALL DISMOUNT;
ALTER DISKGROUP ALL MOUNT;

Drop the disk group

DROP DISKGROUP diskgroup1 INCLUDING CONTENTS;

Add or Remove the datafile from diskgroup of ASM
Note: During adding or removing please note all disk size should be equal and rebalance operation is performed may caused performance issue at that time.

-- Add disks in diskgroup
ALTER DISKGROUP diskgroup2 ADD DISK
'/raw/devices/diska3',
'/raw/devices/diska4';

— Drop a disk from diskgroup
ALTER DISKGROUP diskgroup2 DROP DISK diska1;

Manually rebalance operation after add or remove disk
Note: rebalance operation required PGA memory for extent relocation

-- added the disk in diskgroup with power 5 but its not return back until rebalance operation completed.
ALTER DISKGROUP data1 ADD DISK '/devices/diskd10' REBALANCE POWER 5 WAIT;

— Rebalance with power 10 but it return and worked in backgroup for check query v$ASM_OPERATION view.
ALTER DISKGROUP diskgroup2 REBALANCE MODIFY POWER 10;
Note: By default, the ALTER DISKGROUP statement does not wait until the operation is complete before returning. Query the V$ASM_OPERATION view to monitor the status of this operation.

SQL> SELECT GROUP_NUMBER, PASS, STATE FROM V$ASM_OPERATION;

GROUP_NUMBER PASS STAT
———— ——— —-
2 RESYNC WAIT
2 REBALANCE WAIT
2 COMPACT WAIT

 

Estimate the amount of work for a rebalance operation before drop or create disk
Note: Est_work column provide the information of allocation unit that is moved during rebalance operations.

-- Explain clause help for estimate
EXPLAIN WORK FOR ALTER DISKGROUP diskgroup2 DROP DISK diska1;
-- check the view for estimate:
SELECT est_work FROM V$ASM_ESTIMATE;

— check online
EXPLAIN WORK SET STATEMENT_ID=’online’ FOR ALTER DISKGROUP diskgroup2
ONLINE disk diska1;

SELECT est_work FROM V$ASM_ESTIMATE WHERE STATEMENT_ID=’online’;

Resize the disk or diskgroup all disk

-- Resize a specific disk of a diskgroup
ALTER DISKGROUP diskgroup1 RESIZE DISK diska1 SIZE 10G;

— Resize all disks in a failure group.
ALTER DISKGROUP diskgroup1 RESIZE DISKS IN FAILGROUP failuregroup1 SIZE 10G;

— Resize all disks in a disk group may it present more than one failure group it will do for all.
ALTER DISKGROUP diskgroup1 RESIZE ALL SIZE 10G;

Check the consistency or integrity of the Diskgroup

ALTER DISKGROUP data1 CHECK ALL;

ASM Disk Information or view ASM_DISK
FORMER Disk: disk assigned to diskgroup then dropped from diskgroup is former disk
CANDIDATE Disk: discovered disk but not assigned to diskgroup is candidate disk
MEMBER Disk: Disk that belong to a diskgroup is member disk

SQL> SELECT name, header_status, path FROM V$ASM_DISK
WHERE path LIKE '/devices/disk0%';

NAME      HEADER_STATUS PATH
--------- ------------- ---------------------
          FORMER        /raw/devices/disk01
          FORMER        /raw/devices/disk02
          CANDIDATE     /raw/devices/disk03
DISK04    MEMBER        /raw/devices/disk04
DISK05    MEMBER        /raw/devices/disk05
DISK06    MEMBER        /raw/devices/disk06

 

Check the size of diskgroup

SELECT name, type, total_mb, free_mb, required_mirror_free_mb,
usable_file_mb FROM V$ASM_DISKGROUP;

Note: Column descriptions
TOTAL_MB column is the total usable capacity of a disk group in megabytes.
FREE_MB column is the unused capacity of the disk group in megabytes
REQUIRED_MIRROR_FREE_MB column is the amount of space that need to be available in a diskgroup to restore full redundancy after the failure tolerated without adding additional storage.
USABLE_FILE_MB column is the amount of free space used for adjusted mirroring for new files to restore redundancy after a disk failure.

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

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