ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Database 10g
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Database 10g
Home Articles Scripts Forums Blog Certification Misc About Printer Friendly
Oracle 8i | Oracle 9i | Oracle 10g | Oracle 11g | Oracle 12c | Miscellaneous | PL/SQL | SQL | Oracle RAC | Oracle Apps | Linux
Related articles.
The ASM functionality is controlled by an ASM instance. This is not a full database instance, just the memory structures and as such is
very small and lightweight.
The main components of ASM are disk groups, each of which comprise of several physical disks that are controlled as a single unit. The
physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files. The locations and names for the
files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
The level of redundancy and the granularity of the striping can be controlled using templates. Default templates are provided for each file
type stored by ASM, but additional templates can be defined as needed.
Failure groups are defined within a disk group to support the required level of redundancy. For two-way mirroring you would expect a disk
group to contain two failure groups so individual files are written to two locations.
It is worth taking a quick look at the following section of the documentation to familiarize yourself with the basic requirements
recommendations for ASM. Translate
1 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default is RDBMS.
DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults to +ASM but must be altered if you intend to
run multiple ASM instances.
ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. The valid values range from 1 to 11,
with 1 being the default. The higher the limit the more resources are allocated resulting in faster rebalancing operations. This value
is also used as the default when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER
DISKGROUP ALL MOUNT statement. ASM configuration changes are automatically reflected in this parameter.
ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered for discovery. Altering the default value may
improve the speed of disk group mount time and the speed of adding a disk to a disk group. Changing the parameter to a value
which prevents the discovery of already mounted disks results in an error. The default value is NULL allowing all suitable disks to
be considered.
To create an ASM instance first create a file called "init+ASM.ora" in the "/tmp" directory containing the following information.
INSTANCE_TYPE=ASM
export ORACLE_SID=+ASM
sqlplus / as sysdba
File created.
The ASM instance is now ready to use for creating and mounting disk groups. To shutdown the ASM instance issue the following
command.
SQL> shutdown
ASM instance shutdown
SQL>
Once an ASM instance is present disk groups can be used for the following parameters in 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
2 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
ASM instance are started and stopped in a similar way to normal database instances. The options for the STARTUP command are:
NORMAL - The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down.
IMMEDIATE - The ASM instance waits for any SQL transactions to complete then shuts down. It doesn't wait for sessions to exit.
TRANSACTIONAL - Same as IMMEDIATE.
ABORT - The ASM instance shuts down instantly.
In most cases you will only need two disk groups (DATA and FRA), where DATA holds all database related files and FRA holds the
fast recovery area, including multiplexed copies on online redo logs and controlfiles. Typically, the FRA disk group will be twice the
size of the DATA disk group, since it must hold all backups.
Oracle recommend a minimum of 4 LUNs per disk group, with LUNs using hardware RAID and external redundancy if possible.
All LUNs within a disk group should be the same size and have the same performance characteristics.
LUNs should be made up from disks dedicated to Oracle, not shared with other applications.
Disks
Disk groups are created using the CREATE DISKGROUP statement. This statement allows you to specify the level of redundancy:
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 "disk_group_1_0001". The FORCE option can be used to move a disk from another disk group into this one.
Disks can be added or removed from disk groups using the ALTER DISKGROUP statement. Remember that the wildcard "*" can be used
to reference disks so long as the resulting string does not match a disk already used by an existing disk group.
-- Add disks.
ALTER DISKGROUP disk_group_1 ADD DISK
'/devices/disk*3',
'/devices/disk*4';
-- Drop a disk.
ALTER DISKGROUP disk_group_1 DROP DISK diska2;
Disks can be resized using the RESIZE clause of the ALTER DISKGROUP statement. The statement can be used to resize individual
disks, all disks in a failure group or all disks in the disk group. If the SIZE clause is omitted the disks are resized to the size of the disk
returned by the OS.
3 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
The UNDROP DISKS clause of the ALTER DISKGROUP statement allows pending disk drops to be undone. It will not revert drops that
have completed, or disk drops associated with the dropping of a disk group.
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.
Disk groups are mounted at ASM instance startup and unmounted at ASM instance shutdown. Manual mounting and dismounting can be
accomplished using the ALTER DISKGROUP statement as seen below.
Templates
Templates are named groups of attributes that can be applied to the files within a disk group. The following example show how templates
can be created, altered and dropped.
-- Modify template.
ALTER DISKGROUP disk_group_1 ALTER TEMPLATE my_template ATTRIBUTES (COARSE);
-- Drop template.
ALTER DISKGROUP disk_group_1 DROP TEMPLATE my_template;
Directories
A directory heirarchy can be defined using the ALTER DISKGROUP statement to support ASM file aliasing. The following examples show
how ASM directories can be created, modified and deleted.
-- Create a directory.
ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir';
-- Rename a directory.
ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO '+disk_group_1/my_dir_2';
Aliases
Aliases allow you to reference ASM files using user-friendly names, rather than the fully qualified ASM filenames.
4 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
-- Rename an alias.
ALTER DISKGROUP disk_group_1 RENAME ALIAS '+disk_group_1/my_dir/my_file.dbf'
TO '+disk_group_1/my_dir/my_file2.dbf';
-- Delete an alias.
ALTER DISKGROUP disk_group_1 DELETE ALIAS '+disk_group_1/my_dir/my_file.dbf';
Files
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, as shown below.
Checking Metadata
The internal consistency of disk group metadata can be checked in a number of ways using the CHECK clause of the ALTER DISKGROUP
statement.
ASM Views
The ASM configuration can be viewed using the V$ASM_% views, which often contain different information depending on whether they are
queried from the ASM instance, or a dependant database instance.
5 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
ASM Filenames
There are several ways to reference ASM file. Some forms are used during creation and some for referencing ASM files. The forms for
file creation are incomplete, relying on ASM to create the fully qualified name, which can be retrieved from the supporting views. The
forms of the ASM filenames are summarised below.
Disable change tracking (only available in Enterprise Edition) if it is currently being used.
Set the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters to the relevant ASM disk groups.
Remove the CONTROL_FILES parameter from the spfile so the control files will be moved to the DB_CREATE_* destination
and the spfile gets updated automatically. If you are using a pfile the CONTROL_FILES parameter must be set to the
appropriate ASM files or aliases.
Restore the controlfile into the new location from the old location.
6 of 7 7/24/2014 9:02 PM
ORACLE-BASE - Automatic Storage Management (ASM) in Oracle Data... http://www.oracle-base.com/articles/10g/automatic-storage-management-...
Create new redo logs in ASM and delete the old ones.
Database Monitoring
manageengine.com
MonitorPerformance, Status User Activity, Table Space, SGA
12 Like 11 Tweet 0 46
7 of 7 7/24/2014 9:02 PM