Monday, March 18, 2013

Upgrading ASMLIB

To upgrade ASMLIB, the system administrator can take the following steps,

Generally system administrator will do this upgrade, because DBA's will not be having any control over to perform action as a root user, so this needs to be done with the help of system admin.

The reason why I am publishing this information here is every DBA should know how ASMLIB is getting upgraded and whats happening behind the scene and to understand which circumstances this API should get upgraded.

Kindly note that this activity is just a software upgrade and no disk labels are manipulated  Also this is a local node upgrade, so in an RAC environment each node should be upgraded individually

How to do:
  1. Shutdown the ASM
  2. Execute /etc/init.d/oracleasm stop
  3. Execute rpm -Uvh oracleasm-*.rpm
  4. Execute /etc/init.d/oracleasm start
  5. Startup ASM
Whats Happening during the upgrade:

Actual upgrade happening during the 3rd step, rpm -U will perform the upgrade of all oracleasm* rpm's. Once its done you can start the service and ASM instance as well.

When to do :

All oracleasm and its dependent rpm should get upgraded to the new version, when we perform Operating system upgrade.

For example you configured ASMLIB when your O/S was in Linux 5.5 and if you go for Linux 5.8 then after the O/S upgrade sys admin should also upgrade all ASMLIB rpms to match the current O/S version otherwise you will not be able to even startup the service.

I faced the same situation couple of months back. Actually we configured ASM on one host later that host was upgraded to Linux version 5.8 once the O/S upgrade has been done system admin failed to upgrade the ASMLIB rpms, and he asked me to start the service and while starting up the service I faced below error.
oracle:+ASM@myhost /dev/oracleasm>ls -lrt
total 0

oracle:+ASM@myhost /oracle> sudo oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "ARCHLOG"
Unable to instantiate disk "ARCHLOG"
Instantiating disk "LOG2"
Unable to instantiate disk "LOG2"
Instantiating disk "DATAFILE"
Unable to instantiate disk "DATAFILE"
Instantiating disk "LOG1"
Unable to instantiate disk "LOG1"
since oracleasm rpms are not upgraded I was not able to startup the service, upon checking further found none of ASM disk are visible in its default directory i.e /dev/oracleasm/disks/* when I tried to scan the disks it couldn't even initialize those disks due to its unavailability!!

Finally found rpms for ASMLIB was still in older version even after the O/S upgrade. Then sys admin upgraded those rpm then the issue got fixed.

You can use below command to find the list of rpms and its version for oracleasm utility.
oracle:+ASM@myhost /oracle>rpm -qa | grep -i oracleasm

I Hope this article helped to you. I am expecting your suggestions/feedback.

Interpreting Oracleasm Utility

Overview of ASMLIB

Early in the design of ASM, Oracle decided an alternative to the standard operating system interface for device management, disk discovery and this mechanism needed to be easily integraded into ASM. The core concept was to prduce a storage management interface API, called ASMLIB.

The main objective of ASMLIB is to provide a more efficient mechanism for managing disk and I/O processing of ASM storage, it performs below functions,

  1. Device discovery 
  2. I/O processing 
  3. Performance and reliability 

Configuring ASMLIB

Once the appropriate Linux rpm files are installed on the host. The ASMLIB installs a utility in the /etc/init.d directory called oracleasm, with the help of this utility we can perform all device management activities. Now we need to configure the ASMLIB, this should be done as a root user.

In order to configure oracleasm we need to make sure below rpm are installed on the host and these rpm's are designed and developed by Oracle.


Execute /etc/init.d/oracleasm script along with configure option this will setup and configure ASMLIB for the host. In RAC environment we need to execute this script in each node.

[root@myhost ~]# /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 without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [dba]: dba
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@myhost ~]#
At the end of the installation a virtual filesystem (specific to ASMLIB) called /dev/oracleasm is created and mounted.

Managing Disk in ASMLIB 

After the storage administrator mapped new Lun to the server, it becomes available to the server and can be seen in /proc/partitions on Linux. The system admin then partitions this device using the linux fdisk utility. Once its been partitioned the new disk is sys admin handover the new disk to DBA. Then DBA can stamp the given disk into ASM using "createdisk"

In RAC environment, it allows "createdisk" command to be run on only one node and all other nodes of the RAC cluster simply need to pickup the list of disk through ASMLIB scan. This is because RAC uses shared storage architecture.

oracle:@myhost /oracle>sudo /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1
Marking disk "DISK1" as an ASM disk:                       [  OK  ]

oracle:@myhost /oracle>sudo /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]

Each disk successfully created is considered a marked ASMLIB disk and is listed in the oracleasm filesystem i.e /dev/oracleasm/disks/* this is the default disk discovery path for ASM.
User can query the disk to determine whether they are valid ASM disks.
For this use the following "oracleasm querydisk" command.

The querydisk command is applicable to both the raw device and the ASM disk.

oracle:@myhost /oracle>sudo /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1
Marking disk "DISK1" as an ASM disk:                       [  OK  ]

oracle:@myhost /oracle>sudo /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]

The disk which you are quering is not a valid ASM disk then following error will occur.
oracle:@myhost /oracle>sudo /etc/init.d/oracleasm querydisk /dev/sda1
Device "/dev/sda1" is not marked as an ASM disk

All the disks stamped using ASMLIB can be listed using the following "oracleasm listdisks" command.
oracle:@myhost /oracle>sudo /etc/init.d/oracleasm listdisks

Disks that are no longer needed by ASM can be dropped using "oracleasm deletedisk" command.
oracle:@myhost /oracle>sudo /etc/init.d/oracleasm deletedisk DISK1
Removing ASM disk "DISK1":                                 [  OK  ]

See also :

Upgrade ASMLIB -

I hope this article helped to you. I am expecting your suggestions/feedback.