Sunday, September 29, 2013

Oracle ASM 11g -- Using Flat Files as ASM Disks On Windows Server 2008 64-bit

Problem

You want to install Oracle ASM 11g Release 2 (11.2.0.3) for lab/testing purposes with use of flat files.

 

Solution

For sake of simplicity Windows Server platform was chosen. But the same steps should also work for other platforms.
 
Beginning with release 11.2 Oracle ASM has become a part of Oracle Grid Infrastructure. Thus you will have to download an installation media for Oracle Grid Infrastructure from Oracle support site (more likely p10404530_112030_MSWIN-x86-64_3of7.zip for MS Windows Server 64-bit platform).
 
Note that Oracle Grid Infrastructure only runs on Microsoft 64-bit platforms.

Step 1. Get the Installation Media

Download and extract Oracle Grid Infrastructure 11g Release 2 installation media to local file system.
 
If on Windows you can also use a shared folder. In this case have to use a full path specification, for example: \\VBOXSVR\shared\11203_database_win64\grid. Otherwise you will get an error like The specified path does not exist when you try to start the installer.

Step 2. Installation

Install Oracle Grid Infrastructure.
 
At Step 2 choose Install Oracle Grid Infrastructure Software Only option. This is required because otherwise you will be asked to provide valid disk partitions or any other mean to configure Oracle ASM. And as you want to use files instead of any disk partitions or storage LUNs you will not be able to proceed with option but Software Only installation.
 
Now proceed with installation. Go through all eight of installation process.
 
At Prerequisite Checks step you might be warned about Firewall status and TCP/IP Media Sensing. To solve the first warning disable the Windows Firewall. For the second one add DisableDHCPMediaSense key of type DWORD with value 1 to HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Tcpip/Parameters.
 
Start Installation. At end of successful installation, Step 8, you will be asked to execute a command as Administrator to configure Oracle Grid Infrastructure. Choose the first command for Stand-Alone Server.

For example:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>C:\app\11.2.0\grid\perl\bin\perl -IC:\app\11.2.0\grid\perl\lib -IC:\app\11.2.0\grid\crs\install C:\app\11.2.0\grid\crs\install\roothas.pl
2013-09-29 21:49:43: Checking for super user privileges
2013-09-29 21:49:43: superUser=Administrator groupName=Administrators
2013-09-29 21:49:43: domain=MYDOMAIN user=ADMINISTRATOR
2013-09-29 21:49:43: C:\app\11.2.0\grid\bin\crssetup.exe getsystem
2013-09-29 21:49:43: Executing cmd: C:\app\11.2.0\grid\bin\crssetup.exe getsystem
2013-09-29 21:49:44: Command output:
>  SYSTEM
>End Command output
2013-09-29 21:49:44: User has Administrator privileges
Using configuration parameter file: C:\app\11.2.0\grid\crs\install\crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'administrator', privgrp ''..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'administrator', privgrp ''..
Operation successful.
CRS-4664: Node ora11gr2 successfully pinned.
09/29/13 21:49:55  OracleOHService service installed
OhasdConfigureRegistry:  started
OhasdConfigureRegistry:  completed with 0
09/29/13 21:49:57  OracleOHService service started
ohasd is starting

ora11gr2     2013/09/29 21:50:30     C:\app\11.2.0\grid\cdata\ora11gr2\backup_20130929_215030.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

C:\Windows\system32>

Now you have successfully installed and configured Oracle Grid Infrastructure.

Step 3. Setup Oracle ASM Instance

To be able to start an Oracle ASM Instance you have to first start Oracle Clusterware Synchronization Service.

Execute the following command to check the status of Oracle Clusterware Synchronization Service:

C:\Windows\system32>crsctl status resource ora.cssd
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=OFFLINE
STATE=OFFLINE


To bring Oracle Clusterware Synchronization Service online execute the following command:

C:\Windows\system32>crsctl start resource ora.cssd
CRS-2672: Attempting to start 'ora.cssd' on 'ora11gr2'
CRS-2676: Start of 'ora.cssd' on 'ora11gr2' succeeded

 
 Now create ASM instance using oradim utility.
 
C:\Windows\system32>oradim -new -asmsid +asm
Instance created.
 
Now start up newly created ASM instance in nomount mode.
 
C:\Windows\system32>set oracle_sid=+asm
C:\Windows\system32>sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 29 22:16:10 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-00099: warning: no parameter file specified for ASM instance
ASM instance started
Total System Global Area  283930624 bytes
Fixed Size                  2254504 bytes
Variable Size             256510296 bytes
ASM Cache                  25165824 bytes
SQL>
 
As you see you can start ASM instance with no parameter file specified. Oracle just use a dummy parameter file. Now to be able to create parameter file from memory you have to execute following command. Otherwise you will get ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200] lsts[0]] error.
 
C:\Windows\system32>srvctl add asm
 
Now create pfile from memory.
 
SQL> create pfile from memory;
File created.
 
You will find your pfile in the <Grid_home>/database directory. This way is handy as it will will create the pfile in right location with right name. Although all the required parameter for now are below. Edit your pfile.
 
asm_diskstring=c:\asm_disks\d*
_asm_allow_only_raw_disks=false
 
When you have updates you pfile create a spfile.
 
SQL> create spfile from pfile;
File created.
 
Restart you ASM instance:
 
SQL> startup force nomount
ASM instance started
Total System Global Area  283930624 bytes
Fixed Size                  2254504 bytes
Variable Size             256510296 bytes
ASM Cache                  25165824 bytes
SQL>
 

Step 4. Create a Diskgroup

Now when your ASM instance is in place you can create a diskgroup with usual files as asm disks.
 
First create raw files on your file system in the directory specified by asm_diskstring parameter. For this you can use asmtool command.
 
C:\Windows\system32>asmtool -create c:\asm_disks\disk1 100
C:\Windows\system32>asmtool -create c:\asm_disks\disk2 100
C:\Windows\system32>asmtool -create c:\asm_disks\disk3 100

Check that new created disk are eligible fro asm disk group.

SQL> column path format a20
SQL> select path, header_status from v$asm_disk;

PATH                 HEADER_STATU
-------------------- ------------
C:\ASM_DISKS\DISK1   CANDIDATE
C:\ASM_DISKS\DISK3   CANDIDATE
C:\ASM_DISKS\DISK2   CANDIDATE


Now call Automatic Storage Manager Configuration Assistant (ASMCA) and create your new asm diskgroup using flat files.

No comments: