DBA Tips Archive for Oracle
How to use Files in place of Real Disk Devices for ASM - (10g, Linux)
by Jeff Hunter, Sr. Database Administrator
This guide provides the steps to create and configure blank files (instead of real disk devices) for use in testing Oracle's Automatic Storage Manager (Oracle ASM) on the Linux platform. This is a handy trick that can be used when the DBA needs to test Oracle ASM on a machine that has no free disk partitions or no free disk devices available.
The first step is to identify an already partitioned and formatted hard disk that contains enough space to store the blank files to be used as ASM disk devices.
A total of four (4) files at 100MB each will be created on the local hard disk (/dev/sda1). A single disk group will be created containing the four disks. The disk group will contain two failure groups and each failure group will be created using two disks.
From within the Linux O/S platform, perform the following actions.
Create new text files using "dd".
We now have four files to be used as virtual disks of 100MB each.
Use the losetup command to associate a loop device with a file. This needs to be performed as the root user account.
Use the raw utility to bind a RAW device to each of the block devices we already created. Again, this needs to be performed as the root user account.
Change the ownership of all four RAW devices.
After completeting the above steps, the O/S will see four free 'devices' now available for Oracle ASM.
For the purpose of this example, an Oracle ASM instance is already running on the node named +ASM.
With the new device files in place and seen by the O/S, discover these disks within Oracle ASM and then create the disk group.
Start by determining if Oracle can find these four new disks.
The view V$ASM_DISK can be queried from the ASM instance to determine which disks are being used or may potentially be used as ASM disks. Note that you must log into the Oracle ASM instance with SYSDBA privileges. Run the following query from the Oracle ASM instance as SYSDBA.
Note the value of zero in the GROUP_NUMBER column for all four disks. This indicates that a disk is available but hasn't yet been assigned to a disk group.
Create a disk group with normal redundancy and two failure groups.
Validate the new disk group and disk details.
Many of the above O/S commands will need to be put into a startup script that runs before the database starts. For this example, a file named /etc/init.d/dbora is already in place to start the database during the boot process. Add the following commands before starting the database.
The next step is to edit the /etc/oratab file to allow the dbora script to automatically start and stop databases. Alter the final field in the +ASM and TESTDB entry from N to Y. Ensure that the Oracle ASM instance is started before any databases that are making use of disk groups contained in it.
The final step to manually edit the script /etc/inittab so that the entry to respawn init.cssd comes before running the runlevel 3.
Orignal /etc/inittab file.
Modified /etc/inittab file.
Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.
Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at firstname.lastname@example.org.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.
Last modified on
Thursday, 19-Jan-2012 01:13:08 EST
Page Count: 47941