Oracle 10g Automatic Storage Management (ASM), Part 2: Sample Implementation
December 22, 2005
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 22.214.171.124, 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:
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:
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:\oracle\app\product\10.1.0\db_1\database\PWD+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