Friday, February 24, 2012

how to install ASM in few mins (windows)

Introduction:
This document describes the steps for creating ASM instance on Windows. We need to install only oracle binaries (From 11g R2, Grid Binary need to be installed).  After binary installation we can proceed to ASM instance creation manually.

Step 1:   Install oracle binaries

Oracle binary needs to be installed. Check for asmtool.exe and localconfig.bat files available on $ORACLE_HOME/bin. These are two important files which is required for creating disk and creating CSS respectively.
 
Step 2:   Creating disks using asmtool

Create a directory and create all the disks under that folder.
C:\>mkdir asm_disks
C:\>cd asm_disks
C:\asm_disks>asmtool -create c:\asm_disks\disk1 256
C:\asm_disks>asmtool -create c:\asm_disks\disk2 256
C:\asm_disks>asmtool -create c:\asm_disks\disk3 256
Here we have created 3 disks of size 256M.
NOTE: asmtool is the GUI tool for creating the disks. When you use this, You should have already partition the disk and use those disks in ASM. The partition should be NTFS.
 
Step 3:   Configuring Oracle CSS 

CSS is installed as part of CRS in RAC environment. This would be installed on CRS_HOME in case of RAC. On NON-RAC environment, it is installed in ORACLE_HOME.
Command to check the OCSS status:
C:\asm_disks>crsctl check cssd
Failure 1 contacting Cluster Synchronization Services daemon
 
Creating the OCSS Service:
C:\asm_disks>localconfig add
Step 1:  creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'administrator', privgrp ''..
Operation successful.
Step 2:  creating new CSS service
successfully created local CSS service
successfully added CSS to home
 
Now you can see the OracleCSService created and running on Windows services.
Start->Run->services.msc
C:\asm_disks>crsctl check cssd
Cluster Synchronization Services appears healthy
 
 
Step 4:   Creating ASM init file.

Create INIT+ASM.ora  file on $ORACLE_HOME/database directory.  Use the below minimum parameters
INSTANCE_TYPE= ASM
DB_UNIQUE_NAME= +ASM
LARGE_POOL_SIZE= 8M
ASM_DISKSTRING= 'c:\asm_disks\*'
_ASM_ALLOW_ONLY_RAW_DISKS= FALSE
 
We use “_ASM_ALLOW_ONLY_RAW_DISKS” parameter so that during the process of disk discovery, the disks what we have created above will be identified.  Else you won’t see any disks from ASM.
 
Step 5:   Starting up ASM instances

Create password file the service before you start the ASM instance. 
C:\>orapwd file= C:\app\administrator\product\11.1.0\db_1\database\PWD+ASM.ora password=asm
C:\>oradim –NEW –ASMSID +ASM
Now set ORACLE_HOME & ORACLE_SID
C:\> set ORACLE_HOME= C:\app\administrator\product\11.1.0\db_1
C:\>set ORACLE_SID=+ASM
C:\>sqlplus “/as sysdba”
SQL> startup
ASM instance started
Total System Global Area  535662592 bytes
Fixed Size                  1334380 bytes
Variable Size             509162388 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted
SQL>
 
Now we have created ASM instance. Next we will proceed with Diskgroup creation.
 
Step 6:   Creating Diskgroup.

Create diskgroup by using the existing disks.
SQL> col path for a30
SQL> select path, header_status from v$asm_disk;
PATH                           HEADER_STATU
------------------------------ ------------
C:\ASM_DISKS\DISK3             CANDIDATE
C:\ASM_DISKS\DISK1             CANDIDATE
C:\ASM_DISKS\DISK2             CANDIDATE
SQL> create diskgroup data external redundancy disk 'c:\asm_disks\disk*';
Diskgroup created.
SQL> select name, total_mb, free_mb from v$asm_diskgroup;
NAME                           File Size (MB)    FREE_MB
------------------------------ -------------- ----------
DATA                                      256        230
 
 
Step 7:   Creating spfile and setting ASM_DISKGROUPS.

SQL> show parameter pfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string
 
We are not using spfile, Hence trying to create the same here.
SQL> create spfile from pfile;
File created.
 
Now, Startup force will bring the instance and start it again. When the database is brought up, it will use the SPFILE as it was create on $ORACLE_HOME/database.

SQL> startup force;
ASM instance started
Total System Global Area  535662592 bytes
Fixed Size                  1334380 bytes
Variable Size             509162388 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted
 
We get “no diskgroups mounted” error during start up because, we have not specified any values in ASM_DISKGROUPS parameter. Now the database has been started using spfile.
Set the value for asm_diskgroups in spfile and restart the instance.

SQL> alter system set asm_diskgroups=data scope=spfile;
System altered.
SQL> startup force;
ASM instance started
Total System Global Area  535662592 bytes
Fixed Size                  1334380 bytes
Variable Size             509162388 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> select * from v$asm_diskgroup;
 
Conclusion: Here ends creation of asm on windows. You can install this on any system for having better hands on ASM.

3 comments:

  1. Nice Post Jay !!

    I will try .....

    Keep doing good work ;-)

    Thanks
    Mohit

    ReplyDelete
  2. hi jay
    i have a question i don't have oracle binaries.
    could you please let me know

    ReplyDelete