Simulating ASM with 10g Database by faking the hardware
![Pankaj Chandiramani's picture Pankaj Chandiramani's picture](http://www.orafaq.com/files/pictures/picture-32.jpg)
Caution: This method is for Testing & Learning purposes only.
Most of the Oracle 10g databases are using ASM for storage as it's very simple to maintain the storage w.r.t. to Disks, Datafiles etc.
You can get most of the ASM details & implementation details from OTN here: http://www.oracle.com/technology/asm/index.html
When I started to learn ASM, the real difficult part was to get a test hardware to play with, I looked are to find ways to simulate the asm env & have documented the procedure as below:
Simulating Asm by faking hardware:
1. Faking Hardware
2. Installing ASM Lib
3. Configuring the disks
4. Install DB & ASM instance
Faking Hardware:
Step 1) Here we create 4 zero-filed files using the DD comand
As "root" run the following commands, this will create 4 files of 2Gb each.
mkdir /asmdisk dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000 dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000 dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000 dd if=/dev/zero of=/asmdisk/disk4 bs=1024k count=2000
Step 2) Use the loopback device to assign these disks.
/sbin/losetup /dev/loop1 /asmdisk/disk1 /sbin/losetup /dev/loop2 /asmdisk/disk2 /sbin/losetup /dev/loop3 /asmdisk/disk3 /sbin/losetup /dev/loop4 /asmdisk/disk4
Now we need to configure entries to the file "/etc/rc.local" so that these divices are re-initialised on reboot also.
Add the following entries to the file "/etc/rc.local"
/sbin/losetup /dev/loop1 /asmdisk/disk1 /sbin/losetup /dev/loop2 /asmdisk/disk2 /sbin/losetup /dev/loop3 /asmdisk/disk3 /sbin/losetup /dev/loop4 /asmdisk/disk4 /etc/init.d/oracleasm createdisk ASM1 /dev/loop1 /etc/init.d/oracleasm createdisk ASM2 /dev/loop2 /etc/init.d/oracleasm createdisk ASM3 /dev/loop3 /etc/init.d/oracleasm createdisk ASM4 /dev/loop4
Instaling ASM Lib
ASMLib is a support library for the Automatic Storage Management feature of Oracle Database 10g. ASMLib allows an Oracle Database using ASM more efficient and capable access to the disk groups it is using. ASMlib are provided by Oracle from below link : http://www.oracle.com/technology/tech/linux/asmlib/index.html
Please download the Lib files according to your OS & kernel version.
[root@csstage root]# uname -r 2.4.21-27.EL
It gives 3 rpms for download as per the version , pls install then using below command
[root@csstage asm]# rpm –ivh *.rpm
After this completes we go to next step of configuring the disks.
Configuring the ASM Lib & disks
Now we need to use the ASM Lib, configure it & configure the disks accordingly.
[root@csstage root]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver:
This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting
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 ]
Now as the ASM Lib are configured, we will configure the disks:
[root@csstage root]# /etc/init.d/oracleasm createdisk ASM1 /dev/loop1 Marking disk "/dev/loop1" as an ASM disk: [ OK ] [root@csstage root]# /etc/init.d/oracleasm createdisk ASM2 /dev/loop2 Marking disk "/dev/loop2" as an ASM disk: [ OK ] [root@csstage root]# /etc/init.d/oracleasm createdisk ASM3 /dev/loop3 Marking disk "/dev/loop3" as an ASM disk: [ OK ] [root@csstage root]# /etc/init.d/oracleasm createdisk ASM4 /dev/loop4 Marking disk "/dev/loop4" as an ASM disk: [ OK ]
So, now our hardware is all set to go & we need to install 10g database on the server using the above disks.
Install DB & ASM instance
Now we install the Database with ASM option
Create the ASM Instance
ASM runs as a separate Oracle instance, which can be created and configured using OUI. Now that ASMLib is installed and the disks are marked for use, you can create an ASM instance.
Log in as oracle and start runInstaller:
$ ./runInstaller
1. Select Installation Method
- Select Advanced Installation
- Click on Next
2. Specify Inventory Directory and Credentials
- Inventory Directory: /u01/app/oracle/oraInventory
- Operating System group name: oinstall
- Click on Next
3. Select Installation Type
- Select Enterprise Edition
- Click on Next
4. Specify Home Details
- Name: Ora10gAsm
- Path: /u01/app/oracle/product/10.2.0/asm
Note:Oracle recommends using a different ORACLE_HOME for ASM than the ORACLE_HOME used for the database for ease of administration.
- Click on Next
5. Product-specific Prerequisite Checks
- If you've been following the steps in this guide, all the checks should pass without difficulty. If one or more checks fail, correct the problem before proceeding.
- Click on Next
6. Select Configuration Option
- Select Configure Automatic Storage Management (ASM)
- Enter the ASM SYS password and confirm
- Click on Next
7. Configure Automatic Storage Management
Disk Group Name: DATA
- Redundancy
-- High mirrors data twice.
-- Normal mirrors data once. This is the default.
-- External does not mirror data within ASM. This is typically used if an external RAID array is providing redundancy.
- Add Disks
The disks you configured for use with ASMLib are listed as Candidate Disks. Select each disk you wish to include in the disk group.
- Click on Next
8. Summary
- A summary of the products being installed is presented.
- Click on Install.
9. Execute Configuration Scripts
- At the end of the installation, a pop up window will appear indicating scripts that need to be run as root. Login as root and run the indicated scripts.
- Click on OK when finished.
10. Configuration Assistants
- The Oracle Net, Oracle Database, and iSQL*Plus configuration assistants will run automatically
11. End of Installation
- Make note of the URLs presented in the summary, and click on Exit when ready.
12. Congratulations! Your new Oracle ASM Instance is up and ready for use.
Create the Database:
Once the ASM instance has been created, create a database that uses ASM for storage:
Log in as oracle and start runInstaller:
$ ./runInstaller
1. Select Installation Method
- Select Advanced Installation
- Click on Next
2. Select Installation Type
- Select Enterprise Edition
- Click on Next
3. Specify Home Details
- Name: OraDb10g
- Path: /u01/app/oracle/product/10.2.0/db
Note:Oracle recommends using a different ORACLE_HOME for the database than the ORACLE_HOME used for ASM.
- Click on Next
4. Product-specific Prerequisite Checks
- If you've been following the steps in this guide, all the checks should pass without difficulty. If one or more checks fail, correct the problem before proceeding.
- Click on Next
5. Select Configuration Option
- Select Create a Database
- Click on Next
6. Select Database Configuration
- Select General Purpose
- Click on Next
7. Specify Database Configuration Options
- Database Naming: Enter the Global Database Name and SID
- Database Character Set: Accept the default
- Database Examples: Select Create database with sample schemas
- Click on Next
8. Select Database Management Option
- Select Use Database Control for Database Management
- Click on Next
9. Specify Database Storage Option
- Select Automatic Storage Management (ASM)
- Click on Next
10. Specify Backup and Recovery Options
- Select Do not enable Automated backups
- Click on Next
11. Select ASM Disk Group
- Select the DATA disk group created in the previous section
- Click on Next
12. Specify Database Schema Passwords
- Select Use the same password for all the accounts
- Enter the password and confirm
- Click on Next
13. Summary
- A summary of the products being installed is presented.
- Click on Install.
14. Configuration Assistants
- The Oracle Net, Oracle Database, and iSQL*Plus configuration assistants will run automatically
15. Execute Configuration Scripts
- At the end of the installation, a pop up window will appear indicating scripts that need to be run as root. Login as root and run the indicated scripts.
- Click on OK when finished.
16. End of Installation
- Make note of the URLs presented in the summary, and click on Exit when ready.
17. Congratulations! Your new Oracle Database is up and ready for use.
Note: In between the installation , You might be asked to start CSS Deamon , if you havent already done.
To start the CSS daemon and configure the host to always start the daemon upon reboot, do the following:
1. Log in to the host as root.
2. Ensure that $ORACLE_HOME/bin is in your PATH environment variable.
3. Enter the following command: localconfig add
Start the ASM instance:
$ export ORACLE_SID=+ASM $ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on Sun Sep 3 00:28:09 2006 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ASM instance started Total System Global Area 83886080 bytes Fixed Size 1217836 bytes Variable Size 57502420 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> select group_number,disk_number,name,state,mode_status,mount_status,total_mb, from v$asm_disk; G# D# NAME STATE MODE_ST MOUNT_S TOTAL_MB ---- ---------- ---------- 1 0 ASM1 NORMAL ONLINE CACHED 2000 1 1 ASM2 NORMAL ONLINE CACHED 2000 1 2 ASM3 NORMAL ONLINE CACHED 2000 1 3 ASM4 NORMAL ONLINE CACHED 2000 1 4 ASM5 NORMAL ONLINE CACHED 2000 2 0 ASM6 NORMAL ONLINE CACHED 2000 2 1 ASM7 NORMAL ONLINE CACHED 1000
You can get most of the ASM details & implementation details from OTN at: http://www.oracle.com/technology/asm/index.html
References:
This article is a derivative work based on Laptop ASM on Linux by Howard J. Rogers.
- Pankaj Chandiramani's blog
- Log in to post comments
Comments
Well written
This is a nice article and will certainly help people wanting to play around with ASM, perhaps on their laptops. However, I would appreciate if you can write a 'windows version' of this article.
Great work. Keep it up!
Nice way to test ASM :-)
Very good article - especially for unix-like systems.
Another good and simply way to test ASM is VMWare virtual machine (or using other virtualization software)
A windows version...
...of this technique is available from http://www.dizwell.com/prod/node/33.
There is also a Linux version that doesn't bother using the ASMLib libraries available at http://www.dizwell.com/prod/node/35
suggestion
It is well organize and clean procedure for linux platform users. is there any way for you to post the same kind of procedure for window platform users as well.
Thanks
Lamar
Great
Thanks for sharing! Done Great!