Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Dec 22, 2005

Oracle 10g Automatic Storage Management (ASM), Part 2: Sample Implementation - Page 2

By Jim Czuprynski

Creating ASM Disk Groups without Using DBCA

If I am using DBCA to create my sample ASM instance, Oracle formats the commands necessary to create the initial ASM disk group(s) for the instance during its creation. However, I can also create the ASM disk groups separately after the necessary instance creation scripts have run successfully using the code shown in Listing 2.3. I have provided two different examples, one each for the Windows NT and Linux environments.

Starting and Stopping an ASM Instance

An ASM instance is managed in much the same way as a database instance, with a few exceptions. The major difference is that an ASM instance is never opened like a regular Oracle instance is opened, only mounted; therefore, I will either issue the STARTUP NOMOUNT; command to start just the ASM instance's memory processes, and then finish mounting the database with the ALTER DATABASE MOUNT; command. I can also open the ASM instance immediately by issuing the STARTUP MOUNT; command.

Starting a Dormant ASM Instance. To start up a dormant ASM instance, I first have to remember to set the ORACLE_SID environment variable appropriately. In addition, before I can start the ASM instance in the Windows NT environment, I also need to remember to first start the Oracle Cluster Service as well as the ASM instance's service. Of course, I do not need to worry about this in the Linux environment – the Cluster Service should have already been set up as part of the standard Linux installation of Oracle 10g.

To start up the ASM instance, I then simply issue the STARTUP MOUNT command. Here is how a successful ASM instance startup appears in the Linux environment:

$> export ORACLE_SID=+ASM
$> sqlplus "sys as sysdba"
SQL*Plus: Release - Production on Tue Dec 13 16:58:17 2005
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Enter password: ********
Connected to an idle instance.
SQL> startup mount;
ASM instance started
Total System Global Area  100663296 bytes
Fixed Size                   787648 bytes
Variable Size              99875648 bytes
Database Buffers                  0 bytes
Redo Buffers                      0 bytes
ASM diskgroups mounted

Shutting Down an Active ASM Instance. To shut down this ASM instance, I once again set the ORACLE_SID environment variable and then simply issue the SHUTDOWN IMMEDIATE; command:

$> export ORACLE_SID=+ASM
$> sqlplus "sys as sysdba"
SQL> Connected.
SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown

Implications of Shutting Down an Active ASM Instance. Now, a warning: When an ASM instance is shut down, it is important to be aware of the implications for any regular Oracle database instance that is using ASM files stored on that ASM instance. The ASM files will not be accessible to those regular Oracle databases until the ASM instance is restarted.

Demonstrating ASM in a Sample Database

Now that I have explained how to create, start, and stop an ASM instance, I will next demonstrate how to add a tablespace to an existing Oracle database instance that uses the ASM instance's disk group instead of the database instance's disk storage to store the new tablespace's datafile.

Creating an ASM-Managed Tablespace. What I really like about ASM is its simplicity. I no longer need to be concerned if the tablespace's datafile will fit on the drive or spindle I have targeted for storage; I simply inform ASM that it is responsible for storing the datafile and how large the datafile is, and ASM handles the rest.

All I needed to do to create a new tablespace, TBS_ASM1, was to issue the following CREATE TABLESPACE command from a SQL*Plus session running against the database instance:

Tablespace created.

Note that I did not have to specify the exact location of the datafile, since ASM determined from the size of the tablespace exactly how it should be striped across the disks in the ASM disk group. Moreover, since ASM uses Oracle Managed Files (OMF) for naming the datafile, ASM automatically named the datafile using the appropriate OMF standard. (I will delve into ASM file naming conventions in greater detail in the next article in this series.)

Even more interesting, I did not have to do anything special to inform the database instance that it needed to start up the appropriate Rebalancing (RBAL) and ASM Bridge (ASM) processes. As soon as this new tablespace was created, the database instance detected that ASM storage was in use, and it automatically started these two background processes, as this snippet from the database's alert log clearly shows:

