Oracle DBA Tips Corner |
How to use Files in place of Real Disk Devices for ASM - (Windows)
by Jeff Hunter, Sr. Database Administrator
Contents
Overview
Creating Files for use by ASM
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:
As already mentioned, 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:
Now the cool part, to make four 100MB text files using Perl. You can use
the Perl binary that came installed with Oracle or download ActivePerl
using the following location:
http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl
Here is the Perl script:
Now, run the Perl script using your favorite Perl interpreter:
Create ASM Disk Groups
Let's start by determining if Oracle can find these 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 ASM instance with SYSDBA privileges.
Here is the query that I ran from the ASM instance as the oracle
user account:
Using SQL*Plus, the following will create a disk group with normal redundancy
and two failure groups:
Now, let's take a look at the new disk group and disk details:
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.
This article provides the 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!
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 a detailed article on configuring ASM, see my article:
"Manually Creating an ASM Instance".
SQL> alter system set "_asm_allow_only_raw_disks"=false scope=spfile;
SQL> alter system set asm_diskstring='c:\asmdisks\_file*' scope=both;
SQL> shutdown
SQL> startup
mkdir C:\asmdisks
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
C:\oracle\product\10.1.0\db_1\perl\5.6.1\bin\MSWin32-x86\perl CreateTextFiles.pl
Ok, so now that we have devices that can be seen by the O/S, we can
now discover these disks within ASM and then create our ASM disk group.
The following assumes you have the initialization parameter
asm_diskstring set properly for the ASM instance. For the purpose of this example,
my asm_diskstring parameter is set as follows:
*.asm_diskstring='C:\ASMDISKS\_FILE*'
set oracle_sid=+ASM
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. The next
section details the steps for creating a disk group.
set oracle_sid=+ASM
sqlplus "/ as sysdba"
SQL> CREATE DISKGROUP testdb_data1 NORMAL REDUNDANCY
2 FAILGROUP controller1 DISK 'C:\ASMDISKS\_FILE_DISK1', 'C:\ASMDISKS\_FILE_DISK2'
3 FAILGROUP controller2 DISK 'C:\ASMDISKS\_FILE_DISK3', 'C:\ASMDISKS\_FILE_DISK4';
Diskgroup created.
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
Friday, 08-Sep-2006 15:37:19 EDT
Page Count: 13118