Monday, November 19, 2007

Testing ASM on the Windows platform Using blank files

Testing ASM on the Windows platform Using blank files


Ref: http://www.idevelopment.info/data/Oracle/DBA_tips/Automatic_Storage_Management/ASM_22.shtml


Environment: Oracle 10gR2 on Windows XP PC

1. Use DBCA to create an ASM instance

During this process, run the following script as asked:

C:\oraclexe\app\oracle\product\10.2.0\server\BIN>localconfig.bat add
Step 1: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'denis', privgrp ''..
Operation successful.
Step 2: creating new CSS service
successfully created local CSS service
successfully added CSS to home

Notes: An ASM service will be automatically created

2. Set Initialization Parameter

C:\> set ORACLE_SID=+ASM
C:\> sqlplus "/ as sysdba"
SQL> alter system set "_asm_allow_only_raw_disks"=false scope=spfile;
SQL> alter system set asm_diskstring='e:\asmdisks\_file*' scope=both;

3. Bounce the ASM Instance

SQL> shutdown
SQL> startup

- verify the parameter
SQL> show parameters asm

NAME TYPE VALUE
------------------------------------ ----------- -----------------------------
_asm_allow_only_raw_disks boolean FALSE
asm_diskgroups string
asm_diskstring string e:\asmdisks\_file*
asm_power_limit integer 1


4. Create New Directory for Device Files

mkdir e:\asmdisks

5. Create Files for ASM Disks

make four 100MB text files using Perl.

------- creatTextFile.pl -----------------
my $s='0' x 2**20;

open(DF1,">E:/asmdisks/_file_disk1") die "Cannot create file - $!\n";
open(DF2,">E:/asmdisks/_file_disk2") die "Cannot create file - $!\n";
open(DF3,">E:/asmdisks/_file_disk3") die "Cannot create file - $!\n";
open(DF4,">E:/asmdisks/_file_disk4") die "Cannot create file - $!\n";

for (my $i=1; $i<100; style="font-weight: bold;">

Notes:
We can use asmtool to create files
asmtool -create \\server\share\file

E:\asmdisks>asmtool -create e:\asmdisks\_file_disk10 100


6. Confirm we can discover the 'disk' now

Log into the ASM instance, issue

col path format a30
SELECT group_number, disk_number, mount_status, header_status, state, path
FROM v$asm_disk;

GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH
------------ ----------- ------- ------------ -------- ------------------------------
0 0 CLOSED CANDIDATE NORMAL E:\ASMDISKS\_FILE_DISK1
0 3 CLOSED CANDIDATE NORMAL E:\ASMDISKS\_FILE_DISK4
0 2 CLOSED CANDIDATE NORMAL E:\ASMDISKS\_FILE_DISK3
0 1 CLOSED CANDIDATE NORMAL E:\ASMDISKS\_FILE_DISK2



7. Create ASM disk group

Using SQL*Plus, create a disk group with normal redundancy and two failure groups:

set ORACLE_SID=+ASM
sqlplus "/ as sysdba"

SQL> CREATE DISKGROUP orcl_dg1 NORMAL REDUNDANCY
FAILGROUP controller1 DISK 'e:\ASMDISKS\_FILE_DISK1', 'e:\ASMDISKS\_FILE_DISK2'
FAILGROUP controller2 DISK 'e:\ASMDISKS\_FILE_DISK3', 'e:\ASMDISKS\_FILE_DISK4';
Diskgroup created.


sys@ORCL> 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 ORCL_DG1 396 290 MOUNTED NORMAL



GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH
------------ ----------- ------- ------------ -------- ------------------------------
1 0 CACHED MEMBER NORMAL E:\ASMDISKS\_FILE_DISK1
1 1 CACHED MEMBER NORMAL E:\ASMDISKS\_FILE_DISK2
1 2 CACHED MEMBER NORMAL E:\ASMDISKS\_FILE_DISK3
1 3 CACHED MEMBER NORMAL E:\ASMDISKS\_FILE_DISK4

8. Use ASM disk group
SQL> create tablespace users2 datafile '+ORCL_DG1' size 100m;


sys@ORCL> select tablespace_name, file_name from dba_data_files order by 1;

TABLESPACE_NAME FILE_NAME
------------------------------ ----------------------------------------
AUTO_TBS E:\ORADATA\ORCL\AUTO_TBS_DATA01.DBF
EXAMPLE C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCL\EXAMPLE01.DBF
HISTORY E:\ORADATA\HISTORY01.DBF
MANUAL_TBS E:\ORADATA\ORCL\MANUAL_TBS_DATA01.DBF
PART1 E:\ORADATA\ORCL\PART1_01.DBF
PART2 E:\ORADATA\ORCL\PART2_01.DBF
PART3 E:\ORADATA\ORCL\PART3_01.DBF
PART4 E:\ORADATA\ORCL\PART4_01.DBF
SEQ E:\ORADATA\ORCL\DATAFILE\O1_MF_SEQ_3MKLG
ORW_.DBF

SYSAUX C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCL\SYSAUX01.DBF

SYSTEM C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCL\SYSTEM01.DBF

UNDOTBS1 C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCL\UNDOTBS01.DBF

UNDO_BATCH E:\ORADATA\ORCL\UNDO_DATCH01.DBF
USERS C:\ORACLEXE\APP\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCL\USERS01.DBF

USERS2 +ORCL_DG1/orcl/datafile/users2.256.63904
9975

No comments: