Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Thursday, December 25, 2014

Raw Device Setup for ASM


Today one of the DBA requested to have the ASM instance based on raw devices. I provided the below  as a quick demo.

1- Create the partition for the attached storage. 
[root@PK3-IUB-RV-OD03 etc]# fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       13054   104751832+  8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2491    20008926   83  Linux

2- Edit the "/etc/sysconfig/rawdevices" file, adding the following line

[root@PK3-IUB-RV-OD03 sysconfig]# cat rawdevices
# raw device bindings
# format:  
# example: /dev/raw/raw1 /dev/sda1
#          /dev/raw/raw2 8 5
/dev/raw/raw1 /dev/sdb1

3- Restart the rawdevices service 

[root@PK3-IUB-RV-OD03 sysconfig]# service rawdevices restart
Assigning devices:
           /dev/raw/raw1  -->   /dev/sdb1
/dev/raw/raw1:  bound to major 8, minor 17

[root@PK3-IUB-RV-OD03 ~]# chkconfig rawdevices on

4- Run the following commands and add them the "/etc/rc.local" file.
[root@PK3-IUB-RV-OD03 sysconfig]# chown oracle:oinstall /dev/raw/raw1
[root@PK3-IUB-RV-OD03 sysconfig]# chmod 600 /dev/raw/raw1

[root@PK3-IUB-RV-OD03 etc]# cat /etc/rc.local
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
chown oracle:oinstall /dev/raw/raw1
chmod 600 /dev/raw/raw1

5- Creation of the ASM instance is the same, regardless of the use of ASMLib or raw devices. When using ASMLib, the candidate disks are listed using the stamp associated with them, while the raw devices are listed using their device name.


The rawdevices service can only initialize devices named according to the /dev/raw/rawN format. However, devices in this location do not have the correct ownership or permissions for an Oracle database file by default. Additionally, because these device names are owned by the dev package, each time the package is updated (for example, as part of an operating system update), all devices are recreated with the default ownership and permissions at boot. It is therefore necessary to set ownership and permissions each time the dev package is updated.

1 comment:

ali muhammad said...

Dear Bro,

Great work, keep it up...
You are resolving different scenarios for common dba tasks.
May Allah give you reward for this.