Friday, October 19, 2012



What is ASM:


Automatic Storage Management (ASM) simplifies administration of Oracle related files by allowing the administrator to reference disk groups rather than individual disks and files, which are managed by ASM. The ASM functionality is an extention of the Oracle Managed Files (OMF) functionality that also includes striping and mirroring to provide balanced and secure storage. The new ASM functionality can be used in combination with existing raw and cooked file systems, along with OMF and manually managed files.
The ASM functionality is controlled by an ASM instance. This is not a full database instance, just the memory structures and as such is very small and lightweight.
The main components of ASM are disk groups, each of which comprise of several physical disks that are controlled as a single unit. The physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files. The locations and names for the files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
The level of redundancy and the granularity of the striping can be controlled using templates. Default templates are provided for each file type stored by ASM, but additional templates can be defined as needed.
Failure groups are defined within a disk group to support the required level of redundancy. For two-way mirroring you would expect a disk group to contain two failure groups so individual files are written to two locations.


In summary ASM provides the following functionality:
  1. Manages groups of disks, called disk groups.
  2. Manages disk redundancy within a disk group.
  3. Provides near-optimal I/O balancing without any manual tuning.
  4. Enables management of database objects without specifying mount points and filenames.
  5. Supports large files.


Configuration of ASM:


Use the following command to identify the kernel version


[oracle@node1 u01]$ uname -r
2.6.18-53.el5


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



[oracle@node1 u01]$ rpm -ivh --force --nodeps *


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
oracleasm-2.6.18-53.1.19.el5xen-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.1.19.el5debug-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.1.19.el5PAE-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-53.1.19.el5-2.0.4-1.el5.i686.rpm

Configure Oracle ASM Library driver

[oracle@node1 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]

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


Creating Raw disks in VM:















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



Creating a new Partition for ASM disk



[oracle@node1 ~]# 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.


[oracle@node1 ~]# 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



To create a ASM disk using Oracle ASMLib


[oracle@node1 ~]# oracleasm createdisk DISK1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[oracle@node1 ~]# oracleasm createdisk DISK2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[oracle@node1 ~]# oracleasm createdisk DISK3 /dev/sdd1
Writing disk header: done
Instantiating disk: done


To List and check the Oracle ASM disks


[oracle@node1 ~]# oracleasm listdisks
[oracle@node1 ~]# oracleasm querydisk DISK1
Disk "DISK1" is a valid ASM disk


Creating password file for ASM instance:


orapwd file=$ORACLE_HOME/dbs/orapwasm password=oracle


Creating directories:


+ASM,bdump,cdump,udump


Creating pfile for ASM instance:


db_unique_name = 'ASM'
instance_type = 'asm'
background_dump_dest = '/u01/app/oracle/admin/+ASM/bdump'
core_dump_dest = '/u01/app/oracle/admin/+ASM/cdump'
user_dump_dest = '/u01/app/oracle/admin/+ASM/udump'
export ORACLE_SID=ASM
sqlplus / as sysdba


SQL>startup nomount pfile='/u01/initasm.ora';
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes


Now creating database through DBCA and use the ASM disks: