Sunday, January 3, 2010

Implementing Oracle ASM (Automatic Storage Management) on Linux

Hi all,
This is going to be my first post of Year 2010 so i am going to post about Oracle ASM (Automatic Storage Management) the super hit feature of Oracle10g database it has many benefits most commonly i m explaining here like

- Logical Volume management DBAs are not required to further think about the physical location of the indexes, tables etc etc.
- Performance of Raw Devices
- Centralized Storage management.
- Mirroring / stripping at DB level.


1. 2 Raw Partitions
- Not formatted with any file system i.e ext3 etc etc  Minimum 3 GB each for basic software install one for data files and one for flash recovery area.
- Oracle recommends that you create a single whole-disk partition on each disk that you want to use.
- Use fdisk command to setup partitions run the partprobe command after partitioning all disks so your kernel will becomes aware of partition changes.

2. OS user oracle and group dba
#groupadd dba
#useradd oracle -g dba

Here are the Steps to follow

1. Download ASM Libs for your OS and Kernel from 
(In my case i have downloaded Redhat Linux AS 4 Kernel 2.6.9-34.EL)
You can use "uname -r" command to determine exact version of Linux kernel. Make sure you have downloaded files Lib, Support and other RPMs

2. Install ASMLibs in following order to avoid package dependency errors make sure you are logged in as root
a. oracleasm-support
b. oracleasm
c. oracleasmlib

install using this command  (rpm -ihv  i - install /  -h --hash to display / -v verbose)
rpm -ihv package-name
# rpm -ihv oracleasm-support-2.1.3-1.el4
# rpm -ihv oracleasm-2.6.9-34.EL-2.0.3-1
# rpm -ihv oracleasm-2.6.9-34.ELsmp-2.0.3-1
# rpm -ihv oracleasmlib-2.0.4-1.el4

3. After successfully installing all required ASM packages next is to configure ASMLibs run the following command as root

/etc/init.d/oracleasm configure

Output would be like this

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 without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [dba]: dba
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]

Note: All ASM configuration will be stored at  /etc/sysconfig/oracleasm

4. To enable ASM run the following command
# /etc/init.d/oracleasm enable

5.Labeling Disk with ASM run the following command
(i am using Volume Management as OS level so my device path is different)

# /etc/init.d/oracleasm createdisk  disk-label device-path

# /etc/init.d/oracleasm createdisk DF1 /dev/sda2
# /etc/init.d/oracleasm createdisk DF2 /dev/mapper/VolGroup00-ASMDf
# /etc/init.d/oracleasm createdisk FRA1 /dev/mapper/VolGroup00-ASMFra

There u go we have completely configured our Linux system to use Oracle ASM still installation part is remaining.

Run Oracle database Installer and select software only then install ASM instance in separate Oracle HOME after that you can create database using dbca and select Automatic Storage Management to install ASM Instance. (I will write separate blog post for this installation procedure)

There are bunch of ASM related commands

Usage: oracleasm [--exec-path=] [ ]
       oracleasm --exec-path
       oracleasm -h
       oracleasm -V

The basic oracleasm commands are:
    configure        Configure the Oracle Linux ASMLib driver
    init                  Load and initialize the ASMLib driver
    exit                 Stop the ASMLib driver
    scandisks        Scan the system for Oracle ASMLib disks
    status              Display the status of the Oracle ASMLib driver
    listdisks          List known Oracle ASMLib disks
    querydisk       Determine if a disk belongs to Oracle ASMlib
    createdisk       Allocate a device for Oracle ASMLib use
    deletedisk       Return a device to the operating system
    renamedisk     Change the label of an Oracle ASMlib disk
    update-driver  Download the latest ASMLib driver

For further info on ASM i recommend this book from Oracle Press.

Feel free to comment on this post if i missed something plz inform me. i hope this post will help someone to implement Oracle ASM

Best Regards,

No comments:

Post a Comment