Thursday 28 June 2012

Creating Standalone ASM instance in Oracle 11gR2 using "Oracle Grid Infrastructure"



Creating ASM disk using Oracle ASMLib


1) Download Oracle ASMLib from following site ==> 
   http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html

   Identify the kernel version to download the correct Drivers for Kernel

   Use the following command to identify the kernel version

   [root@coltdb04 ~]# uname -r
   2.6.18-274.el5

   In my case it is 64bit RHEL OS , so I downloaded following rpms to install Oracle ASMLib

            oracleasm-support-2.1.7-1.el5.x86_64.rpm
            oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
            oracleasmlib-2.0.4-1.el5.x86_64.rpm

2) The rpm's should be applied in the same order, otherwise you will get a dependencies error

rpm -Uvh oracleasm-support-2.1.7-1.el5.x86_64.rpm
rpm -Uvh oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
rpm -Uvh oracleasmlib-2.0.4-1.el5.x86_64.rpm

3) Configure Oracle ASM Library driver

[root@coltdb04 init.d]# /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 <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: 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  ]

4) You can check the Oracle ASM status
[root@coltdb04 init.d]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

5) Creating a new Partition for ASM disk

[root@coltdb04 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
  e   extended
    p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652): +5000M

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@coltdb04 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          38      305203+  83  Linux
/dev/sda2              39        3405    27045427+  83  Linux
/dev/sda3            3406        3916     4104607+  82  Linux swap / Solaris

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         609     4891761   83  Linux

6) To create a ASM disk using Oracle ASMLib 
[root@coltdb04 ~]# oracleasm createdisk DISK1 /dev/sdb1
Writing disk header: done
Instantiating disk: done

7) To List and check the Oracle ASM disks
[root@coltdb04 ~]# oracleasm listdisks
DISK1
[root@coltdb04 ~]# oracleasm querydisk DISK1
Disk "DISK1" is a valid ASM disk



Creating Oracle Standalone ASM instance on Oracle 11gR2 (11.2.0.3)


1) Once the Oracle ASM disk is created, We have to create the ASM instance using Oracle Grid Infrastructure
   
   In Oracle 11gR2, the ASM instance is Installed on new "Grid Infrastructure home".
   
   Also unlike in previous editions, we don't require "localconfig add" to configure CSS before creating ASM Instance

2) Download the Grid Infrastructure software from Oracle support site and install it using ./runInstaller

3) Select "Configure Oracle Grid Infrastructure for a Standalone Server"




4) As you can see the ASM Disk -DISK1, which we created earlier is visible here. Give the Disk Group Name (DATA) and Redundancy as required. 


5) In Oracle 11gR2 we have a new "SYSASM" Privilege to manage the ASM instance. Provide the password for the same.


 6) Once the all the prerequisite are met, you will receive the "install" screen


7) At the end execute "root.sh" as a root user and complete the installation.


8) Verify whether the ASM instance is created and
   
        [oracle@coltdb04 grid]$ sqlplus

        SQL*Plus: Release 11.2.0.3.0 Production on Thu Jun 28 02:58:10 2012

        Copyright (c) 1982, 2011, Oracle.  All rights reserved.

        Enter user-name: / as sysasm

       Connected to:
       Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
       With the Automatic Storage Management option


       SQL> select INSTANCE_NAME,VERSION,STATUS from v$instance;

                  INSTANCE_NAME    VERSION           STATUS
                   ---------------- ----------------- ------------
                          +ASM             11.2.0.3.0        STARTED




       SQL> select NAME,STATE,TOTAL_MB,FREE_MB,COMPATIBILITY from                  V$ASM_DISKGROUP;

              NAME                           STATE         TOTAL_MB    FREE_MB
              ------------------------------ -----------             ----------          ----------


                 DATA                           MOUNTED           4777       4718








No comments:

Post a Comment