Tuesday, June 7, 2011

ORACLE AUTOMATIC STORAGE MANAGEMENT


Automatic Storage Management (ASM) needs RAW disks to store files. As we know raw disks cannot be opened so we cannot view the files we are storing. If you are implementing ASM in your organization you are probably going to use a complete Hard Drive but for this tutorial I am going to create RAW disk just to show you how things work,
Creating RAW disks :
From command prom go to the directory you want to create raw disks for example I will create a folder in E drive with the name asmdisks.
C:\documents and settings\administrator> E:
E:>mkdir asmdisks
E:>cd asmdisks
E:\asmdisks> asmtool –create E:\asmdisks\disk1 1000
E:\asmdisks> asmtool –create E:\asmdisks\disk2 1000
E:\asmdisks> asmtool –create E:\asmdisks\disk3 1000
E:\asmdisks> asmtool –create E:\asmdisks\disk3 1000
Now that we have for raw LUN with 1gb space each we have to create CSS and OCR  service
C:\documents and settings\administrator> oracle\product\10.2.0\db_1\BIN\localconfig add (if you have created CSS service before write RESET beside add)
You will see this in your command prom
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
Step 3: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'ap\arogyaa', privgrp ''..
Operation successful.
Step 4: creating new CSS service
successfully created local CSS service
successfully reset location of CSS setup

Now we have to create pfile for ASM open text file and copy these parameters in it
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
LARGE_POOL_SIZE=8M (can be increased to 16M)
ASM_DISKSTRING='
E:\asmdisks\disk1',’E:\asmdisks\disk2’,’E:\asmdisks\disk2’,’E:\asmdisks\disk3’,’E:\asmdisks\disk4’
_ASM_ALLOW_ONLY_RAW_DISKS=FALSE
Save this txt file with any name asm.ora
Create service and password file
C:\documents and settings\administrator> orapwd file=C:\oracle\product\10.2.0\db_1\database\PWD+ASM.ora password=asm (if it cannot be created in the given directory create it any place else and copy it to the default location).
Create ASM service
C:\documents and settings\administrator>oradim –new –asmsid +asm –startmode auto
Create asm disk group
Log into sqlplus and check the available disks
select path, mount_status from v$asm_disk;
 it will return this
PATH MOUNT_S
--------------------------------
C:\ASMDISKS\DISK1 CLOSED
C:\ASMDISKS\DISK2 CLOSED
C:\ASMDISKS\DISK3 CLOSED
C:\ASMDISKS\DISK4 CLOSED
SQL> create diskgroup data external redundancy disk
 'E:\ASMDISKS\DISK1','E:\ASMDISKS\DISK2';
Diskgroup created.

SQL> create diskgroup recovery external redundancy disk
 'E:\ASMDISKS\DISK3','E:\ASMDISKS\DISK4';
Diskgroup created.
Change PFILE to SPFILE and use the DBCA to create the database in DBCA you will see that the diskgroups are not mounted but there is an option to mount them use that option on both disksgroups and use data group for data and recovery for recovery …That’s it now you have Oracle with ASM system..Enjoy Thanks for Reading..