Monday, October 3, 2011

How to create Oracle ASM instance environment in windows with oracle database 10g ?

How to configure ASM instance environment (within 10 minutes) in windows for oracle database 10g

if you want to convert non ASM to ASM instance then click here

STEP-1) we can configure ASM instance DISKS environment in two ways

one :- not using RAW device or logical DISK drive
--------------------------------------------------------

*._ASM_ALLOW_ONLY_RAW_DISKS=false (in pfile)

This parameter is for not using RAW or logical drive(windows) .
we can view the ASM DISKS, for training purpose we can use it.
for this we have to start for step - 2

Two :- using RAW/ logical DISK
-------------------------------------------------
in this way we cannot see the disks .

A ) First we have to create some logical drive (RAW in unix) not formated by NTFS or somethink file system , not assign any drive letter .
we can do this from below

My computer >right click> Manage> Disk Management
or you can do it via DISKPART.EXE command line utility .

B) Once the partitions are completed, use the ASMTOOLG.EXE utility to "stamp" each partition with an ASM label so that Oracle can recognize these partitions as candidate disks for the ASM instance. I executed the ASMTOOLG.EXE program from the /bin directory of the Oracle home path for my Windows NT database
CMD> ASMTOOLG.EXE (granphical) in 10g
CMD> ASMTOOL.EXE (command line in 10g) like below

ASMTOOL -create \\.\G:\oracle\asmhalim\asm_disks\ASMDISK1.ASM 100m

(we will create below)

after stamped the disks for ASM you can find them, when you try create ASM instance.



STEP-2)

you can Use DBCA for creating ASM instance .
at the storage page of the DBCA , you have to select Automatic Storage Management (ASM) the next disk group , diskes etc.
or
you can create manually (command line) . here i am executed manual steps ..



Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>

C:\Documents and Settings\Administrator>
C:\Documents and Settings\Administrator>cd ..

C:\Documents and Settings>cd ..

C:\>
C:\>
C:\>oradim -new -asmsid +ASMHALIM -startmode manual
Instance created.

C:\>oradim -edit -asmsid +ASMHALIM -startmode a

C:\>
C:\>oradim -edit -asmsid +ASMHALIM -syspwd sys

C:\>
C:\>SET ORACLE_SID=+ASMHALIM

C:\>
C:\>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 3 15:33:33 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL>
SQL> conn / as sysdba
Connected to an idle instance.
SQL>

here i created a txt file name "initasm.ora" in location 'G:\oracle\asmhalim\'
this is the init ora (pfile of the ASM instance) .


*.background_dump_dest='G:\oracle\asmhalim\bdump'
*.core_dump_dest='G:\oracle\asmhalim\cdump'
instance_type=asm
*.large_pool_size=100M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='G:\oracle\asmhalim\udump'
*._ASM_ALLOW_ONLY_RAW_DISKS=false
*.asm_diskstring='G:\oracle\asmhalim\asm_disks\*'

The setting of asm_diskstring is very important, this should be set to the directory where you are going to create the "ASM files" that will be disks.
*._ASM_ALLOW_ONLY_RAW_DISKS=false this is for not using RAW or logical(windows) drive .



SQL>
SQL> startup pfile='G:\oracle\asmhalim\initasm.ora'
ORA-29701: unable to connect to Cluster Manager
SQL>
SQL>
SQL> host
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>set oracle_sid=+ASMHALIM

C:\>
C:\> localconfig delete
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
failed to open the OCR subkey, err(1060)
failed to cleanup local OCR repository
successfully deleted local CSS setup

C:\>
C:\>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

C:\>
C:\>
C:\>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 3 15:44:07 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL>
SQL>
SQL> startup pfile='G:\oracle\asmhalim\initasm.ora'
ASM instance started

Total System Global Area 176160768 bytes
Fixed Size 1247948 bytes
Variable Size 149746996 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted


SQL>
SQL>
SQL> create spfile from pfile='G:\oracle\asmhalim\initasm.ora' ;

File created.

Asm instance are created . but not diskgroup . now need to create diskgroup .
before creating diskgroup , we have to create some disks ( this are creating using ASMTOOL.exe as says above)

(ignored if we created RAW disks as STEP-1 using DISK MANAMENT/DISKPART.EXE AND ASMTOOLG or ASMTOOL )

SQL>
SQL>
SQL> host
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>
C:\>ASMTOOL -create \\.\G:\oracle\asmhalim\asm_disks\ASMDISK1.ASM 100m

