Automatic Storage Management (ASM) in Oracle Database 10g Automatic Storage Management (ASM) is a new feature that has

be introduced in Or acle 10g to simplify the storage of Oracle datafiles, controlfiles and logfiles. Overview of Automatic Storage Management (ASM) Initialization Parameters and ASM Instance Creation Startup and Shutdown of ASM Instances Administering ASM Disk Groups Disks Templates Directories Aliases Files Checking Metadata ASM Filenames ASM Views SQL and ASM Migrating to ASM Using RMAN

Related articles. ASM using ASMLib and Raw Devices Using NFS with ASM Automatic Storage Manager (ASM) Enhancements in Oracle Database 11g Release 1

Overview of Automatic Storage Management (ASM) Automatic Storage Management (ASM) simplifies administration of Oracle related f iles by allowing the administrator to reference disk groups rather than individu al disks and files, which are managed by ASM. The ASM functionality is an extention of the Oracle Managed Files (OMF) functionality that also includes striping and mirroring to provide balanced and secure storage. The new ASM functionality can be used in combination with existing raw and cooked file systems, along with OMF and manually managed files. The ASM functionality is controlled by an ASM instance. This is not a full datab ase instance, just the memory structures and as such is very small and lightweig ht. The main components of ASM are disk groups, each of which comprise of several ph ysical 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 l ocations and names for the files are controlled by ASM, but user-friendly aliase

Manages disk redundancy within a disk group. ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. Provides near-optimal I/O balancing without any manual tuning. In summary ASM provides the following functionality: Manages groups of disks. called disk groups. Supports large files. The higher the limit the more resources are allocated re . but additional templates can be defined as needed. The defa ult is RDBMS. with 1 being the default. It is worth taking a quick look at the following section of the documentation to familiarize yourself with the basic requirements recommendations for ASM. The valid values range from 1 to 11.Specifies a globally unique name for the database. Failure groups are defined within a disk group to support the required level of redundancy. This defaults to +ASM but must be altered if you intend to run multiple ASM instance s.Set to ASM or RDBMS depending on the instance type. Enables management of database objects without specifying mount points and f ilenames. Default templates are provided for each file type stored by ASM.s and directory structures can be defined for ease of reference. For two-way mirroring you would expect a disk group to contain two f ailure groups so individual files are written to two locations. DB_UNIQUE_NAME . Recommendations for Storage Preparation ====================================================== Initialization Paramete rs and ASM Instance Creation ================================================= ======= The initialization parameters that are of specific interest for an ASM instance are: INSTANCE_TYPE . The level of redundancy and the granularity of the striping can be controlled us ing templates.

ora" in the "/tmp " directory containing the following information. ASM_DISKSTRING .Specifies a value that can be used to limit the disks c onsidered for discovery.sulting in faster rebalancing operations. ASM_DISKGROUPS . To create an ASM instance first create a file called "init+ASM.The list of disk groups that should be mounted by an AS M instance during instance startup. ASM configuration changes are automatically reflected in this parameter. . or by the ALTER DISKGROUP ALL MOUNT statemen t. INSTANCE_TYPE=ASM Next.ora'. File created. To s hutdown the ASM instance issue the following command. Changing the parameter to a value which prevents the discovery of already mounted disks results in an error. export ORACLE_SID=+ASM sqlplus / as sysdba Create an spfile using the contents of the "init+ASM. using SQL*Plus connect to the ide instance. This value is also used as the default when the POWER clause is omitted from a rebalance operation. SQL> startup nomount 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> The ASM instance is now ready to use for creating and mounting disk groups. The default value is NULL allowing all suitable disks to be considered. Finally. SQL> CREATE SPFILE FROM PFILE='/tmp/init+ASM. start the instance with the NOMOUNT option.ora" file. Incorrect usage of parameters in ASM or RDBMS instances result in ORA-15021 erro rs. Altering the default value may improve the speed of disk group mount time and the speed of adding a disk to a disk group.

The options for the SHUTDOWN command are: NORMAL . MOUNT . The options for the STARTUP command are: FORCE .Starts the ASM instance without mounting any disk groups.The ASM instance waits for any SQL transactions to complete then shuts down. .SQL> shutdown ASM instance shutdown SQL> Once an ASM instance is present disk groups can be used for the following parame ters 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 ====================================================== Startup and Shutdown of ASM Instances ============================================== ASM instance are started and stopped in a similar way to normal database instanc es. TRANSACTIONAL . ABORT . It doesn't wait for sessions to exit.The ASM instance waits for all connected ASM instances and SQL sess ions to exit then shuts down. IMMEDIATE .Performs a SHUTDOWN ABORT before restarting the ASM instance.The ASM instance shuts down instantly.This is not a valid option for an ASM instance. NOMOUNT .Starts the ASM instance and mounts the disk groups specified by the ASM_DISKGROUPS parameter. OPEN .Same as IMMEDIATE.

