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

Synopsis. Oracle 10g’s Automatic Storage Management (ASM) features offer powerful tools to Oracle DBAs to create and manage a robust, flexible, scalable file storage system ready for access by any existing Oracle database instance. This article — the second in this series — provides a simple yet practical demonstration of setting up an ASM instance in both the Linux and Windows NT environments for purposes of exploration and experimentation, including how to migrate existing tablespaces to the ASM storage environment.

The previous article in this series presented a high-level overview of Oracle 10g’s new Automatic Storage Management (ASM) features and how ASM instances can be used in concert with other Oracle database instances to provide a scalable, reliable architecture for managing and monitoring large disk volumes via the ASM file system. Please note that this article and the corresponding examples are meant to demonstrate how ASM can be implemented on a small scale as a confidence-building exercise and to show how easy it is to set up ASM in an extremely basic single-CPU server environment. It is most definitely not intended as a starting point for a full-blown ASM implementation, which does (and should!) involve significant effort.

I will demonstrate how to set up an ASM instance in both the Linux and Windows NT operating systems, how to set up tablespaces in a database instance that uses ASM for data storage, and how to reconfigure Oracle 10g Enterprise Manager (EM) to monitor and manage the ASM instance. For my test bed servers I utilized Red Hat Enterprise Linux Advanced Server 3.0, kernel 2.4.1.2, and Windows XP 2002 Professional Service Pack 2 for these demonstrations; except where noted, all code listed as part of this article should work within either operating system.

Fortunately, the preparations required prior to creating the ASM instance and its disk groups are the most difficult part of this demonstration; once that’s done, the rest is relatively simple.

Preparing Disks for ASM: Windows NT

To simulate implementation of ASM in the Windows NT environment, I first created raw disk partitions on some of my hard drives. Fortunately, I had extra space on three of the four disks in my test server, so I created several primary disk partitions sized at 100MB on each of those three drives using the Windows Disk Partitioning utility (DISKPART.EXE):

C:> select disk 2
C:> Disk 2 selected.
C:> create partition primary size=100
C:> Partition created.
C:> create partition primary size=100
C:> Partition created.
C:> create partition primary size=100
C:> Partition created.
C:> select disk 3
C:> Disk 3 selected.
C:> create partition primary size=100
C:> Partition created.
...

Figure 2.1.1 shows the results of the successful disk partitioning.

Once the partitions are completed, I used the ASMTOOLG.EXE utility to “stamp” each partition with an ASM label so that Oracle can recognize these partitions as candidate disks for the ASM instance. I executed the ASMTOOLG.EXE program from the /bin directory of the Oracle home path for my Windows NT database. Figure 2.1.2 shows the initial screen that this GUI tool presented, and Figure 2.1.3 shows the screen that confirmed the creation of the ASM labels. Once the labels were assigned, I then re-invoked ASMTOOLG to confirm them (see Figure 2.1.4). I will also use ASMTOOLG to remove the labels prior to removing these partitions once my simulation is completed.

Preparing Disks for ASM: Linux

It is much simpler to simulate deployment of ASM in the Linux environment. From the root login, I created two new folders on separate disk spindles. I then used the dd command to create several empty files ready for use as ASM disks, and then set the appropriate permissions for those disks. See Listing 2.1 for the Linux commands required to accomplish this. (If you do not have separate spindles available, don’t worry; just create the two folders on the same disk.)

Creating an ASM Instance Using DBCA In Windows NT

Now that I have completed preparing all my disks, I used Oracle 10g’s Database Configuration Assistant (DBCA), the simplest method to create an ASM instance, since the specification of all ASM instance parameters and creation of the instance’s ASM Disk Groups is quite intuitive. I invoked DBCA from a command prompt on my Windows NT server and followed these steps:

  • First, I chose the Create a Database option (Figure 2.2.1) and clicked the Nextbutton.
  • I selected General Purpose as the Database Type (Figure 2.2.2) and clicked the Nextbutton.
  • Next, I supplied values for the Global Database Name (Figure 2.2.3) and clicked the Nextbutton.
  • I then accepted all default values for the Management Options (Figure 2.2.4) and clicked the Nextbutton.
  • I supplied the same password for all database management accounts (Figure 2.2.5) and clicked on Next.
  • At this point, I must decide to create the ASM instance. I did this by selecting the Automatic Storage Management (ASM) option (Figure 2.2.6), at which point I was presented with a screen for specification of the ASM instance’s additional password (Figure 2.2.7). Note that I could also click on the ASM Parameters button to specify exactly which directories Oracle should search for candidates for ASM disks, but in this case, I decided to let Oracle find the disks on its own. I clicked on Next to let Oracle create the ASM instance.
  • Once the ASM instance had been created successfully, the screen in Figure 2.2.8 was presented. After I clicked on the Create New button, Oracle displayed the screen in Figure 2.2.9 to show all Windows NT partitions that were candidates for ASM disk group creation. I then selected the partitions desired, supplied a name for the ASM disk group (DGROUP1), and clicked the OKbutton to complete the ASM disk group creation.
  • Once the ASM disk groups were created, Oracle presented one last screen (Figure 2.2.10) to confirm the disk group creation. At this point, even though it seems counter-intuitive, I clicked the Cancel button to complete the creation of the ASM instance, as there are no further steps required.

