DBA Tips Archive for Oracle


[an error occurred while processing this directive]

No Title

[an error occurred while processing this directive]

by Michael New, MichaelNew@earthlink.net, Gradation LLC



This guide provides the steps to create and configure blank files (instead of real disk devices) for use in testing Oracle's Automatic Storage Manager (Oracle ASM) on the Windows platform. This is a handy trick that can be used when the DBA needs to test Oracle ASM on a machine that has no free disk partitions or no free disk devices available.


The procedures document in this guide are solely for the purpose of testing Oracle ASM and should never be considered for a critical database environment.

Create Device Files for use by ASM

The first step is to identify an already partitioned and formatted hard disk that contains enough space to store the blank files to be used as ASM disk devices.

A total of four (4) files at 100MB each will be created on the local hard disk (C:\). A single disk group will be created containing the four disks. The disk group will contain two failure groups and each failure group will be created using two disks.

From within the Windows O/S platform, perform the following actions.

  1. An Oracle ASM instance is already running on the node named +ASM. Set the following initialization parameters for the ASM instance to allow ASM to use a device rather than a RAW / Logical disk (a blank text file for this example) and to discover from a non-default location.

    SQL> alter system set "_asm_allow_only_raw_disks"=false scope=spfile; SQL> alter system set asm_diskstring='c:\asmdisks\_file*' scope=both;

  2. Bounce the Oracle ASM instance.

    SQL> shutdown SQL> startup

  3. Create a new directory for device files.

    C:\> mkdir C:\asmdisks

  4. Now the cool part, to make four 100MB text files using Perl which will act as device files for Oracle ASM. You can use the Perl binary that came installed with Oracle or download ActivePerl.

    Create the following Perl script (CreateTextFiles.pl).

    # CreateTextFiles.pl my $s='0' x 2**20; open(DF1,">C:/asmdisks/_file_disk1") || die "Cannot create file - $!\n"; open(DF2,">C:/asmdisks/_file_disk2") || die "Cannot create file - $!\n"; open(DF3,">C:/asmdisks/_file_disk3") || die "Cannot create file - $!\n"; open(DF4,">C:/asmdisks/_file_disk4") || die "Cannot create file - $!\n"; for (my $i=1; $i<100; $i++) { print DF1 $s; print DF2 $s; print DF3 $s; print DF4 $s; } exit

    Now, run the Perl script using your favorite Perl interpreter.

    C:\> C:\oracle\product\10.1.0\db_1\perl\5.6.1\bin\MSWin32-x86\perl CreateTextFiles.pl

Create ASM Disk Groups

For the purpose of this example, an Oracle ASM instance is already running on the node named +ASM.


For a detailed guide on configuring Oracle ASM on Oracle Database 10g, see my article "Manually Creating an ASM Instance".

With the new device files in place and seen by the O/S, discover these disks within Oracle ASM and then create the disk group.

Start by determining if Oracle can find the four new disks. The view V$ASM_DISK can be queried from the ASM instance to determine which disks are being used or may potentially be used as ASM disks. Note that you must log into the Oracle ASM instance with SYSDBA privileges. Run the following query from the Oracle ASM instance as SYSDBA.


The following assumes that the initialization parameter asm_diskstring is set properly for the ASM instance.

For the purpose of this example, the asm_diskstring parameter is set as follows:


C:\> set oracle_sid=+ASM C:\> sqlplus "/ as sysdba" SQL> SELECT group_number, disk_number, mount_status, header_status, state, path 2 FROM v$asm_disk GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH ------------ ----------- ------- ------------ ------- ----------------------- 0 0 CLOSED CANDIDATE NORMAL C:\ASMDISKS\_FILE_DISK1 0 1 CLOSED CANDIDATE NORMAL C:\ASMDISKS\_FILE_DISK2 0 2 CLOSED CANDIDATE NORMAL C:\ASMDISKS\_FILE_DISK3 0 3 CLOSED CANDIDATE NORMAL C:\ASMDISKS\_FILE_DISK4

Note the value of zero in the GROUP_NUMBER column for all four disks. This indicates that a disk is available but hasn't yet been assigned to a disk group.

Create a disk group with normal redundancy and two failure groups.


Validate the new disk group and disk details.

SQL> select group_number, name, total_mb, free_mb, state, type 2 from v$asm_diskgroup; GROUP_NUMBER NAME TOTAL_MB FREE_MB STATE TYPE ------------ -------------- ---------- ---------- ----------- ------ 1 TESTDB_DATA1 396 290 MOUNTED NORMAL SQL> select group_number, disk_number, mount_status, header_status, state, path, failgroup 2 from v$asm_disk; GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH FAILGROUP ------------ ----------- ------- ------------ -------- ----------------------- ------------ 1 0 CACHED MEMBER NORMAL C:\ASMDISKS\_FILE_DISK1 CONTROLLER1 1 1 CACHED MEMBER NORMAL C:\ASMDISKS\_FILE_DISK2 CONTROLLER1 1 2 CACHED MEMBER NORMAL C:\ASMDISKS\_FILE_DISK3 CONTROLLER2 1 3 CACHED MEMBER NORMAL C:\ASMDISKS\_FILE_DISK4 CONTROLLER2

About the Author

Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.

Copyright (c) 1998-2018 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Thursday, 19-Jan-2012 01:13:43 EST
Page Count: 38960