In addition failure groups and preferred names for disks can be defined. 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 grou . not shared with other applications.============================================================ M Disk Groups ==================================== Administering AS There are a few basic points to consider when planning to use ASM: In most cases you will only need two disk groups (DATA and FRA).Three-way mirroring. Disks Disk groups are created using the CREATE DISKGROUP statement. '/devices/diska2' NAME diska2 FAILGROUP failure_group_2 DISK '/devices/diskb1' NAME diskb1. requiring two failure groups. EXTERNAL REDUNDANCY .Two-way mirroring. since it must hold all backups. DROP DISKGROUP disk_group_1 INCLUDING CONTENTS. Disks can be added or removed from disk groups using the ALTER DISKGROUP stateme nt.No mirroring for disks that are already protected usin g hardware mirroring or RAID. Disk groups can be deleted using the DROP DISKGROUP statement. HIGH REDUNDANCY . If the NAME clause is omitted the disks are given a system generated name like "disk_group_1_0001". Now let's look at basic administration of disk groups. Oracle recommend a minimum of 4 LUNs per disk group. so this will be the standard option for most in stallations. All LUNs within a disk group should be the same size and have the same perfo rmance characteristics. This statement all ows you to specify the level of redundancy: NORMAL REDUNDANCY . '/devices/diskb2' NAME diskb2. Typically. requiring three failure groups. th e FRA disk group will be twice the size of the DATA disk group. including multiplexed copies on online redo logs and controlfiles. If you have hardware RAID it should be used in preference to ASM redundancy. CREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY FAILGROUP failure_group_1 DISK '/devices/diska1' NAME diska1. with LUNs using hardwar e RAID and external redundancy if possible. LUNs should be made up from disks dedicated to Oracle. where DATA holds all database related files and FRA holds the fast recovery area. The FORCE option can be used to move a disk from anoth er disk group into this one.

p. -. -. . Disk groups can be rebalanced manually using the REBALANCE clause of the ALTER D ISKGROUP statement. Rebalancing is only needed when the speed of the automatic rebala ncing is not appropriate. '/devices/disk*4'.Resize a specific disk. disk_group_1 DISMOUNT. Disk groups are mounted at ASM instance startup and unmounted at ASM instance sh utdown. ALTER DISKGROUP disk_group_1 ADD DISK '/devices/disk*3'.Resize all disks in a failure group. ALTER DISKGROUP disk_group_1 RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 100G. -. T he statement can be used to resize individual disks. Disks can be resized using the RESIZE clause of the ALTER DISKGROUP statement. Manual mounting and dismounting can be accomplished using the ALTER DISKGROUP statement as seen below. If the POWER clause is omitted the ASM_POWER_LIMIT parameter value is used. -. ALL MOUNT. all disks in a failure grou p or all disks in the disk group. ALTER DISKGROUP disk_group_1 RESIZE ALL SIZE 100G. ALTER DISKGROUP disk_group_1 RESIZE DISK diska1 SIZE 100G. ALTER DISKGROUP disk_group_1 REBALANCE POWER 5. The UNDROP DISKS clause of the ALTER DISKGROUP statement allows pending disk dro ps to be undone. ALTER ALTER ALTER ALTER DISKGROUP DISKGROUP DISKGROUP DISKGROUP ALL DISMOUNT. It will not revert drops that have completed. ALTER DISKGROUP disk_group_1 UNDROP DISKS.Add disks.Drop a disk. -. or disk drops associated with the dropping of a disk group. disk_group_1 MOUNT.Resize all disks in a disk group. If the SIZE clause is omitted the disks are resi zed to the size of the disk returned by the OS. ALTER DISKGROUP disk_group_1 DROP DISK diska2.

MIRROR . modified and deleted. Available attributes include: UNPROTECTED .No mirroring or striping regardless of the redundancy setting.Specifies lower granuality for striping. -. -.Rename a directory. The following examples show how ASM directories can be cr eated. ALTER DISKGROUP disk_group_1 ADD TEMPLATE my_template ATTRIBUTES (MIRROR FIN E).Modify template.============================================================== ================================================ Templates == Templates are named groups of attributes that can be applied to the files within a disk group.Drop template. This attribute cannot be s et for external redundancy. -. The following example show how templates can be created. . ALTER DISKGROUP disk_group_1 DROP TEMPLATE my_template. ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir'. This attribute cannot be set for external redundancy. COARSE . This attribute cannot be s et for external redundancy.Specifies higher granularity for striping. FINE . altered and dropped. -.Delete a directory and all its contents. ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO '+di sk_group_1/my_dir_2'. -.Create a directory. -. ALTER DISKGROUP disk_group_1 ALTER TEMPLATE my_template ATTRIBUTES (COARSE). ===================================================================== Directo ries =============================================================== A directory heirarchy can be defined using the ALTER DISKGROUP statement to supp ort ASM file aliasing.Create a new template.Two-way mirroring for normal redundancy and three-way mirroring for high redundancy.

