User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

This article will show to install ASM support with ASMLib for Oracle Linux 7 in command line only.

ASMLib is an optional support library for the Automatic Storage Management feature of the Oracle Database. Automatic Storage Management (ASM) simplifies database administration and greatly reduces kernel resource usage (e.g. the number of open file descriptors). It eliminates the need for the DBA to directly manage potentially thousands of Oracle database files, requiring only the management of groups of disks allocated to the Oracle Database. ASMLib allows an Oracle Database using ASM more efficient and capable access to the disk groups it is using.

The Oracle ASMLib kernel driver is now included in the Unbreakable Enterprise Kernel. No driver package needs to be installed when using this kernel.

In this article, you'll need ...
... Oracle Linux 7 installed with UEK (see oel7 installation here)
... root access is needed
... internet access is needed

License free ...
From mid-September 2014, all Oracle ACFS features are free to use in 11g and 12c.
Only ACFS snapshot feature requires Oracle Database Enterprise Edition (see licensing information here)

From Oracle 12c, you may want to check ASMFD instead (here)

Disable SELinux

With SELinux activated, oracleasm module may not start with the following error:

Creating /dev/oracleasm mount point: mkdir: cannot create directory '/dev/oraclesm': Permission denied
failed
Unable to create mount point /dev/oracleasm

Edit /etc/selinux/config config file and set SELINUX to "disabled" or "permissive":

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted

And execute the following commands as root to immediately disable SELinux:

# Disable SELinux
[root]$ /usr/sbin/setenforce 0

# Check current SELinux configuration
[root]$ /usr/sbin/getenforce
    Permissive

Install ASM support

To install oracleasm-support package, simply execute the following command as root:

[root]$ yum install oracleasm-support
    Loaded plugins: langpacks
    Resolving Dependencies
    --> Running transaction check
    ---> Package oracleasm-support.x86_64 0:2.1.8-3.el7 will be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    ===================================================================================================================================
     Package                        Arch                Version                 Repository                  Size
    ===================================================================================================================================
    Installing:
     oracleasm-support              x86_64              2.1.8-3.el7             ol7_latest                  79 k

    Transaction Summary
    ===================================================================================================================================
    Install  1 Package

    Total download size: 79 k
    Installed size: 242 k
    Is this ok [y/d/N]: y
    Downloading packages:
    oracleasm-support-2.1.8-3.el7.x86_64.rpm                                                                        |  79 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : oracleasm-support-2.1.8-3.el7.x86_64                                                                            1/1
    Note: Forwarding request to 'systemctl enable oracleasm.service'.
    ln -s '/usr/lib/systemd/system/oracleasm.service' '/etc/systemd/system/multi-user.target.wants/oracleasm.service'
      Verifying  : oracleasm-support-2.1.8-3.el7.x86_64                                                                            1/1

    Installed:
      oracleasm-support.x86_64 0:2.1.8-3.el7                                                                                                                                                                           
    Complete!

Initialize ASM

As you can see below, oracle asm service is enabled and asm kernel driver is installed but not running/loaded yet.

#check if oracleasm service is activated
[root]$ systemctl is-enabled oracleasm.service
    enabled

#check if oracleasm module is loaded into Linux kernel
[root]$ lsmod | grep oracleasm

#check if oracleasm kernel module is installed
[root]$ modinfo oracleasm
    filename:       /lib/modules/3.8.13-35.3.1.el7uek.x86_64/kernel/drivers/block/oracleasm/oracleasm.ko
    description:    Kernel driver backing the Generic Linux ASM Library.
    author:         Joel Becker 
    version:        2.0.8
    license:        GPL
    srcversion:     A311C50149C77E13C360349
    depends:        
    intree:         Y
    vermagic:       3.8.13-35.3.1.el7uek.x86_64 SMP mod_unload modversions 
    signer:         Oracle CA Server
    sig_key:        C8:F6:00:04:DB:C9:C1:D4:E9:DD:B8:57:24:12:44:BA:7D:A9:55:6C
    sig_hashalgo:   sha256
    parm:           use_logical_block_size:Prefer logical block size over physical (Y=logical, N=physical [default]) (bool)