Sun Dec 11 18:35:00 2005
Sun Dec 11 18:35:03 2005
Starting background process ASMB
ASMB started with pid=21, OS id=776
Starting background process RBAL
RBAL started with pid=22, OS id=3524
Sun Dec 11 18:35:09 2005
SUCCESS: diskgroup DGROUP1 was mounted

Migrating an Existing Tablespace to ASM-Managed Storage. Another great thing about ASM: I did not have to recreate an existing tablespace when I wanted to migrate it to ASM storage. Instead, I used Recovery Manager (RMAN) to create an image copy of the tablespace's datafile, and then I simply migrated that datafile to ASM. To demonstrate, I created a new tablespace in the database instance. I then issued the appropriate RMAN commands to take the tablespace offline, create the image copy of the tablespace, transfer the tablespace to ASM, and then bring the tablespace back online. See Listing 2.4 for the SQL statements and RMAN commands that I used to complete this task.

Setting Up Enterprise Manager (EM) for ASM Instance Management

Oracle 10g Enterprise Manager (EM) does provide a simple and elegant way to manage ASM storage; however, I needed to reconfigure my database instance's EM configuration to take advantage of these tools via the Enterprise Manager Configuration Assistant (EMCA). Once I had created the ASM instance and had then created at least one ASM-managed file in my database instance, I removed the original EM configuration for the database instance and then replaced it with a new EM configuration that fully supports ASM. A sample set of EMCA commands are shown in Listing 2.5.

After I restarted the EM Database Console service for my database, I was then able to view details about the ASM instance as well by clicking on the ASM link on my database instance's home page (see Figure 2.3 for an example of that screen). I will explore the various diagnostic tools and maintenance operations available via EM in more detail in the next article in this series.

Viewing ASM Instance Information Via SQL Queries

Finally, there are several dynamic and data dictionary views available to view an ASM configuration from within the ASM instance itself:

ASM Dynamic Views: ASM Instance Information

View Name



Shows every alias for every disk group mounted by the ASM instance


Shows which database instance(s) are using any ASM disk groups that are being mounted by this ASM instance


Lists each disk discovered by the ASM instance, including disks that are not part of any ASM disk group


Describes information about ASM disk groups mounted by the ASM instance


Lists each ASM file in every ASM disk group mounted by the ASM instance


Like its counterpart, V$SESSION_LONGOPS, it shows each long-running ASM operation in the ASM instance


Lists each template present in every ASM disk group mounted by the ASM instance

I was also able to query the following dynamic views against my database instance to view the related ASM storage components of that instance:

ASM Dynamic Views: Database Instance Information

View Name



Shows one row per each ASM disk group that's mounted by the local ASM instance


Displays one row per each disk in each ASM disk group that are in use by the database instance


Lists one row per each ASM instance for which the database instance has any open ASM files

See Listing 2.6 for the SQL*Plus queries that I used to view information from the ASM and database instances.

Next Steps

The next article in this series will concentrate on some of the more advanced features of ASM, including how to add disks to and remove disks from an ASM disk group, how to increase the survivability of ASM disk groups with additional striping and mirroring features, and how to monitor and manage ASM storage through the Enterprise Manager (EM) interface.

References and Additional Reading

While there is no substitute for direct experience, reading the manual is not a bad idea, either. I have drawn upon the following Oracle 10g documentation for the deeper technical details of this article:

B10130-02 Oracle Database Installation Guide 10g ( For Windows, Section 2.5.3

B10739-01 Oracle Database Administrator's Guide, Chapter 12

B10743-01 Oracle Database Concepts, Chapter 14

B10755-01 Oracle Database Reference

B10759-01 Oracle Database SQL Reference

» See All Articles by Columnist Jim Czuprynski

Oracle Archives

Latest Forum Threads
Oracle Forum
Topic By Replies Updated
Oracle Data Mining: Classification jan.hasller 0 July 5th, 07:19 AM
Find duplicates - Unique IDs Lava 5 July 2nd, 08:30 AM
no matching unique or primary key rcanter 1 April 25th, 12:32 PM
Update values of one table based on condition of values in other table using Trigger Gladiator 3 February 29th, 06:01 PM