You are on page 1of 10

ASM HANDS-ON TRAINING

Lab 2 Install and Configure ASMLib


Alejandro Vargas | Principal Support Consultant
Oracle Advanced Customer Services

INDEX
Part 1 : Install The ASMLib Drivers...............................................................................................................................2
Cheking The Kernel Version.........................................................................................................................................2
Downloading the Drivers for ASMLib............................................................................................................................2
Installing the ASMLib Drivers .......................................................................................................................................3
Part 2 : Configure ASMLib.............................................................................................................................................4
Configure ASMLib ........................................................................................................................................................4
Create ASM Disks
......................................................................................................................................................................................5
Part 3 : ASMLib Directory Structures............................................................................................................................6
ASM Directories
.......................................................................................................................................................................................6
ASM files on /opt directory............................................................................................................................................7
Map ASMLib Disks to Physical Devices .......................................................................................................................8
File /etc/sysconfig/oracleasm .......................................................................................................................................8
ASM init file....................................................................................................................................................................9
Scripts..........................................................................................................................................................................10

1/10

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Part 1 : Install The ASMLib Drivers
Cheking The Kernel Version
[oracle@asmxpt ~]$ uname -a
Linux asmxpt 2.6.18-8.el5 #1 SMP Tue Jun 5 23:11:13 EDT 2007 i686 i686 i386 GNU/Linux

Downloading the Drivers for ASMLib


On the download page find the OS you are using, in our case OEL 5.
http://www.oracle.com/technology/tech/linux/asmlib/index.html
Once on the page Oracle ASMLib Downloads for Red Hat Enterprise Linux Server 5
http://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.html
we need to find the drivers for Intel IA32 (x86) Architecture and download the generic Library
and Tools drivers located at the head of the group:
Library and Tools
oracleasm-support-2.1.2-1.el5.i386.rpm
oracleasmlib-2.0.3-1.el5.i386.rpm
Aditionally we need to download the driver that exactly match our kernel, that is 2.6.18-8.el5:
Drivers for kernel 2.6.18-8.el5
oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm
In our lab the drivers were already downloaded and are located in this directory:
/root/asmlibrpms

2/10

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Installing the ASMLib Drivers
As root execute the following commands:
# cd /root/asmlibrpms
# rpm -Uvh /root/asmlibrpms/oracleasm-support-2.0.4-1.el5.i386.rpm \
/root/asmlibrpms/oracleasmlib-2.0.3-1.el5.i386.rpm \
/root/asmlibrpms/oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm
Preparing...
###########################################
1:oracleasm-support
###########################################
2:oracleasm-2.6.18-8.el5 ###########################################
3:oracleasmlib
###########################################

3/10

[100%]
[ 33%]
[ 67%]
[100%]

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Part 2 : Configure ASMLib
Configure ASMLib
Once ASMLib is installed we can execute its executable oracleasm located at /etc/init.d, it will return a list of available
commands.
[root@asmxpt asmlibrpms]# /etc/init.d/oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|
querydisk|listdisks|scandisks|status}

ASMLib configure command:


[root@asmxpt asmlibrpms]# /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
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration:
Creating /dev/oracleasm mount point:
Loading module "oracleasm":
Mounting ASMlib driver filesystem:
4/10

[
[
[
[

OK
OK
OK
OK

]
]
]
]

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Scanning system for ASM disks:

OK

[
[

OK
OK

]
]

Checking ASMLib status


[root@asmxpt asmlibrpms]# /etc/init.d/oracleasm status
Checking if ASM is loaded:
Checking if /dev/oracleasm is mounted:

Create ASM Disks


We have a set of 8 LUNs ready, we will create 4 ASM disks on LUNs sdb1,sdc1,sdd1 and sde1
[root@asmxpt
Marking disk
[root@asmxpt
Marking disk
[root@asmxpt
Marking disk
[root@asmxpt
Marking disk

~]# /etc/init.d/oracleasm createdisk


"/dev/sdb1" as an ASM disk:
~]# /etc/init.d/oracleasm createdisk
"/dev/sdc1" as an ASM disk:
~]# /etc/init.d/oracleasm createdisk
"/dev/sdd1" as an ASM disk:
~]# /etc/init.d/oracleasm createdisk
"/dev/sde1" as an ASM disk:

Check the created ASM disks