Creating an ASM Instance Using DBCA in Linux

I used this same methodology to create an ASM instance in Linux using DBCA. The only significant difference was the contents of the Disk Selection window (Figure 2.2.9), which instead showed the candidate disks I had previously created on that server for the Linux environment. In either of these cases, the end result is the same: Once I clicked on the Cancel button on the last screen, Oracle dismounted the ASM disk group I had created and then shut down the ASM instance as well.

Creating an ASM Instance without Using DBCA

Of course, I don’t have to use DBCA to create an ASM instance. Personally, I prefer to use command scripts to create my database because it is easier to customize the scripts to create other ASM instances in the future, and it also gives me complete control over what Oracle is doing “behind the screen.” In addition, an ASM instance is extremely easy to create because no CREATE DATABASE script is required, just an initialization parameter file like the one shown in Listing 2.2. Besides the usual initialization parameters for trace file directories, there are only a few additional ones required to create an ASM instance:

ASM Initialization Parameters

Initialization Parameter

Description

INSTANCE_TYPE

Defines the instance as an ASM instance. This is the only required parameter to identify an ASM instance; the remainder can be left at their defaults

DB_UNIQUE_NAME

Defines the service provider name for which this ASM instance manages disk groups. +ASM is the default value, and should not be modified unless multiple ASM instances are on the same node

ASM_POWER_LIMIT

Controls rebalance operation speed. Values range from 1 to 11, with 11 being the fastest. If omitted, this value defaults to 1. The number of slaves is derived from the parallelization level specified in a manual rebalance command (POWER), or by the ASM_POWER_LIMIT parameter

ASM_DISKSTRING

An operating system dependent value; used by ASM to limit the set of disks considered for discovery

ASM_DISK_GROUPS

Describes the list of ASM disk group names to be mounted by an ASM instance at startup, or whenever the ALTER DISKGROUP ALL MOUNT command is used

LARGE_POOL_SIZE

The LARGE POOL size. This must be set to a minimum of 8MB, but Oracle recommends setting this to 16MB

To create the ASM instance without using DBCA, I first made sure that I had created the directories I specified for BACKGROUND_DUMP_DEST, CORE_DUMP_DEST, and USER_DUMP_DEST. I also created a password file for the instance using the ORAPWD utility. (This is important, because when you attempt to connect to the ASM instance from Enterprise Manager, it will expect the instance to have the REMOTE_LOGIN_PASSWORDFILE initialization parameter set to EXCLUSIVE so that the instance can be contacted remotely and that means a password file will be required.)

ORAPWD file=c:oracleappproduct10.1.0db_1databasePWD+ASM.ora password=oracle

After I had made sure that the Oracle Cluster Services service was started in my Windows NT environment – it is usually named OracleCSService in the list of Windows Services that I can start – I then simply pointed my MS-DOS command window at the database instance by setting the value for ORACLE_SID to +ASM, started a SQL*Plus session, created an SPFILE from the parameter file, and then started the ASM instance in NOMOUNT mode:

C:> set ORACLE_SID=+ASM
C:> sqlplus "sys as sysdba"
SQL> Connected to an idle instance.
SQL> create spfile from pfile=c:init+asm.ora;
SQL> File created.
SQL> startup nomount;
SQL> ASM instance started
Jim Czuprynski
Jim Czuprynski
Jim Czuprynski has accumulated over 30 years of experience during his information technology career. He has filled diverse roles at several Fortune 1000 companies in those three decades - mainframe programmer, applications developer, business analyst, and project manager - before becoming an Oracle database administrator in 2001. He currently holds OCP certification for Oracle 9i, 10g and 11g. Jim teaches the core Oracle University database administration courses on behalf of Oracle and its Education Partners throughout the United States and Canada, instructing several hundred Oracle DBAs since 2005. He was selected as Oracle Education Partner Instructor of the Year in 2009. Jim resides in Bartlett, Illinois, USA with his wife Ruth, whose career as a project manager and software quality assurance manager for a multinational insurance company makes for interesting marital discussions. He enjoys cross-country skiing, biking, bird watching, and writing about his life experiences in the field of information technology.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles