Purpose:
Install and configure ASM (Automatic Storage Management) with Oracle 11G with no external disks.
Description:
- ASM takes control of disk devices (no disk partitioning needed)
- More space can be transparently added
- I/Os are spread over all the available disks (striping)
- ASM can maintain redundant copies of the data (mirror)
- Storage can be migrated between disks
- Same disk (or set of disks) can be shared amongst many DBs
Oracle Version: Oracle Database 11g (11.1.0.6.0)
Process:
1. - ASM needs the Oracle cluster Synchronization Service (CSS)
run $ORACLE_HOME/bin/localconfig add (root user)
[root@tauro oracle] # $ORACLE_HOME/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Cleaning up Network socket directories
Setting up Network socket directories
Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
Cluster Synchronization Services is active on these nodes.
tauro
Cluster Synchronization Services is active on all the nodes.
Oracle CSS service is installed and running under init(1M)
2.- Install asmlib 2.0
Download and install the correct library version from http://www.oracle.com/technology/software/tech/linux/asmlib/rhel4.html (root)
Preparing... ########################################### [100%]
1:oracleasm-2.6.9-42.ELsm########################################### [100%]
[root@tauro ASM]# rpm -ivh oracleasm-support-2.0.3-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@tauro ASM]# rpm -ivh oracleasmlib-2.0.2-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
3.- Configure asmlib 2.0
(root)
[root@tauro ~]# /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
answer will keep that current value. Ctrl-C will abort.
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
4.- Create virtual disks
(root)
(http://www.orafaq.com/node/1849)
dd if=/dev/zero of=disk1 bs=1024k count=2000
dd if=/dev/zero of=disk2 bs=1024k count=2000
dd if=/dev/zero of=disk3 bs=1024k count=2000
dd if=/dev/zero of=disk4 bs=1024k count=2000
5.- Using the loopback device to assign disks.
(root)
[root@tauro ASM]# /sbin/losetup /dev/loop1 /datos/oradata/catalogo/ASM/disk1
[root@tauro ASM]# /sbin/losetup /dev/loop2 /datos/oradata/catalogo/ASM/disk2
[root@tauro ASM]# /sbin/losetup /dev/loop3 /datos/oradata/catalogo/ASM/disk3
[root@tauro ASM]# /sbin/losetup /dev/loop4 /datos/oradata/catalogo/ASM/disk4
6.- Create ASM disks
(root)
[root@tauro ~]# /etc/init.d/oracleasm createdisk ASM1 /dev/loop1
Marking disk "/dev/loop1" as an ASM disk: [ OK ]
[root@tauro ~]# /etc/init.d/oracleasm createdisk ASM2 /dev/loop2
Marking disk "/dev/loop2" as an ASM disk: [ OK ]
[root@tauro dev]# /etc/init.d/oracleasm createdisk ASM3 /dev/loop3
Marking disk "/dev/loop3" as an ASM disk: [ OK ]
[root@tauro dev]# /etc/init.d/oracleasm createdisk ASM4 /dev/loop4
Marking disk "/dev/loop4" as an ASM disk: [ OK ]
/dev/oracleasm/disks
[oracle@tauro disks]$ ll
total 0
brw-rw---- 1 oracle dba 7, 1 May 21 12:10 ASM1
brw-rw---- 1 oracle dba 7, 2 May 21 12:10 ASM2
brw-rw---- 1 oracle dba 7, 3 May 21 12:11 ASM3
brw-rw---- 1 oracle dba 7, 4 May 21 12:11 ASM4
7.- Verify
(Use the DBCA utility to create the ASM instance on Oracle).
$ export ORACLE_SID=+ASM
$ sqlplus /nolog
SQL> conn / as sysdba
Connected.
SQL> set lines 132
SQL> col PATH for a50
SQL> select path, mount_status from v$asm_disk;
SQL> select group_number, disk_number ,name, state, mode_status, mount_status, total_mb from v$asm_disk;
SQL> select group_number GROUP#, name, state, total_mb, free_mb, required_mirror_free_mb REQ_MIRR_FREE_MB, usable_file_mb from v$asm_diskgroup;
8.- Add to startup
(root)
Add the following entries to the file "/etc/rc.local"
/sbin/losetup /dev/loop1 /datos/oradata/catalogo/ASM/disk1
/sbin/losetup /dev/loop2 /datos/oradata/catalogo/ASM/disk2
/sbin/losetup /dev/loop3 /datos/oradata/catalogo/ASM/disk3
/sbin/losetup /dev/loop4 /datos/oradata/catalogo/ASM/disk4
/etc/init.d/oracleasm createdisk ASM1 /dev/loop1
/etc/init.d/oracleasm createdisk ASM2 /dev/loop2
/etc/init.d/oracleasm createdisk ASM3 /dev/loop3
/etc/init.d/oracleasm createdisk ASM4 /dev/loop4
Note: See online reference on asmcmd command line tool
Links, References:
http://www.oracle.com/technology/products/database/asm/index.html
http://www.orafaq.com/wiki/Automatic_Storage_Management
http://www.orafaq.com/node/1849
http://en.wikipedia.org/wiki/Loop_device
http://www.oracle.com/technology/software/tech/linux/asmlib/rhel4.html
http://skrajend.blogspot.com/2007/06/simulating-asm-on-10g-by-faking_22.html
http://www.oracle.com/technology/oramag/oracle/06-mar/o26asm.html