342. For these circumstances it is necessary to manually delete the files. -.dbf' TO '+disk_group_1/my_dir/my_file2.342.dbf'. ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/my_dir/my_file.Drop file using a numeric form filename.Rename an alias. =================================================================== ============================================== Aliases Aliases allow you to reference ASM files using user-friendly names. or if a recovery is done to a point-in-time before the file was created.3'. Files Files are not deleted automatically if they are created using aliases. rather than the fully qualified ASM filenames. -. as shown below. -. -. ALTER DISKGROUP disk_group_1 DELETE ALIAS '+disk_group_1/my_dir/my_file. ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file.dbf'. -.dbf' .3'.Drop file using a fully qualified filename.Delete an alias.34 2. ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1. Attempting to drop a system alias results in an error. -. ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file. ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/mydb/datafile/my_ts. -.ALTER DISKGROUP disk_group_1 DROP DIRECTORY '+disk_group_1/my_dir_2' FORCE.Drop file using an alias.Create an alias using the fully qualified filename.3'.dbf' FOR '+disk_group_1/mydb/datafile/my_ts. ALTER DISKGROUP disk_group_1 RENAME ALIAS '+disk_group_1/my_dir/my_file. as they a re not Oracle Managed Files (OMF).342.3'. .dbf' FOR '+disk_group_1.Create an alias using the numeric form filename.

-. ALTER DISKGROUP disk_group_1 CHECK FILE '+disk_group_1/my_dir/my_file. or a dependant database instance. ============================================================================= ASM Views ================================================== The ASM configuration can be viewed using the V$ASM_% views. ALTER DISKGROUP disk_group_1 CHECK DISK diska1.===============================================================Checking Metadata ============================================= The internal consistency of disk group metadata can be checked in a number of wa ys using the CHECK clause of the ALTER DISKGROUP statement.Check metadata for all disks in the disk group. ALTER DISKGROUP disk_group_1 CHECK FAILGROUP failure_group_1.Check metadata for a specific failure group in the disk group. which often contain different information depending on whether they are queried from the ASM instan ce. ALTER DISKGROUP disk_group_1 CHECK ALL. View ASM Instance DB Instance V$ASM_ALIAS Displays a row for each alias present in every disk group mounte .Check metadata for a specific disk in the disk group. -.Check metadata for a specific file. -.dbf' -.

ASM Filenames There are several ways to reference ASM file. which can be retrieved from the supporting views. Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communi cates. Returns no rows V$ASM_CLIENT Displays a row for each database instance using a disk group man aged by the ASM instance. Filename Type Format Fully Qualified ASM Filename rnation Numeric ASM Filename Alias ASM Filenames +dgroup/dbname/file_type/file_type_tag. V$ASM_DISK Displays a row for each disk discovered by the ASM instance. Displays a row for each disk group mounted by the local ASM inst ance.file. V$ASM_OPERATION Displays a row for each file for each long running opera tion executing in the ASM instance. V$ASM_FILE ASM instance. Displays no rows. Displays a row for each file for each disk group mounted by the Displays no rows. Some forms are used during creatio n and some for referencing ASM files. relying on ASM to create the fully qualified name. Displays a row for each disk in disk groups in use by the database instance. The forms of the ASM filenames are summarised below. V$ASM_DISKGROUP Displays a row for each disk group discovered by the ASM instance.incarnation +dgroup/directory/filename .inca +dgroup.d by the ASM instance. V$ASM_TEMPLATE Displays a row for each template present in each disk group moun ted by the ASM instance. The forms for file creation are incomplete . Displays a row for the ASM instance if the datab ase has open ASM files. inc luding disks which are not part of any disk group.file.

Alias ASM Filename with Template Incomplete ASM Filename +dgroup +dgroup(template)/alias Incomplete ASM Filename with Template SQL and ASM +dgroup(template) ASM filenames can be used in place of conventional filenames for most Oracle fil e types. ============================================================ Migrating to ASM Using RMAN ====================================================== The following method shows how a primary database can be migrated to ASM from a disk based backup: Disable change tracking (only available in Enterprise Edition) if it is curr ently being used. SQL> SHUTDOWN IMMEDIATE Modify the parameter file of the target database as follows: Set the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters t . Shutdown the database. the following command creates a new tablespace with a datafile in the disk_group _1 disk group. For example. logfiles etc. including controlfiles. SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING. CREATE TABLESPACE my_ts DATAFILE '+disk_group_1' SIZE 100M AUTOEXTEND ON. datafiles.

Create new redo logs in ASM and delete the old ones. Switch all datafile to the new ASM location. Open the database. .o the relevant ASM disk groups. RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group'. Enable change tracking if it was being used. RMAN> STARTUP NOMOUNT Restore the controlfile into the new location from the old location. RMAN> ALTER DATABASE MOUNT. RMAN> SWITCH DATABASE TO COPY. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING. Mount the database. Copy the database into the ASM disk group. If you are using a pfile the CONTROL_FILES parameter must be set to the appropri ate ASM files or aliases. RMAN> ALTER DATABASE OPEN. 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 automat ically. RMAN> RESTORE CONTROLFILE FROM 'old_control_file_name'. Start the database in nomount mode.

Sign up to vote on this title
UsefulNot useful