Monday, March 18, 2013

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.

oracleasm-support-2.1.7-1.el5
oracleasm-2.6.18-194.32.1.el5-2.0.5-1.el5
oracleasmlib-2.0.4-1.el5

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
DISK1
DISK2
DISK3

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 - http://www.sivakumardba.com/2013/03/upgrading-asmlib.html

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

No comments:

Post a Comment