Friday, June 22, 2007

Simulating ASM on 10g by Faking Hardware

CAUTION : This method is only for the TESTING Purpose.
DO NOT BUILD PRODUCTION SYSTEM USING THIS PROCEDURE.

Hardware Requirement :
One Node with Linux Operating System

Software Requirement :
Oracle 10g Dump
ASM Library Files
ASM Command Line Utility

Must Read:
http://www.oracle.com/technology/products/database/asm/index.html

Introduction:
The below steps will help you to build a testing environment of ASM 10g by faking hardware.
The installation has been performed on a single node linux system with no external disk.
I have taken advice from linux experts on faking the hardware.

ASM stands for Automatic Storage Management. It is a feature of Oracle Database 10g that provides DBA's with a simple storage management interface that is consistent across all the server and storage platforms.
As a vertically integrated file system and volume manager, purpose-built for Oracle database files, ASM provides the performance of async I/O with the easy management of a file system
ASM provides capability that saves the DBAs time and provides flexibility to manage a dynamic database environment with increased efficiency.

ASM Flexibility : ASM has its own File Managment System , thus it helps the DBA in adding more physical storage , change storage configuration and remove failed storage devices for maintenace without shutting down the database.
The ASM Instance will be more flexible and handled most of the Space Management Tasks

ASM is very flexible that when it is required to have ASM maintain the Database, the regular running database can run with the traditional filesystem. New Tablespaces can be created under ASM Instance. Later on the Downtime available the regular database can be migrated to ASM.

Mirroring of Data: There is no need to purchase any third-party Logical Volume Manager(LVM). ASM provides fault tolerance by allowing data to write duplicate copies of the data file's contents.

Input-Output Load: ASM takes the responsibility for providing equal distribution of I/O Loads across all available disk storage resources.

DBA's Productivity : If ASM , the DBA can stop worries about physical and logical space management and concentrate on other potential performance issues.

The below setup will undergo the following steps;
Faking the Hardware
Installing ASM Libraries and Configuring the Disks
Installing ASM Instance and Database
Faking the Hardware :
We will use loopback device to create the disk. Loop devices sees a regular file as a device.
More info on Loop Back Device at http://en.wikipedia.org/wiki/Loop_device

Step 1: Create Zero filled files using DD command

As a root user run the following command to create the zero filled disks each of 1GB in size.
mkdir /asmdisks
dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=1000
dd if=/dev/zero of=/asmdisks/disk2 bs=1024k count=1000
dd if=/dev/zero of=/asmdisks/disk3 bs=1024k count=1000
dd if=/dev/zero of=/asmdisks/disk4 bs=1024k count=1000
dd if=/dev/zero of=/asmdisks/disk5 bs=1024k count=1000

Step 2: Assign the Zero filled files to the loopback devices.

/sbin/losetup /dev/loop1 /asmdisks/disk1
/sbin/losetup /dev/loop2 /asmdisks/disk2
/sbin/losetup /dev/loop3 /asmdisks/disk3
/sbin/losetup /dev/loop4 /asmdisks/disk4
/sbin/losetup /dev/loop5 /asmdisks/disk5

Step 3: Configuring to reinitilized the loopback device on a reboot.

Add the following entries to the file "/etc/rc.local"
/sbin/losetup /dev/loop1 /asmdisks/disk1
/sbin/losetup /dev/loop2 /asmdisks/disk2
/sbin/losetup /dev/loop3 /asmdisks/disk3
/sbin/losetup /dev/loop4 /asmdisks/disk4
/sbin/losetup /dev/loop5 /asmdisks/disk5
/etc/init.d/oracleasm createdisk ASMD1 /dev/loop1
/etc/init.d/oracleasm createdisk ASMD2 /dev/loop2
/etc/init.d/oracleasm createdisk ASMD3 /dev/loop3
/etc/init.d/oracleasm createdisk ASMD4 /dev/loop4
/etc/init.d/oracleasm createdisk ASMD5 /dev/loop5

Now at Hardware level we have setup the disks.


Installing ASM Libraries and Configuring the Disks:

Download the ASM Libraries from the below website that matches your operating system kernel version.
http://www.oracle.com/technology/tech/linux/asmlib/index.html

[root@lab01]# uname -r
2.6.9-34.EL

[root@lab01 Stage]# rpm -ivh *.rpm
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.9-34.EL ########################################### [ 67%]
3:oracleasmlib ########################################### [100%]

Configuring the ASM Libraries :
/etc/init.d/oracleasm configure
Default user to own the driver interface []: oracle
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]

Configuring the ASM Disks :
[root@lab01]# /etc/init.d/oracleasm createdisk ASMD1 /dev/loop1
Marking disk "/dev/loop1" as an ASM disk: [ OK ]
[root@lab01]# /etc/init.d/oracleasm createdisk ASMD2 /dev/loop2
Marking disk "/dev/loop2" as an ASM disk: [ OK ]
[root@lab01]# /etc/init.d/oracleasm createdisk ASMD3 /dev/loop3
Marking disk "/dev/loop3" as an ASM disk: [ OK ]
[root@lab01]# /etc/init.d/oracleasm createdisk ASMD4 /dev/loop4
Marking disk "/dev/loop4" as an ASM disk: [ OK ]
[root@lab01]# /etc/init.d/oracleasm createdisk ASMD5 /dev/loop5
Marking disk "/dev/loop5" as an ASM disk: [ OK ]

Now ASM Disk Configuration is completed , now we are set to start the Installer and Select the Disk we created and configure ASM.

Installing ASM Instance and Database:
Download 10g Database and Start the Installer. The following slides will better explain the steps



Once this Step is completed , you will find the ASM Instance Up and Running.
Now we need to invoke the DBCA to create the Database on top of ASM Instance. The following slides will better explain the steps;



Summary :
We are now done with the ASM Installation. Will post more on the Operational Procedure like Sequence of Shutting Down the Database , Adding DataFile , Converting Traditional Datafile to ASM Managed Files and other Storage Management related to ASM.

CAUTION : The above method is only for the TESTING Purpose.
DO NOT BUILD PRODUCTION SYSTEM USING THIS PROCEDURE.

Popular Posts