Tag Archives: ASM

Estimate the amount of work for rebalance operation in ASM Oracle

Estimate the amount of work for a rebalance operation

You can estimate the amount of work with v$ASM_ESTIMATE view. EST_WORK column provides an estimate of the number of allocation units that have to be moved by the rebalance operation to complete.

Note: Est_work column provide the information of allocation unit that is moved during rebalance operations.

Example of estimating the drop disk command

-- Estimate the drop disk work
EXPLAIN WORK FOR ALTER DISKGROUP diskgroup2 DROP DISK diska1;

--Check the view for estimate:
SELECT est_work FROM V$ASM_ESTIMATE;
EST_WORK
--------
5600

Example of estimating the disk online for a diskgroup

--Estimate of online the disk in a diskgroup using statement id
EXPLAIN WORK SET STATEMENT_ID='online' FOR ALTER DISKGROUP diskgroup2
ONLINE disk diska1;

--Check the view for estimate:
SELECT est_work FROM V$ASM_ESTIMATE WHERE STATEMENT_ID='online';
EST_WORK
--------
200

Please refer for rebalance operation commands in Oracle ASM: Rebalance operation in Diskgroup Oracle ASM

Advertisements

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;

Resize the disk or disk group all disk

-- Resize a specific disk of a disk group
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 Disk group

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.

Online upgradation of ASM version in RAC Environment / roll migration of asm in Oracle

Clustered ASM instances for 11g onwards can be upgraded using a rolling upgrade. 

ALTER SYSTEM START ROLLING MIGRATION TO number;

 

I want to upgrade the asm version from 11.1.0.7 to 11.2.0.0

Alter system start rolling migration to 11.2.0.0.0;

 

Ones node rolling migration is enabled you can be shutdown, upgraded and started.

Do not perform following operation when asm is in rolling migration mode:

  • Mount and dismount of the disk groups.
  • Open, close, resize, and delete of database files.
  • Access to local fixed views and fixed packages.

The current status of the ASM cluster can be determined using the following query.

select sys_context(‘sys_cluster_properties’,’cluster_state’) from dual;

 

After upgradation on all nodes. you can stop the rolling migration

ALTER sYSTEM STOP ROLLING MIGRATION;

 

Fast mirror resynchronization in ASM 11g

Fast Mirror resync in ASM 11g new feature

In Oracle 10g, If a disk of an disk group is unavailable for only a short period of time due to cable disconnect or any other reason, then server remove the disk from diskgroup instead of waits for the disk to become available again. ASM start the re-balance operation for the disk group. After reading the disk then it need to re-balance again. So to avoid this extra I/O operation in 11g introduced the FAST Mirror Re-synchronization in ASM.

In 11g Fast mirror resync, If disk is available with in the time limit of parameter DISK_REPAIR_TIME then rebalance operation is only done for modified blocks after the disk temporary unavailable and available with in the time limit of parameter.

Default of disk_repair_time is 3.6 hours.

For use this feature both having in 11g:

ALTER DISKGROUP SET ATTRIBUTE 'compatible.asm'='11.1';

ALTER Diskgroup SET ATTRIBUTE 'compatible.rdbms' = '11.1';

Disk group attribute disk_repair_time to determine how long to wait before an ASM disk is permanently dropped from an ASM disk group after it was taken offline for whatever reason. The default of disk_repair_time is 3.6 hours(190 Minutes)

For Disable this 11g feature:
Set DISK_REPAIR_TIME parameter to the value 0.

Change the parameter from default 3.6 to 24 hours:

alter diskgroup set attribute 'DISK_REPAIR_TIME'='24H';

 
Drop disk before repair time expired

Alter diskgroup offline disk disk1_001 drop after 0m;

Check the ststus of ASM diskgroup disks and Repair time value:

-- Online the disk
ALTER DISKGROUP DISK ONLINE;

select * from v$asm_disk_stat;

-- check compatibility
select * from v$asm_attribute;

--show the current disk repair time attribute value
select * from V$asm_disk;

Note: v$asm_disk has a column REPAIR_TIMER which shows the number of seconds remaining until the disk is automatically dropped and 0 if not failed.