We need to initialize oracleasm module in order to load it into the kernel.

#init oracleasm module
[root]$ /usr/sbin/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

#check if oracleasm module is loaded into Linux kernel
[root]$ lsmod | grep oracleasm
    oracleasm              53453  1 

Configure ASM

#configure ASM
#configure ASM
[root]$ /usr/sbin/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 []: grid
    Default group to own the driver interface []: oinstall
    Scan for Oracle ASM disks on boot (y/n) [y]: 
    Writing Oracle ASM library driver configuration: done

Create ASM disks

#Create disk partition
[root]$ for disk in sdc sdd sde sdh sdi sdj; do
fdisk /dev/$disk << _EOF_
n
p



w
_EOF_
done

#Create ASM disk for DATA
[root]$  i=0; for disk in sdc1 sdd1 sde1; do i=$(( i+1 )); oracleasm createdisk ORADATVOL$i /dev/$disk; done
    Writing disk header: done
    Instantiating disk: done
    Writing disk header: done
    Instantiating disk: done
    Writing disk header: done
    Instantiating disk: done

#Create ASM disk for FRA
[root]$  i=0; for disk in sdh1 sdi1 sdj1; do i=$(( i+1 )); oracleasm createdisk ORAFRAVOL$i /dev/$disk; done
    Writing disk header: done
    Instantiating disk: done
    Writing disk header: done
    Instantiating disk: done
    Writing disk header: done
    Instantiating disk: done

#List ASM disks
[root]$ oracleasm listdisks
    ORADATVOL1
    ORADATVOL2
    ORADATVOL3
    ORAFRAVOL1
    ORAFRAVOL2
    ORAFRAVOL3

[root]$ ls -l /dev/oracleasm/disks
    total 0
    brw-rw----. 1 grid oinstall 8,  33 May 22 17:29 ORADATVOL1
    brw-rw----. 1 grid oinstall 8,  49 May 22 17:29 ORADATVOL2
    brw-rw----. 1 grid oinstall 8,  65 May 22 17:29 ORADATVOL3
    brw-rw----. 1 grid oinstall 8, 113 May 22 17:45 ORAFRAVOL1
    brw-rw----. 1 grid oinstall 8, 129 May 22 17:45 ORAFRAVOL2
    brw-rw----. 1 grid oinstall 8, 145 May 22 17:45 ORAFRAVOL3

Please leave comments and suggestions,
Michel.

Reference
ASMLib Installation - Oracle (here)

Enjoyed this article? Please like it or share it.

Add comment

Please connect with one of social login below (or fill up name and email)

     


Security code
Refresh

Comments   

Rene
# oracleasm doesn't start after rebootRene 2016-02-02 17:14
Hi,

on my OEL7 system does oracleasm not start after reboot. I'am right, that I have to start oracleasm manually after restart the server?
Reply | Reply with quote | Quote
UxOra DBA
# RE: oracleasm doesn't start after rebootUxOra DBA 2016-02-02 20:45
No, it should start automaticaly after reboot.

As root user,
- Make sure you have disabled SELinux as explained in this article.
- And check if the asm service is enabled with: $ systemctl is-enabled oracleasm.service
- If not, enabled it with: $ systemctl enable oracleasm.service
Reply | Reply with quote | Quote
Rene
# RE: oracleasm doesn't start after rebootRene 2016-02-03 16:47
Yes, but it scans not the disks/volumes. If I check it with oracleasm listdisks , there are no disks listed. I have to manual execute oracleasm scandisks . After this I can see my disks/volumes .
Under OEL6 was it execute automaticly. Did you have a solution for this?
Reply | Reply with quote | Quote
Rene
# RE: oracleasm doesn't start after rebootRene 2016-02-03 16:59
ok, now i know the problem. It's it is device depended. It scans not my devices.

Thanks
Reply | Reply with quote | Quote