Automatic Storage Management (ASM):
Automatic Storage Management (ASM) is a new feature that has be introduced in Oracle 10g to simplify the storage of Oracle datafiles, controlfiles and logfiles.Automatic Storage Management (ASM) is an integrated file system and volume manager expressly built for Oracle database files.
An Oracle ASM instance is built on the same technology as an Oracle Database instance. An Oracle ASM instance has a System Global Area (SGA) and background processes that are similar to those of Oracle Database. However, because Oracle ASM performs fewer tasks than a database, an Oracle ASM SGA is much smaller than a database SGA. In addition, Oracle ASM has a minimal performance effect on a server. Oracle ASM instances mount disk groups to make Oracle ASM files available to database instances; Oracle ASM instances do not mount databases.
Name | Description |
INSTANCE_TYPE | Must be set to ASM Note: This is the only required parameter. All other parameters take suitable defaults for most environments. |
ASM_POWER_LIMIT | The default power for disk rebalancing. Default: 1, Range: 0 – 11 |
ASM_DISKSTRING | A comma-separated list of strings that limits the set of disks that ASM discovers. May include wildcard characters. Only disks that match one of the strings are discovered. String format depends on the ASM library in use and on the operating system. The standard system library for ASM supports glob pattern matching. For example, on a Solaris server that does not use ASMLib, to limit discovery to disks that are in the /dev/rdsk/ directory, ASM_DISKSTRING would be set to: /dev/rdsk/* another example:
/dev/rdsk/*s3,/dev/rdsk/*s4 (This could be simplified to:) /dev/rdsk/*s[34] Default: NULL. A NULL value causes ASM to search a default path for all disks in the system to which the ASM instance has read/write access. The default search path is platform-specific. |
ASM_DISKGROUPS | A list of the names of disk groups to be mounted by an ASM instance at startup, or when the ALTER DISKGROUP ALL MOUNT statement is used. Default: NULL (If this parameter is not specified, then no disk groups are mounted.) This parameter is dynamic, and if you are using a server parameter file (SPFILE), you should not need to manually alter this value. ASM automatically adds a disk group to this parameter when the disk group is successfully created or mounted, and automatically removes a disk group from this parameter when the disk group is dropped or dismounted.
|
Disk Groups:
The primary component of ASM is the disk group. A disk group consists of a grouping of disks that are managed together as a unit.
Disks:
The physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files.The disks in a disk group are referred to as ASM disks. On Windows operating systems, an ASM disk is always a partition.
When an ASM instance starts, it automatically discovers all available ASM disks.Discovery is the process of determining every disk device to which the ASM instance has been given I/O permissions (by some operating system mechanism), and of examining the contents of the first block of such disks to see if they are recognized as belonging to a disk group. ASM discovers disks in the paths that are listed in an initialization parameter, or if the parameter is NULL, in an operating system–dependent default path.
There are three types of ASM disk groups:
* Normal redundancy
* High redundancy
* External redundancy
The redundancy level controls how many disk failures are tolerated without dismounting the disk group or losing data.The default disk group type is normal redundancy.
NORMAL REDUNDANCY - Two-way mirroring, requiring two failure groups.
HIGH REDUNDANCY - Three-way mirroring, requiring three failure groups.
EXTERNAL REDUNDANCY - No mirroring for disks that are already protected using hardware mirroring or RAID. If you have hardware RAID it should be used in preference to ASM redundancy, so this will be the standard option for most installations.
External redundancy
Oracle ASM does not provide mirroring redundancy and relies on the storage system to provide RAID functionality. Any write error causes a forced dismount of the disk group. All disks must be located to successfully mount the disk group.
An external redundancy disk group cannot tolerate the failure of any disks in the disk group. Any kind of disk failure causes ASM to dismount the disk group.
Normal redundancy
Oracle ASM provides two-way mirroring by default, which means that all files are mirrored so that there are two copies of every extentOpens a new window. A loss of one Oracle ASM disk is tolerated. You can optionally choose three-way or unprotected mirroring.
A file specified with HIGH redundancy (three-way mirroring) in a NORMAL redundancy disk group provides additional protection from a bad disk sector, not protection from a disk failure.
A normal redundancy disk group can tolerate the failure of one failure group. If only one failure group fails, the disk group remains mounted and serviceable, and ASM performs a rebalance of the surviving disks (including the surviving disks in the failed failure group) to restore redundancy for the data in the failed disks. If more than one failure group fails, ASM dismounts the disk group.
High redundancy
Oracle ASM provides triple mirroring by default. A loss of two Oracle ASM disks in different failure groups is tolerated.
A high redundancy disk group can tolerate the failure of two failure groups. If one or two failure groups fail, the disk group remains mounted and serviceable, and ASM performs a rebalance of the surviving disks to restore redundancy for the data in the failed disks. If more than two failure groups fail, ASM dismounts the disk group.
If you specify mirroring for a file, then Oracle ASM automatically stores redundant copies of the file extents in separate failure groups.
****Query the v$osm_alias data dictionary view to see assigned alias names for ASM files.
ASM provides the following benefits:
Striping—ASM spreads data evenly across all disks in a disk group to optimize performance and utilization. This even distribution of database files eliminates the need for regular monitoring and I/O performance tuning.
Mirroring—ASM can increase availability by optionally mirroring any file. ASM mirrors at the file level, unlike operating system mirroring, which mirrors at the disk level. Mirroring means keeping redundant copies, or mirrored copies, of each extent of the file, to help avoid data loss caused by disk failures. The mirrored copy of each file extent is always kept on a different disk from the original copy. If a disk fails, ASM can continue to access affected files by accessing mirrored copies on the surviving disks in the disk group.
ASM supports 2-way mirroring, where each file extent gets one mirrored copy, and 3-way mirroring, where each file extent gets two mirrored copies.
ASM REBALANCING:
ASM permits you to add or remove disks from your disk storage system while the database is operating. When you add a disk, ASM automatically redistributes the data so that it is evenly spread across all disks in the disk group, including the new disk. This redistribution is known as rebalancing. It is done in the background and with minimal impact to database performance. When you request to remove a disk, ASM first rebalances by evenly relocating all file extents from the disk being removed to the other disks in the disk group.
ASM enables you to change the storage configuration without having to take the database offline. It automatically rebalances—redistributes file data evenly across all the disks of the disk group—after you add disks to or drop disks from a disk group.
Effects of Adding and Dropping Disks from a Disk Group
ASM automatically rebalances whenever disks are added or dropped. For a normal drop operation (without the FORCE option), a disk is not released from a disk group until data is moved off of the disk through rebalancing. Likewise, a newly added disk cannot support its share of the I/O workload until rebalancing completes. It is more efficient to add or drop multiple disks at the same time so that they are rebalanced as a single operation. This avoids unnecessary movement of data.
For a drop operation, when rebalance is complete, ASM takes the disk offline momentarily, and then drops it, setting disk header status to FORMER.
You can add or drop disks without shutting down the database. However, a performance impact on I/O activity may result.
Tuning Rebalance Operations
The V$ASM_OPERATION view provides information that can be used for adjusting ASM_POWER_LIMIT and the resulting power of rebalance operations. The V$ASM_OPERATION view also gives an estimate in the EST_MINUTES column of the amount of time remaining for the rebalance operation to complete. You can see the effect of changing the rebalance power by observing the change in the time estimate.
SET pagesize 299
SET lines 2999
SELECT GROUP_NUMBER,
OPERATION,
STATE,
POWER,
ACTUAL,
ACTUAL,
EST_MINUTES
FROM gv$asm_operation;
***==========================***
There are seven new v$ views provided in Oracle Database to monitor ASM structures.
v$asm_diskgroup:
v$asm_client:
V$ASM_DISK
v$asm_file:
v$asm_template:
v$asm_alias:
v$asm_operation:
Grip Version:
+++++++++++++
crsctl query crs activeversion
crsctl query crs activeversion
Mount and unmount diskgroup:
sqlplus / as sysasm
alter diskgroup DG_PDBPROD_AR mount;
alter diskgroup DG_PDBPROD_AR dismount;
select name,state,total_mb from v$asm_diskgroup;
select name,state from v$asm_diskgroup;
Add disk group:
sqlplus / as sysasm
alter diskgroup <diskgroup_name> add disk 'ORCL:<disk_name>';
alter diskgroup DG_BRMDEV2_DT01 add disk 'ORCL:D2BRM_DT01_106G_003';
srvctl add asm
srvctl start asm
crsctl status resource -t
Difference between CANDIDATE & PROVISIONED in ASM DISK
Disks that were discovered but that have not yet been assigned to a disk group have a header status of either CANDIDATE or PROVISIONED.
Below are the HEADER_STATUS in the v$ASM_DISK. I have taken below status from 11gR2.
UNKNOWN - Automatic Storage Management disk header has not been read
CANDIDATE - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement
INCOMPATIBLE - Version number in the disk header is not compatible with the Automatic Storage Management software version.
PROVISIONED - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement. The PROVISIONED header status is different from the CANDIDATE header status in that PROVISIONED implies that an additional platform-specific action has been taken by an administrator to make the disk available for Automatic Storage Management.
MEMBER - Disk is a member of an existing disk group. No attempt should be made to add the disk to a different disk group. The ALTER DISKGROUP statement will reject such an addition unless overridden with the FORCE option
FORMER - Disk was once part of a disk group but has been dropped cleanly from the group. It may be added to a new disk group with the ALTER DISKGROUP statement.
CONFLICT - Automatic Storage Management disk was not mounted due to a conflict
FOREIGN - Disk contains data created by an Oracle product other than ASM. This includes datafiles, logfiles, and OCR disks.
When adding a disk, the FORCE option must be used if Oracle ASM recognizes that the disk was managed by Oracle. Such a disk appears in the V$ASM_DISK view with a status of FOREIGN.
The v$ views for ASM are built upon several ASM fixed tables, called x$ tables. The x$ tables are not really tables, they are C language structures inside the SGA RAM heap:
Script:
REM ASM views:
REM VIEW |ASM INSTANCE |DB INSTANCE
REM ----------------------------------------------------------------------------------------------------------
REM V$ASM_DISKGROUP |Describes a disk group (number, name, size |Contains one row for every open ASM
REM |related info, state, and redundancy type) |disk in the DB instance.
REM V$ASM_CLIENT |Identifies databases using disk groups |Contains no rows.
REM |managed by the ASM instance. |
REM V$ASM_DISK |Contains one row for every disk discovered |Contains rows only for disks in the
REM |by the ASM instance, including disks that |disk groups in use by that DB instance.
REM |are not part of any disk group. |
REM V$ASM_FILE |Contains one row for every ASM file in every |Contains rows only for files that are
REM |disk group mounted by the ASM instance. |currently open in the DB instance.
REM V$ASM_TEMPLATE |Contains one row for every template present in |Contains no rows.
REM |every disk group mounted by the ASM instance. |
REM V$ASM_ALIAS |Contains one row for every alias present in |Contains no rows.
REM |every disk group mounted by the ASM instance. |
REM v$ASM_OPERATION |Contains one row for every active ASM long |Contains no rows.
REM |running operation executing in the ASM instance. |
set wrap off
set lines 155 pages 9999
col "Group Name" for a6 Head "Group|Name"
col "Disk Name" for a10
col "State" for a10
col "Type" for a10 Head "Diskgroup|Redundancy"
col "Total GB" for 9,990 Head "Total|GB"
col "Free GB" for 9,990 Head "Free|GB"
col "Imbalance" for 99.9 Head "Percent|Imbalance"
col "Variance" for 99.9 Head "Percent|Disk Size|Variance"
col "MinFree" for 99.9 Head "Minimum|Percent|Free"
col "MaxFree" for 99.9 Head "Maximum|Percent|Free"
col "DiskCnt" for 9999 Head "Disk|Count"
prompt
prompt ASM Disk Groups
prompt ===============
SELECT g.group_number "Group"
, g.name "Group Name"
, g.state "State"
, g.type "Type"
, g.total_mb/1024 "Total GB"
, g.free_mb/1024 "Free GB"
, 100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance"
, 100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance"
, 100*(min(d.free_mb/d.total_mb)) "MinFree"
, 100*(max(d.free_mb/d.total_mb)) "MaxFree"
, count(*) "DiskCnt"
FROM v$asm_disk d, v$asm_diskgroup g
WHERE d.group_number = g.group_number and
d.group_number <> 0 and
d.state = 'NORMAL' and
d.mount_status = 'CACHED'
GROUP BY g.group_number, g.name, g.state, g.type, g.total_mb, g.free_mb
ORDER BY 1;
prompt ASM Disks In Use
prompt ================
col "Group" for 999
col "Disk" for 999
col "Header" for a9
col "Mode" for a8
col "State" for a8
col "Created" for a10 Head "Added To|Diskgroup"
--col "Redundancy" for a10
--col "Failure Group" for a10 Head "Failure|Group"
col "Path" for a19
--col "ReadTime" for 999999990 Head "Read Time|seconds"
--col "WriteTime" for 999999990 Head "Write Time|seconds"
--col "BytesRead" for 999990.00 Head "GigaBytes|Read"
--col "BytesWrite" for 999990.00 Head "GigaBytes|Written"
col "SecsPerRead" for 9.000 Head "Seconds|PerRead"
col "SecsPerWrite" for 9.000 Head "Seconds|PerWrite"
select group_number "Group"
, disk_number "Disk"
, header_status "Header"
, mode_status "Mode"
, state "State"
, create_date "Created"
--, redundancy "Redundancy"
, total_mb/1024 "Total GB"
, free_mb/1024 "Free GB"
, name "Disk Name"
--, failgroup "Failure Group"
, path "Path"
--, read_time "ReadTime"
--, write_time "WriteTime"
--, bytes_read/1073741824 "BytesRead"
--, bytes_written/1073741824 "BytesWrite"
, read_time/reads "SecsPerRead"
, write_time/writes "SecsPerWrite"
from v$asm_disk_stat
where header_status not in ('FORMER','CANDIDATE')
order by group_number
, disk_number
/
Prompt File Types in Diskgroups
Prompt ========================
col "File Type" for a16
col "Block Size" for a5 Head "Block|Size"
col "Gb" for 9990.00
col "Files" for 99990
break on "Group Name" skip 1 nodup
select g.name "Group Name"
, f.TYPE "File Type"
, f.BLOCK_SIZE/1024||'k' "Block Size"
, f.STRIPED
, count(*) "Files"
, round(sum(f.BYTES)/(1024*1024*1024),2) "Gb"
from v$asm_file f,v$asm_diskgroup g
where f.group_number=g.group_number
group by g.name,f.TYPE,f.BLOCK_SIZE,f.STRIPED
order by 1,2;
clear break
prompt Instances currently accessing these diskgroups
prompt ==============================================
col "Instance" form a8
select c.group_number "Group"
, g.name "Group Name"
, c.instance_name "Instance"
from v$asm_client c
, v$asm_diskgroup g
where g.group_number=c.group_number
/
prompt Free ASM disks and their paths
prompt ==============================
col "Disk Size" form a9
select header_status "Header"
, mode_status "Mode"
, path "Path"
, lpad(round(os_mb/1024),7)||'Gb' "Disk Size"
from v$asm_disk
where header_status in ('FORMER','CANDIDATE')
order by path
/
prompt Current ASM disk operations
prompt ===========================
select *
from v$asm_operation
/
This is how some of the changes look
Added To Total Free Seconds Seconds
Group Disk Header Mode State Diskgroup GB GB Disk Name Path PerRead PerWrite
----- ---- --------- -------- -------- ---------- ------ ------ ---------- ------------------- ------- --------
1 0 MEMBER ONLINE NORMAL 20-FEB-09 89 88 FRA_0000 /dev/oracle/disk388 .004 .002
1 1 MEMBER ONLINE NORMAL 31-MAY-10 89 88 FRA_0001 /dev/oracle/disk260 .002 .002
1 2 MEMBER ONLINE NORMAL 31-MAY-10 89 88 FRA_0002 /dev/oracle/disk260 .007 .002
2 15 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0015 /dev/oracle/disk203 .012 .023
2 16 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0016 /dev/oracle/disk203 .012 .021
2 17 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0017 /dev/oracle/disk203 .007 .026
2 27 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0027 /dev/oracle/disk260 .011 .023
2 28 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0028 /dev/oracle/disk259 .009 .020
2 38 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0038 /dev/oracle/disk190 .012 .025
2 39 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0039 /dev/oracle/disk189 .014 .015
2 40 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0040 /dev/oracle/disk260 .011 .024
2 41 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0041 /dev/oracle/disk260 .009 .022
2 42 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0042 /dev/oracle/disk260 .011 .018
2 43 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0043 /dev/oracle/disk260 .003 .026
2 44 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0044 /dev/oracle/disk260 .008 .019
2 45 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0045 /dev/oracle/disk193 .008 .018
2 46 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0046 /dev/oracle/disk192 .007 .024
2 47 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0047 /dev/oracle/disk191 .005 .022
2 48 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0048 /dev/oracle/disk190 .008 .021
2 49 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0049 /dev/oracle/disk189 .008 .026
2 50 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0050 /dev/oracle/disk261 .009 .030
56 rows selected.
File Types in Diskgroups
========================
Group Block
Name File Type Size STRIPE Files Gb
------ ---------------- ----- ------ ------ --------
DATA CONTROLFILE 16k FINE 1 0.01
DATAFILE 16k COARSE 404 2532.58
ONLINELOG 1k FINE 3 6.00
PARAMETERFILE 1k COARSE 1 0.00
TEMPFILE 16k COARSE 13 440.59
FRA AUTOBACKUP 16k COARSE 2 0.02
CONTROLFILE 16k FINE 1 0.01
ONLINELOG 1k FINE 3 6.00