In this article we are about to cover all steps required to create a ASM disks in Oracle Linux server, In case if you have read our older Post : Creating ASM disks using ASM disks through multipath in Oracle DB Servers: you may not find much information.

In this guide, we are going to learn how to mark SAN devices (disks) as ASM disks through multipath in Oracle Linux server. To create the same in Red Hat Linux or in Centos Linux we need to install with ASMlib package this will be covered in a separate article.

To read about how to create ASM disk using udev in Linux servers. Kindly visit the article.

Above URL only guide us to create an ASM disk using UDEV. So let us see how to mark a SAN disk through multipath for creating an ASM disk with reliability and availability.

In our earlier post above topic not covered by the installation of oracleasm packages and required configurations so we are about to create this current article which includes steps as follows.

  • Getting SAN disks from Storage.
  • Scanning for LUN’s in Oracle Linux servers.
  • Installing with OracleASM packages and dependencies.
  • Configuring multipath entries and reloading
  • Verifying the created alias.
  • Initializing OracleASM module and creating the mount point.
  • Configuring OracleASM with DB user and Group.
  • Marking multipath devices as Oracle ASM disks.
  • Verifying created ASM disks by listing out.
  • Scan for the existing ASM disks from Primary node under the clustered nodes.

Assume server already installed with Oracle Database 12c standard or enterprise edition or any other version, hence existing installation we have below groups and users in servers.

 user      : > oracle
groups : > oinstall, dba, oper, backupdba, asmdba, asmadmin

Now let us begin with setting up Oracle ASM. We need listed packages for creating ASM disks in Oracle Linux Servers. If this server is an already existing DB server these will be installed by default during DB configurations.

Hence this is my test environment I’m setting up all required ASM steps from scratch.

Install with kernel module for oralceasm, Oracle ASM management package, and a simple utility to scan for LUN’s.

# yum install kmod-oracleasm -y
# yum install oracleasm-support -y
# yum install sg3_utils -y

To scan SAN LUNs we required the package.

# yum install sg3_utils -y

Above listed packages are completed with the installation.

Running Transaction Installing : sg3_utils-1.28-12.el6.x86_64 oracleasm-support-2.1.8-1.el6.x86_64 kernel-2.6.32-696.16.1.el6.x86_64 kmod-oracleasm-2.0.8-15.el6_9.x86_64 Installed: sg3_utils-1.28-12.el6.x86_64 oracleasm-support-2.1.8-1.el6.x86_64 kernel-2.6.32-696.16.1.el6.x86_64 kmod-oracleasm-2.0.8-15.el6_9.x86_64 Dependency Installed: kernel.x86_64 0:2.6.32-696.16.1.el6 Complete!
[root@oradb1 ~]

Once done with scanning for SAN disks we will get two numbers of 500 GB SAN disks in our DB servers, let us start with scanning for LUNs.

By running below rescan command new SAN disks will be added in servers, this step should be carried out on all DB servers if we are working in a clustered DB setup.

# rescan-scsi-bus.sh

For confirmation, we can check by running fdisk -l. Here sdb,sdc are single paths in multipath output.

Below output truncated due to long listed output.

# fdisk -l
Disk /dev/sdb: 512.0 GB, 511973523456 bytes
255 heads, 63 sectors/track, 62243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc: 512.0 GB, 511973523456 bytes
255 heads, 63 sectors/track, 62243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

While running “dmesg” command at the end of the output we are able to notice the new LUN’s detection.

