Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Sunday, 10 April 2016

ASMLIB : Installation and Configuration

ASMLIB : Installation and ConfigurationASMLIB is an optional support library for the ASM (Automatic Storage Management) feature of the Oracle Database. ASM simplifies storage administration and greatly reduces kernel resource usage (e.g. the number of open file descriptors). It eliminates the need for the DBA (Database Administrator) 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.

In previous releases, Oracle ASM was installed as part of the Oracle Database installation. With Oracle Database 11g Release 2 (11.2), Oracle ASM is part of an Oracle Grid Infrastructure installation, either for a cluster, or for a standalone server.

In this article, we will install ASMLIB on our Linux Server, and mark the disks for use by the Oracle Grid Infrastructure or more specifically Oracle ASM component of the Oracle Grid Infrastructure.

 

System Specification:

We have a Linux virtual machine with following specification.

CPU 2.4 Ghz (Single Core)
Memory 2 GB
Storage 45 GB (20 GB for Swap and Linux, 25GB for ASM Disks)

 

Create Partitions:

Check the available free space using fdisk.

[root@gridserver ~]# fdisk –l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x00035159

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/sdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 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/mapper/vg_gridserver-lv_root: 18.9 GB, 18865979392 bytes
255 heads, 63 sectors/track, 2293 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/mapper/vg_gridserver-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 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

[root@gridserver ~]#

From the above output, we have /dev/sdb is available with 26 GB storage. Now, we will create 6 equal size (i.e. 4GB each) partitions as follows:

[root@gridserver ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf5d5e858.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 1
First cylinder (1-3263, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3263, default 3263):
Using default value 3263

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-3263, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (524-3263, default 524):
Using default value 524
Last cylinder, +cylinders or +size{K,M,G} (524-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1047-3263, default 1047):
Using default value 1047
Last cylinder, +cylinders or +size{K,M,G} (1047-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1570-3263, default 1570):
Using default value 1570
Last cylinder, +cylinders or +size{K,M,G} (1570-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (2093-3263, default 2093):
Using default value 2093
Last cylinder, +cylinders or +size{K,M,G} (2093-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (2616-3263, default 2616):
Using default value 2616
Last cylinder, +cylinders or +size{K,M,G} (2616-3263, default 3263): +4G

Command (m for help): p

Disk /dev/sdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 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: 0xf5d5e858

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        3263    26210016    5  Extended
/dev/sdb5               1         523     4200934+  83  Linux
/dev/sdb6             524        1046     4200966   83  Linux
/dev/sdb7            1047        1569     4200966   83  Linux
/dev/sdb8            1570        2092     4200966   83  Linux
/dev/sdb9            2093        2615     4200966   83  Linux
/dev/sdb10           2616        3138     4200966   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@gridserver ~]#

Now, we have 6 partitions (4GB each), that we can use for Oracle ASM Storage Disks.

 

Install ASMLIB

The Oracle ASMLIB kernel driver is now included in the UEK (Unbreakable Enterprise Kernel).  No driver package needs to be installed when using this kernel.  The oracleasm-support and oracleasmlib packages still need to be installed from ULN (Unbreakable Linux Network).

While the driver and support tools are on the Oracle Linux installation media, the oracleasmlib RPM is not (this package allows Oracle to access the kernel driver).

This package is only available on ULN. Subscribers to ULN can use yum or up2date to download and install the package on their servers. Non-subscribers are free to use the similar package built for RHEL (Red Hat Enterprise Linux) on their Oracle Linux machines.

Good News is that oracleasm kernel driver is also available from the RHEL and CentOS yum repositories. Since, our OS is CentOS 6.3, therefore, I can easily install it using yum.

Check if oracleasm module is available for your Linux distro as follows:

[root@gridserver sysconfig]# yum search oracleasm
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: centos.mirror.net.in
* extras: centos.mirror.net.in
* updates: centos.mirror.net.in
base                                       | 3.7 kB     00:00
extras                                     | 3.4 kB     00:00
updates                                    | 3.4 kB     00:00
==================== N/S Matched: oracleasm==========================
kmod-oracleasm.x86_64 : oracleasm kernel module(s)

  Name and summary matches only, use "search all" for everything.
[root@gridserver sysconfig]#

Install kmod-oracleasm now.

[root@gridserver sysconfig]# yum install oracleasm
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: centos.mirror.net.in
* extras: centos.mirror.net.in
* updates: centos.mirror.net.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-oracleasm.x86_64 0:2.0.8-6.el6_7 will be installed
--> Processing Dependency: kernel(kmem_cache_alloc_trace) = 0x2044fa9e for package: kmod-oracleasm-2.0.8-6.el6_7.x86_64
--> Processing Dependency: kernel(get_user_pages_fast) = 0xa2046a95 for package: kmod-oracleasm-2.0.8-6.el6_7.x86_64
--> Processing Dependency: kernel >= 2.6.32-573.el6 for package: kmod-oracleasm-2.0.8-6.el6_7.x86_64
--> Running transaction check
---> Package kernel.x86_64 0:2.6.32-573.22.1.el6 will be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-573.22.1.el6 for package: kernel-2.6.32-573.22.1.el6.x86_64
--> Processing Dependency: dracut-kernel >= 004-388.el6 for package: kernel-2.6.32-573.22.1.el6.x86_64
--> Running transaction check
---> Package dracut-kernel.noarch 0:004-283.el6 will be updated
---> Package dracut-kernel.noarch 0:004-388.el6 will be an update
--> Processing Dependency: dracut = 004-388.el6 for package: dracut-kernel-004-388.el6.noarch
---> Package kernel-firmware.noarch 0:2.6.32-279.el6 will be updated
---> Package kernel-firmware.noarch 0:2.6.32-573.22.1.el6 will be an update
--> Running transaction check
---> Package dracut.noarch 0:004-283.el6 will be updated
--> Processing Dependency: dracut = 004-283.el6 for package: dracut-network-004-283.el6.noarch
---> Package dracut.noarch 0:004-388.el6 will be an update
--> Running transaction check
---> Package dracut-network.noarch 0:004-283.el6 will be updated
---> Package dracut-network.noarch 0:004-388.el6 will be an update
--> Processing Conflict: kernel-2.6.32-573.22.1.el6.x86_64 conflicts bfa-firmware < 3.2.21.1-2
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package bfa-firmware.noarch 0:3.0.0.0-1.el6 will be updated
---> Package bfa-firmware.noarch 0:3.2.23.0-2.el6 will be an update
--> Finished Dependency Resolution

<>

=====================================================================
Package          Arch    Version             Repository         Size
=====================================================================Installing:
kmod-oracleasm   x86_64  2.0.8-6.el6_7       updates            36 k
Updating:
bfa-firmware     noarch  3.2.23.0-2.el6      base              3.2 M
Installing for dependencies:
kernel           x86_64  2.6.32-573.22.1.el6 updates            30 M
Updating for dependencies:
dracut           noarch  004-388.el6         base              125 k
dracut-kernel    noarch  004-388.el6         base               26 k
dracut-network   noarch  004-388.el6         base               64 k
kernel-firmware  noarch  2.6.32-573.22.1.el6 updates            18 M

Transaction Summary
=====================================================================Install       2 Package(s)
Upgrade       5 Package(s)

Total download size: 52 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 52 M
(1/7): bfa-firmware-3.2.23.0-2.el6.noarch.rpm      | 3.2 MB     02:37
(2/7): dracut-004-388.el6.noarch.rpm               | 125 kB     00:04
(3/7): dracut-kernel-004-388.el6.noarch.rpm        |  26 kB     00:02
(4/7): dracut-network-004-388.el6.noarch.rpm       |  64 kB     00:04
(5/7): kernel-2.6.32-573.22.1.el6.x86_64.rpm       |  30 MB     08:06
(6/7): kernel-firmware-2.6.32-573.22.1.el6.noarch.rpm    |  18 MB     08:04
(7/7): kmod-oracleasm-2.0.8-6.el6_7.x86_64.rpm     |  36 kB     00:01
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    35 kB/s |  52 MB     25:25
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : dracut-004-388.el6.noarch                                                  1/12
  Updating   : dracut-kernel-004-388.el6.noarch                 2/12
  Updating   : kernel-firmware-2.6.32-573.22.1.el6.noarch       3/12
  Installing : kernel-2.6.32-573.22.1.el6.x86_64                4/12
  Installing : kmod-oracleasm-2.0.8-6.el6_7.x86_64              5/12
  Updating   : dracut-network-004-388.el6.noarch                6/12
  Updating   : bfa-firmware-3.2.23.0-2.el6.noarch               7/12
  Cleanup    : dracut-network-004-283.el6.noarch                8/12
  Cleanup    : dracut-kernel-004-283.el6.noarch                 9/12
  Cleanup    : dracut-004-283.el6.noarch                       10/12
  Cleanup    : kernel-firmware-2.6.32-279.el6.noarch           11/12
  Cleanup    : bfa-firmware-3.0.0.0-1.el6.noarch               12/12
  Verifying  : dracut-kernel-004-388.el6.noarch                 1/12
  Verifying  : dracut-network-004-388.el6.noarch                2/12
  Verifying  : kernel-2.6.32-573.22.1.el6.x86_64                3/12
  Verifying  : bfa-firmware-3.2.23.0-2.el6.noarch               4/12
  Verifying  : kernel-firmware-2.6.32-573.22.1.el6.noarch       5/12
  Verifying  : dracut-004-388.el6.noarch                        6/12
  Verifying  : kmod-oracleasm-2.0.8-6.el6_7.x86_64              7/12
  Verifying  : dracut-004-283.el6.noarch                        8/12
  Verifying  : bfa-firmware-3.0.0.0-1.el6.noarch                9/12
  Verifying  : dracut-kernel-004-283.el6.noarch                10/12
  Verifying  : dracut-network-004-283.el6.noarch               11/12
  Verifying  : kernel-firmware-2.6.32-279.el6.noarch           12/12

Installed:
  kmod-oracleasm.x86_64 0:2.0.8-6.el6_7

Dependency Installed:
  kernel.x86_64 0:2.6.32-573.22.1.el6

Updated:
  bfa-firmware.noarch 0:3.2.23.0-2.el6

Dependency Updated:
  dracut.noarch 0:004-388.el6      dracut-kernel.noarch 0:004-388.el6      dracut-network.noarch 0:004-388.el6      kernel-firmware.noarch 0:2.6.32-573.22.1.el6

Complete!
[root@gridserver sysconfig]#

Once, Kernel is updated, download and install latest versions of oracleasm-support and oracleasmlib from http://www.oracle.com.

[root@gridserver sysconfig]# cd
[root@gridserver ~]# wget http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
--2016-04-10 06:04:51--  http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
Resolving oss.oracle.com... 137.254.120.35
Connecting to oss.oracle.com|137.254.120.35|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm [following]
--2016-04-10 06:04:52--  https://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
Connecting to oss.oracle.com|137.254.120.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 74984 (73K) [application/x-rpm]
Saving to: âoracleasm-support-2.1.8-1.el6.x86_64.rpmâ

100%[==============================>] 74,984      52.4K/s   in 1.4s

2016-04-10 06:04:54 (52.4 KB/s) - âoracleasm-support-2.1.8-1.el6.x86_64.rpmâ

[root@gridserver ~]# wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
--2016-04-10 06:05:08--  http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
Resolving download.oracle.com... 110.93.233.18, 110.93.233.32
Connecting to download.oracle.com|110.93.233.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13300 (13K) [application/x-redhat-package-manager]
Saving to: âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

100%[=============================>] 13,300      --.-K/s   in 0.01s

2016-04-10 06:05:08 (913 KB/s) - âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

[root@gridserver ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  oracleasmlib-2.0.4-1.el6.x86_64.rpm  oracleasm-support-2.1.8-1.el6.x86_64.rpm
[root@gridserver ~]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
[root@gridserver ~]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]
[root@gridserver ~]#

 

Create Users and Roles

Create following OS users and groups as required by Oracle Grid Infrastructure 12c.

[root@gridserver ~]# groupadd -g 601 oinstall
[root@gridserver ~]# groupadd -g 602 dba
[root@gridserver ~]# groupadd -g 603 oper
[root@gridserver ~]# groupadd -g 604 asmadmin
[root@gridserver ~]# groupadd -g 605 asmoper
[root@gridserver ~]# groupadd -g 606 asmdba
[root@gridserver ~]#
[root@gridserver ~]# useradd -u 601 -g oinstall -G asmadmin,asmdba,asmoper grid
[root@gridserver ~]#
[root@gridserver ~]# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@gridserver ~]#

 

Configure Oracle ASM Library Driver

Configure Oracle ASM Library Driver as follows:

[root@gridserver ~]# 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 []: asmadmin
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@gridserver ~]#

Beware that, if you omit the user and group in the above configuration then it will be set to default user root and default group root, and it creates problem while detecting candidate disks during grid infrastructure installation.

[root@localhost ~]# 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
[root@localhost ~]#

 

Create ASM Disks

ASMLIB does not support SELINUX, therefore we must disable the SELINUX before move on.

[root@gridserver ~]# setenforce 0
[root@gridserver ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config && cat /etc/selinux/config

# 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

[root@gridserver ~]#

Create ASM disks, I will create 3 disks for oradata and 3 disks for recovery_area.

[root@gridserver ~]# oracleasm createdisk ASM_DATA1 /dev/sdb5
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]# oracleasm createdisk ASM_DATA2 /dev/sdb6
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]# oracleasm createdisk ASM_DATA3 /dev/sdb7
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]# oracleasm createdisk ASM_FRA1 /dev/sdb8
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]# oracleasm createdisk ASM_FRA2 /dev/sdb9
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]# oracleasm createdisk ASM_FRA3 /dev/sdb10
Writing disk header: done
Instantiating disk: done
[root@gridserver ~]#

If you are installing Oracle Grid Infrastructure for a cluster and the disks are located at a shared storage that are already marked by another node in RAC then these disks can only be scanned by following command after setup iScsi Initiator.

oracleasm scandisks

ASMLIB has been installed and ASM disks have been created. We can install Oracle Grid Infrastructure 12c on the Server.

Read Also: Install Oracle Grid Infrastructure 12c as Stand Alone Server

ASMLIB : Installation and Configuration


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment