Configure Oracle ASM on Test Server without Real Disk Devices

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

Note: I have an ASM instance already running on the node named "+ASM". 

Create ASM Disk Groups
  • Creating Files for use by ASM
  • The first step is to identify an already partitioned and formatted hard disk that contains enough space to contain the blank files to be used as ASM disk devices.
  • For the purpose of this example, I already have an ASM instance running on the same node named "+ASM".
  • For the purpose of this example, I have enough room on my local hard disk (C:\) to create four files at 100MB each. I want to create one disk group that contains 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:

Set Initialization Parameter
I have an ASM instance already running on the node named "+ASM". We need to set the following initialization parameters in the ASM instance to allow ASM to use a device rather than a RAW / Logical disk (in our case, a blank text file) 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;

Bounce the ASM Instance

SQL> shutdown
SQL> startup

Create New Directory for Device Files

mkdir C:\asmdisks

Create Files for ASM Disks

You may use perl.exe from perl binaries that ship with oracle , you may search perl exe in oracle directory
<perlpath>\perl CreateTextFiles.pl


CreateTextFiles.pl
You may use notepad to paste this code and save as 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