# dmesg
[ 1395.581989] sd 3:0:0:0: [sdb] Write Protect is off [ 1395.581992] sd 3:0:0:0: [sdb] Mode Sense: 77 00 00 08 [ 1395.583252] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA [ 1395.584558] sd 3:0:0:1: Attached scsi generic sg3 type 0 [ 1395.600922] sd 3:0:0:1: [sdc] 999948288 512-byte logical blocks: (511 GB/476 GiB) [ 1395.601993] sd 3:0:0:1: [sdc] Write Protect is off [ 1395.601998] sd 3:0:0:1: [sdc] Mode Sense: 77 00 00 08 [ 1395.603854] sd 3:0:0:1: [sdc] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA [ 1395.625901] sd 3:0:0:0: [sdb] Attached SCSI disk [ 1395.631273] sd 3:0:0:1: [sdc] Attached SCSI disk [ 1450.703076] scsi host4: iSCSI Initiator over TCP/IP [ 1450.707262] scsi 4:0:0:0: Direct-Access COMPAQ-HSV110 VIRTUAL-DISK 0 PQ: 0 ANSI: 4 [ 1450.708944] sd 4:0:0:0: Attached scsi generic sg4 type 0 [ 1450.709541] sd 4:0:0:0: [sdd] 999948288 512-byte logical blocks: (511 GB/476 GiB) [ 1450.709872] sd 4:0:0:0: [sdd] Write Protect is off [ 1450.709875] sd 4:0:0:0: [sdd] Mode Sense: 77 00 00 08 [ 1450.709939] scsi 4:0:0:1: Direct-Access COMPAQ-HSV110 VIRTUAL-DISK 0 PQ: 0 ANSI: 4 [ 1450.711674] sd 4:0:0:0: [sdd] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA [ 1450.715162] sd 4:0:0:1: [sde] 999948288 512-byte logical blocks: (511 GB/476 GiB) [ 1450.715533] sd 4:0:0:1: [sde] Write Protect is off [ 1450.715536] sd 4:0:0:1: [sde] Mode Sense: 77 00 00 08 [ 1450.715768] sd 4:0:0:1: Attached scsi generic sg5 type 0 [ 1450.718097] sd 4:0:0:1: [sde] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA [ 1450.724506] sd 4:0:0:0: [sdd] Attached SCSI disk [ 1450.732771] sd 4:0:0:1: [sde] Attached SCSI disk
[root@oradb1 ~]#

While listing all the detected SAN disks using “multipath -ll” by default device mapper will name the devices as mpatha, mpathb.

For our reference, we need to change it by setting an alias name.

Before setting an alias name it will look like below output.

# multipath -ll

[root@oradb1 ~]# multipath -ll mpathb (14f504e46494c45524338735952702d365978332d506b7032) dm-9 COMPAQ-HSV110,VIRTUAL-DISK size=477G features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=1 status=active | `- 3:0:0:1 sdc 8:32 active ready running `-+- policy='round-robin 0' prio=1 status=enabled `- 4:0:0:1 sde 8:64 active ready running mpatha (14f504e46494c4552466d44496f352d6b47486c2d7151524a) dm-8 COMPAQ-HSV110,VIRTUAL-DISK size=477G features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=1 status=active | `- 3:0:0:0 sdb 8:16 active ready running `-+- policy='round-robin 0' prio=1 status=enabled `- 4:0:0:0 sdd 8:48 active ready running
[root@oradb1 ~]#

To set the alias name we need to append the below entries in multipath.conf.

If we have multiple Database servers in cluster mode, below steps should be carried out through all the clustered DB servers.

# vi /etc/multipath.conf
multipath {
wwid 14f504e46494c4552466d44496f352d6b47486c2d7151524a
alias DATA_001
}
multipath {
wwid 14f504e46494c45524338735952702d365978332d506b7032
alias DATA_002
}

save and exit from multipath.conf and reload the multipathd service to get the newly assigned alias.

Once done with adding required entries just reload mutipathd daemon to create the alias names.

FYI: > Not only alias names can be created, but we can also assign the disk permission to specific user and group under the multipath entry, Moreover there is a lot of customs configuration can be done under multipath.

# service multipathd reload

[root@oradb1 ~]# service multipathd reload
Reloading multipathd: [ OK ]
[root@oradb1 ~]#

Alais names are created using multipath entry, Now we need to create the ASM disks from those created alias.

After setting an alias name it will look like below output.