C:\>
C:\>
C:\>ASMTOOL -create \\.\G:\oracle\asmhalim\asm_disks\ASMDISK2.ASM 100m

C:\>
C:\>ASMTOOL -create \\.\G:\oracle\asmhalim\asm_disks\ASMDISK3.ASM 100m

C:\>ASMTOOL -create \\.\G:\oracle\asmhalim\asm_disks\ASMDISK4.ASM 100m

C:\>

C:\>
C:\>SQLPLUS /NOLOG

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 3 16:15:40 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL>
SQL>
SQL> CONN / AS SYSDBA
Connected.

SQL>
SQL>
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 G:\ORACLE\ASMHALIM\ASM_DI
SKS\ASMDISK1.ASM
0 3 CLOSED CANDIDATE NORMAL G:\ORACLE\ASMHALIM\ASM_DI
SKS\ASMDISK4.ASM
0 2 CLOSED CANDIDATE NORMAL G:\ORACLE\ASMHALIM\ASM_DI
SKS\ASMDISK3.ASM
0 1 CLOSED CANDIDATE NORMAL G:\ORACLE\ASMHALIM\ASM_DI
SKS\ASMDISK2.ASM

SQL>
SQL>
SQL>
SQL> show parameter inst

NAME TYPE VALUE
------------------------------------ ----------- -------------------
active_instance_count integer
cluster_database_instances integer 1
instance_groups string
instance_name string +asmhalim
instance_number integer 0
instance_type string asm
open_links_per_instance integer 4
parallel_instance_group string
parallel_server_instances integer 1
SQL>


-----creating a diskgroup

SQL> ed
Wrote file afiedt.buf

1 CREATE DISKGROUP diskgp1 NORMAL REDUNDANCY
2 FAILGROUP controller1 DISK
3 'G:\oracle\asmhalim\asm_disks\ASMDISK1.ASM' NAME disk1,
4 'G:\oracle\asmhalim\asm_disks\ASMDISK2.ASM' NAME disk2
5 FAILGROUP controller2 DISK
6* 'G:\oracle\asmhalim\asm_disks\ASMDISK3.ASM' NAME disk3
SQL>
SQL> /

Diskgroup created.

SQL>
SQL> ed
Wrote file afiedt.buf

1 select GROUP_NUMBER,name ,type,total_mb, free_mb
2* from v$asm_diskgroup
SQL>
SQL> /

GROUP_NUMBER NAME TYPE TOTAL_MB FREE_MB
------------ ------------------------------ ------ ---------- ----------
1 DISKGP1 NORMAL 300 196

SQL>
SQL>

-------------adding a disk into a diskgroup

SQL>
SQL> alter diskgroup diskgp1 add disk 'G:\oracle\asmhalim\asm_disks\ASMDISK4.ASM' ;

Diskgroup altered.

SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select GROUP_NUMBER,name ,type,total_mb, free_mb
2 from v$asm_diskgroup
3 /

GROUP_NUMBER NAME TYPE TOTAL_MB FREE_MB
------------ ------------------------------ ------ ---------- ----------
1 DISKGP1 NORMAL 400 245

SQL>

2 comments:

Unknown said...

Hi,

I am trying to create database using dbca.bat file through comand line (Silent installation). Before creating database, i tried to configure ASM instance using -configureASM option available with dbca.bat.
But while running this command the log file throws this error

"ORA-15018: diskgroup cannot be created
ORA-15031: disk specification '\device\harddisk0\partition1' matches no disks
ORA-15056: additional error message"

The command i ran was

"C:\>G:\DB\HOME\BIN\dbca.bat -silent -configureASM -asmsyspassword tiger -diskGroupname DATA -disklist \device\harddisk0\partition1"

I am able to create diskgroup using GUI.

I am using Oracle10g

Unknown said...

Hi,
I am trying to configure ASM through commandline using dbca.bat

The command i ran was

C:\>G:\DB\HOME\BIN\dbca.bat -silent -configureASM -asmsyspassword tiger -diskGroupname DATA -disklist \device\harddisk0\partition1

But error was thrown in the log file saying

ORA-15018: diskgroup cannot be created
ORA-15031: disk specification '\device\harddisk0\partition1' matches no disks
ORA-15056: additional error message

I am using oracle10g.
I was able to create diskgroup using GUI.