[root@asmxpt ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4

5/10

vol1 /dev/sdb1
[ OK
vol2 /dev/sdc1
[ OK
vol3 /dev/sdd1
[ OK
vol4 /dev/sde1
[ OK

]
]
]
]

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib

Part 3 : ASMLib Directory Structures


ASM Directories
Once ASM is configured and ASM disks are created several structures are created
[root@asmxpt ~]# ls -l /dev/oracleasm/
total 0
drwxr-xr-x 1 root
root 0 Jan 31 22:13 disks
drwxrwx--- 1 oracle dba 0 Jan 31 22:13 iid
On the /dev/oracleasm/disks directory are located the ASMLib mappings of ASM devices to physical devices
[root@asmxpt
total 0
brw-rw---- 1
brw-rw---- 1
brw-rw---- 1
brw-rw---- 1

~]# ls -l /dev/oracleasm/disks
oracle
oracle
oracle
oracle

dba
dba
dba
dba

8,
8,
8,
8,

17
33
49
65

Jan
Jan
Jan
Jan

31
31
31
31

22:23
22:24
22:24
22:24

VOL1
VOL2
VOL3
VOL4

The major and minor numbers permit to map the ASM Disks to the physical devices
[root@asmxpt ~]# ls -l /dev/* | grep 8, | grep " 17 "
brw-rw---- 1 oracle dba
8, 17 Jan 31 22:13 /dev/sdb1

6/10

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
ASM files on /opt directory
Note that is the ASM directories located on opt are removed ASMLib still will be appera to be functional, but discovery will
not work. Ive seen this problem happening a couple of times
[oracle@asmxpt ~]$ cd
[oracle@asmxpt /opt]$
drwxr-xr-x 8 root
drwxr-xr-x 3 root
drwxrwxr-x 3 root
drwxr-xr-x 3 root

/opt
ls -l | grep -i or
root
4096 Sep 10 2007
root
4096 Jan 31 22:05
users
4096 Oct 15 12:54
root
4096 Oct 16 17:31

[oracle@asmxpt /opt]$ du -h ./oracle/


20K
./oracle/extapi/32/asm/orcl/1
24K
./oracle/extapi/32/asm/orcl
28K
./oracle/extapi/32/asm
32K
./oracle/extapi/32
36K
./oracle/extapi
40K
./oracle/
[oracle@asmxpt /opt]$ du -h ORCLfmap/
940K
ORCLfmap/prot1_32/bin
4.0K
ORCLfmap/prot1_32/log
8.0K
ORCLfmap/prot1_32/etc
956K
ORCLfmap/prot1_32
960K
ORCLfmap/

7/10

openoffice.org2.3
oracle
OracleCalendar_inst
ORCLfmap

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Map ASMLib Disks to Physical Devices
Using a script we can check which is the mapping of ASM disks to physical devices
[root@asmxpt ~]# ./chkasmdisks
ASM disk VOL1 based on /dev/sdb1
ASM disk VOL2 based on /dev/sdc1
ASM disk VOL3 based on /dev/sdd1
ASM disk VOL4 based on /dev/sde1

[8,
[8,
[8,
[8,

17]
33]
49]
65]

File /etc/sysconfig/oracleasm
The /etc/sysconfig/oracleasm file has configurable parameters to control ASMLib behaviour, it is updated by running
oracleasm configure. Usually scanorder and scanexclude can be manually configured if necessary
[root@asmxpt etc]# strings ./sysconfig/oracleasm
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver. It is generated
# By running /etc/init.d/oracleasm configure. Please use that method
# to modify this file
# ORACLEASM_ENABELED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true
# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=oracle
# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=dba
# ORACLEASM_SCANBOOT: 'true' means fix disk perms on boot
ORACLEASM_SCANBOOT=true
# ORACLEASM_CLEARBOOT: 'true' means clean old disk perms on boot
ORACLEASM_CLEARBOOT=true
8/10

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER=
# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE=

ASM init file


One init file is setup at ASMLib install time on different levels of system startup/shutdown init directories
/etc/rc.d/rc3.d/S29oracleasm
/etc/rc.d/rc5.d/S29oracleasm
/etc/rc.d/rc6.d/K20oracleasm
/etc/rc.d/rc1.d/K20oracleasm
/etc/rc.d/rc4.d/S29oracleasm
/etc/rc.d/rc2.d/S29oracleasm
/etc/rc.d/init.d/oracleasm
/etc/rc.d/rc0.d/K20oracleasm

9/10

ASM HANDS-ON TRAINING


Lab 2 Install and Configure ASMLib
Scripts
#!/bin/ksh
# chkasmdisks
/etc/init.d/oracleasm querydisk `/etc/init.d/oracleasm listdisks` | cut -f2,10,11 -d" " |
perl -pe 's/"(.*)".*\[(.*), *(.*)\]/$1 $2 $3/g;' | while read v_asmdisk v_minor v_major
do
v_device=`ls -la /dev | grep " $v_minor, *$v_major " | awk '{print $10}'`
echo "ASM disk $v_asmdisk based on /dev/$v_device [$v_minor, $v_major]"
done
# eof chkasmdisks

End of Lab2

10/10

You might also like