Configuring Oracle ASM on Oracle 11gR2

General Comments:
  • Oracle Grid Infrastructure (OGI) provides system support for an Oracle database:
    • - Volume Management: Oracle ASM
    • - File System: Oracle ASM, Oracle ACFS
    • - Automatic Restart capabilities: Oracle Restart
  • To use Oracle ASM, OGI MUST be installed BEFORE installing database software.

  1. Check requirements for OGI installation
  2. Configure Oracle Grid user's environment
  3. Design and configure storage schema for ASM
  4. Configure disks for ASM - Install ASMLib
  5. Configure ASM Disks - oracleasm
  6. Install Grid Infrastructure
  7. Configure Diskgroups

Check requirements for OGI installation
Memory Requirements:
  • Min 1.5Gb of RAM for OGI. Min 1 Gb for Database software.
  • Swap space: 1.5 times RAM
Disk Space requirements:
  • Min 5.5 Gb on disk. Min 1.5 Gb on /tmp

$ grep MemTotal /proc/meminfo
MemTotal:      1932856 kB
$ grep SwapTotal /proc/meminfo
SwapTotal:     2097144 kB

$ free
             total       used       free     shared    buffers     cached
Mem:       1932856     473832    1459024          0      24196     334204
-/+ buffers/cache:     115432    1817424
Swap:      2097144          0    2097144

Configure Oracle Grid user's environment
Create OS Groups and oracle user (this will be a single onwer installation)
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd -g 502 dba
# /usr/sbin/groupadd -g 503 oper
# /usr/sbin/groupadd -g 504 asmadmin
# /usr/sbin/groupadd -g 505 asmoper
# /usr/sbin/groupadd -g 506 asmdba

-- Single owner installation
# /usr/sbin/useradd -u 502 -g oinstall -G dba,oper,asmadmin,asmdba  oracle
# passwd oracle

Create $ORACLE_BASE directory:
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01/

Design and configure storage schema for ASM
  • In this example, we will configure ASM with Normal Redundancy level.
  • With Normal redundancy, Oracle ASM uses two-way mirroring for datafiles and three-way mirroring for control files, by default.
  • A minimum of two failure groups (or two disk devices) is required.
  • Effective disk space is half the sum of the disk space of all devices in the disk group.

  • If two disk devices in a normal redundancy disk group are attached to the same SCSI controller, then the controller represents a single point of failure for the entire disk group.
  • To avoid this type of failure, you can define a failure group for the disks attached in different controllers.
  • Note that all devices in a disk group must be the same size and should have similar performance characteristics.
  • Also, do not specify multiple partitions in the same single physical disk as components of the same disk group.
  • Each disk in a disk group should be on a separate physical disk.
  • In this example:
    • Disk group 1: /dev/sdb (3Gb) and /dev/sdd (3Gb). Effective Space: 3Gb
    • Disk group 2: /dev/sdc (4Gb) and /dev/sde (4Gb). Effective Space: 4Gb
(a) Check the existing disks with the command below.
Note that the devices /dev/sdb,/dev/sdc,/dev/sdd and/dev/sde are not yet partitioned.
# cat /proc/partitions
major minor  #blocks  name
   8    16    3145728 sdb
   8    32    4194304 sdc
   8    48    3145728 sdd
   8    64    4194304 sde

(b) Create a single partition on each device:
# 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): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-391, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): 
Using default value 391

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

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

(c) Repeat for /dev/sdc, /dev/sdd, /dev/sde and check the resulting partitions. Partitions named /dev/sdb1, /dev/sdc1, /dev/sdd1, and /dev/sde1 should be listed.
# cat /proc/partitions
major minor  #blocks  name
   8    16    3145728 sdb
   8    17    3140676 sdb1
   8    32    4194304 sdc
   8    33    4192933 sdc1
   8    48    3145728 sdd
   8    49    3140676 sdd1
   8    64    4194304 sde
   8    65    4192933 sde1

  • At this point the four disks are empty and partitioned.
  • In order to be used by Oracle ASM they need to be configured in order to be mounted and managed by Oracle ASM.
  • Once configured to be used by Oracle ASM, a disk is known as a candidate disk.
  • To configure the disks for Oracle ASM, you need to:
    1. install the Oracle ASM Library driver (ASMLIB)
    2. Use oracleasm utility to configure disks
Install and configure ASMLib
  • ASMLib is a support library for Oracle ASM. Oracle provides a Linux specific implementation of this library. (Click here for more on why you need ASMLib)
  • All ASMLib installations require the oracleasmlib and oracleasm-support packages appropriate for their machine.
  • The driver packages are named after the kernel they support.

(a) If you are running Oracle Enterprise Linux, you can install oracleasm directly from the installation media. After this, just run oracleasm update-driver to install the correct Oracle ASMLib driver.
# oracleasm update-driver
Kernel:         2.6.18-238.el5PAE i686
Driver name:    oracleasm-2.6.18-238.el5PAE
Latest version: oracleasm-2.6.18-238.el5PAE-2.0.5-1.el5.i686.rpm
Installing driver... 
Preparing...                ########################################### [100%]
        package oracleasm-2.6.18-238.el5PAE-2.0.5-1.el5.i686 installed
Alternatively, if you are installing in a Linux different of the Oracle Enterprise Linux, you need to
(a.1) Determine the kernel version that your system is running:
# uname -rm
2.6.18-238.el5PAE i686
(a.2) Download Oracle ASM library driver packages from the Oracle Technology Network website:
  • You must install the following packages, where version is the version of the Oracle ASM library driver, arch is the system architecture, and kernel is the version of the kernel that you are using:
    • oracleasm-support-version.arch.rpm
    • oracleasm-kernel-version.arch.rpm
    • oracleasmlib-version.arch.rpm

Configure disks for ASM
(b) Configure Oracle ASM using the oracleasm script.
Here you need to inform the username of the Grid Infrastructure owner. In this case, it is user oracle.
(If Grid infrastructure and Oracle sofware were to be managed separately, you would use here the name of the grid owner user, which is often called grid.)
# /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  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 []: asmadmin
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  ]

(d) Configure the disk devices to use the ASMLib driver.
  • Here you identify ("mark") the various disks that will be used by ASM to in the disk groups later on.
  • During boot time, Oracle ASMLib will identify these disks and make them available for Oracle ASM.
# /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1
Marking disk "DISK1" as an ASM disk:                       [  OK  ]
# /etc/init.d/oracleasm createdisk DISK2 /dev/sdc1
Marking disk "DISK2" as an ASM disk:                       [  OK  ]
# /etc/init.d/oracleasm createdisk DISK3 /dev/sdd1
Marking disk "DISK3" as an ASM disk:                       [  OK  ]
# /etc/init.d/oracleasm createdisk DISK4 /dev/sde1
Marking disk "DISK4" as an ASM disk:                       [  OK  ]

Other oracleasm options include:
# /etc/init.d/oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

# /etc/init.d/oracleasm listdisks

# /etc/init.d/oracleasm querydisk disk1
Disk "DISK1" is a valid ASM disk

# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

-- You can check that the disks are mounted in the oracleasm filesystem with the command:
# ls -l /dev/oracleasm/disks/
total 0
brw-rw---- 1 oracle asmadmin 8, 17 Nov 28 18:00 DISK1
brw-rw---- 1 oracle asmadmin 8, 33 Nov 28 18:00 DISK2
brw-rw---- 1 oracle asmadmin 8, 49 Nov 28 18:00 DISK3
brw-rw---- 1 oracle asmadmin 8, 65 Nov 28 18:00 DISK4

No comments:

Post a Comment