# multipath -ll
[root@oradb1 ~]# multipath -ll DATA_002 (14f504e46494c45524338735952702d365978332d506b7032) dm-9 COMPAQ-HSV110,VIRTUAL-DISK size=477G features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=1 status=active | `- 3:0:0:1 sdc 8:32 active ready running `-+- policy='round-robin 0' prio=1 status=enabled `- 4:0:0:1 sde 8:64 active ready running DATA_001 (14f504e46494c4552466d44496f352d6b47486c2d7151524a) dm-8 COMPAQ-HSV110,VIRTUAL-DISK size=477G features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=1 status=active | `- 3:0:0:0 sdb 8:16 active ready running `-+- policy='round-robin 0' prio=1 status=enabled `- 4:0:0:0 sdd 8:48 active ready running 
[root@oradb1 ~]#

Once we installed with Oracleasm package it can’t start without initializing. Below “oracleasm init” command will load the “oracleasm” module, it will create the mount point under /dev/oracleasm.

# oracleasm init
[root@oradb1 ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm

Configure oracleasm with respective user and group by running “oracleasm configure -i”, to start the Oracle ASM during boot time.
Default user will be Oracle and group will be oinstall, to start the oracleasm during reboot proceed with “y”.

# oracleasm configure -i
[root@oradb1 ~]# oracleasm configure -i 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 []: oinstall 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
[root@oradb1 ~]#

check the status for oracleasm.

# /etc/init.d/oracleasm status

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

[root@oradb1 ~]

#

To create the ASM disks from multipath devices run the oracleasm command with option and argument as shown below.

# /etc/init.d/oracleasm createdisk DATA_001 /dev/mapper/DATA_001

# /etc/init.d/oracleasm createdisk DATA_002 /dev/mapper/DATA_002

[root@oradb1 ~]# /etc/init.d/oracleasm createdisk DATA_001 /dev/mapper/DATA_001
Marking disk "DATA_001" as an ASM disk: [ OK ]

[root@oradb1 ~]

#

[root@oradb1 ~]

# /etc/init.d/oracleasm createdisk DATA_002 /dev/mapper/DATA_002 Marking disk “DATA_002” as an ASM disk: [ OK ]

[root@oradb1 ~]

#

Once created with ASM disks list the disks using “listdisks”.

# /etc/init.d/oracleasm listdisks

[root@oradb1 ~]# /etc/init.d/oracleasm listdisks
DATA_001
DATA_002

[root@oradb1 ~]

#




Created ASM disks will be at below mount point.

# ls -lthr /dev/oracleasm/disks/

[root@oradb1 ~]# ls -lthr /dev/oracleasm/disks/
total 0
brw-rw---- 1 oracle oinstall 8, 16 Nov 22 02:10 DATA_001
brw-rw---- 1 oracle oinstall 8, 32 Nov 22 02:10 DATA_002

[root@oradb1 ~]

#

If our setup has multiple clustered DB nodes just we need to follow the below steps in them.

  1. Scan for SAN disks.
  2. Put the same multipath entry, (No changes to Alias and LUN ID).
  3. Reload multipath daemon.
  4. Then no need of creating Oracle ASM disks just only we need to “scandisks” as shown below in all clustered DB nodes.

# /etc/init.d/oracleasm scandisks

# /etc/init.d/oracleasm listdisks

[root@oradb2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]

[root@oradb2 ~]

# /etc/init.d/oracleasm listdisks DATA_001 DATA_002

[root@oradb2 ~]

#

Hope you are happy in this guide to get started with creating your ASM disk requirements. Provide your feedback in below comment section and subscribe to us for more DB and multipath related topics.

Babin Lonston
Overall 14+ Years of experience in IT field, 7+ years of experience in Linux administration with Virtualization & Cloud technologies. Love documentation and being Numismatics for a long time.

25 examples of find commands in Linux

Previous article

How to install Apache Web Server in Red Hat Enterprise Linux 7 and Variants

Next article

You may also like

Comments

Leave a reply

Your email address will not be published.