Search This Blog

Sunday, January 16, 2011

Create ASM instance Manualy on Oracle 10gR2 ( Using Virtual Box)

Automatic Storage Manage on Oracle 10gR2 RAC
Oracle Virtual Box 3.2.12 using Oracle Linux 5

Create the VM on Oracle Virtual Box 3.2.12 ( ASM_MACHINE)

Create VM's disks

"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk1.vdi --size 2048 --format VDI --variant Fixed
"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk2.vdi --size 2048 --format VDI --variant Fixed
"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk3.vdi --size 2048 --format VDI --variant Fixed

"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk4.vdi --size 2048 --format VDI --variant Fixed
"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk5.vdi --size 2048 --format VDI --variant Fixed
"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk6.vdi --size 2048 --format VDI --variant Fixed

"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk7.vdi --size 2048 --format VDI --variant Fixed
"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd --filename D:\ora-virtual-box\asm-disks\asm-disk8.vdi --size 2048 --format VDI --variant Fixed

Assign the disk to the machine ASM_MACHINE

"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk1.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk2.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 3 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk3.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 4 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk4.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 5 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk5.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 6 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk6.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 7 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk7.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ASM_MACHINE --storagectl "SATA Controller" --port 8 --device 0 --type hdd --medium D:\ora-virtual-box\asm-disks\asm-disk8.vdi




Install Oracle Linux 5 64bit , prepare Oracle's kernel parameters OS depended rpm packages.
....

Install ASMLib rpms using the following command

for the kernel: 2.6.18-194.el5
rpm -ivh oracleasm-support-2.1.3-1.el5.x86_64.rpm
rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm

Configure ASMLib using the following command
oracleasm configure -i

Load the kernel module using the following command.
usr/sbin/oracleasm init

Make sure you have the correct version of the driver
/usr/sbin/oracleasm update-driver

Mark the five shared disks as follows
/usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
/usr/sbin/oracleasm createdisk DISK2 /dev/sdc1
/usr/sbin/oracleasm createdisk DISK3 /dev/sdd1
/usr/sbin/oracleasm createdisk DISK4 /dev/sde1

/usr/sbin/oracleasm createdisk DISK5 /dev/sdf1
/usr/sbin/oracleasm createdisk DISK6 /dev/sdg1
/usr/sbin/oracleasm createdisk DISK7 /dev/sdh1
/usr/sbin/oracleasm createdisk DISK8 /dev/sdi1

Configuration the local CSS
( run it as root)

#localconfig delete
/etc/oracle does not exist. Creating it now.
/u01/app/oracle/product/10.2.0/db_1/bin/localconfig: line 737: /etc/init.d/init.cssd: No such file or directory

#localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
asm_machine
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

ps -ef | grep css
oracle 14277 1 0 21:36 ? 00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin

Create the ASM instance
Directories:
mkdir -p /oracle/admin/+ASM/bdump
mkdir -p /oracle/admin/+ASM/cdump
mkdir -p /oracle/admin/+ASM/udump

Pfile :
create the init+ASM.ora under $ORACLE_HOME/dbs and add the following :

background_dump_dest=/oracle/admin/+ASM/bdump
core_dump_dest=/oracle/admin/+ASM/cdump
user_dump_dest=/oracle/admin/+ASM/udump
instance_type=asm
compatible=10.2.0.4
large_pool_size=12M
remote_login_passwordfile=exclusive
ASM_DISKGROUPS=Dgroup1
ASM_DISKSTRING='ORCL:DISK*'

Password File:
orapwd file=orapw+asm password=oracle entries=5

/etc/oratab
+ASM:/u01/app/oracle/product/10.2.0/db_1:N


Start the ASM instance and Create Diskgroups
Note:
NORMAL REDUNDANCY (2-way mirroring by default for most file types)
HIGH REDUNDANCY (3-way mirroring for all files)


[oracle@asm_machine dbs]$ export ORACLE_SID=+ASM
[oracle@asm_machine dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jan 15 23:30:46 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount
ASM instance started

Total System Global Area 130023424 bytes
Fixed Size 2082208 bytes
Variable Size 102775392 bytes
ASM Cache 25165824 bytes
SQL>


GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH
------------ ----------- ------- ------------ -------- ------------
0 1 CLOSED PROVISIONED NORMAL ORCL:DISK2
0 2 CLOSED PROVISIONED NORMAL ORCL:DISK3
0 7 CLOSED PROVISIONED NORMAL ORCL:DISK8
0 4 CLOSED PROVISIONED NORMAL ORCL:DISK5
0 5 CLOSED PROVISIONED NORMAL ORCL:DISK6
0 6 CLOSED PROVISIONED NORMAL ORCL:DISK7
0 3 CLOSED PROVISIONED NORMAL ORCL:DISK4


•UNKNOWN - Automatic Storage Management disk header has not been read

•CANDIDATE - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement

•INCOMPATIBLE - Version number in the disk header is not compatible with the Automatic Storage Management software version.

•PROVISIONED - Disk is not part of a disk group and may be added to a disk group with the ALTER DISKGROUP statement.
The PROVISIONED header status is different from the CANDIDATE header status in that PROVISIONED
implies that an additional platform-specific action has been taken by an administrator to make the disk available for Automatic Storage Management.

•MEMBER - Disk is a member of an existing disk group. No attempt should be made to add the disk to a different disk group.
The ALTER DISKGROUP statement will reject such an addition unless overridden with the FORCE option

•FORMER - Disk was once part of a disk group but has been dropped cleanly from the group. It may be added to a new disk group with the ALTER DISKGROUP statement.

•CONFLICT - Automatic Storage Management disk was not mounted due to a conflict

•FOREIGN - Disk contains data created by an Oracle product other than ASM. This includes datafiles, logfiles, and OCR disks.





SQL>CREATE DISKGROUP Dgroup1 NORMAL REDUNDANCY
FAILGROUP controller1 DISK
'ORCL:DISK1',
'ORCL:DISK2'
FAILGROUP controller2 DISK
'ORCL:DISK3' ,
'ORCL:DISK4'
/

GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH
------------ ----------- ------- ------------ -------- ---------------
0 4 CLOSED PROVISIONED NORMAL ORCL:DISK5
0 5 CLOSED PROVISIONED NORMAL ORCL:DISK6
0 6 CLOSED PROVISIONED NORMAL ORCL:DISK7
0 7 CLOSED PROVISIONED NORMAL ORCL:DISK8
1 0 CACHED MEMBER NORMAL ORCL:DISK1
1 1 CACHED MEMBER NORMAL ORCL:DISK2
1 2 CACHED MEMBER NORMAL ORCL:DISK3
1 3 CACHED MEMBER NORMAL ORCL:DISK4