Wednesday, August 6, 2014

ASMLIB quick reference

ASMLIB

Linux OS Service 'oracleasm'

  • Service Name
oracleasm
  • Description
The oracleasm service is used to provision, configure and manage Oracle Automatic Storage Management (ASM) disks via the Oracle Automatic Storage Management library driver (ASMLib). The oracleasm services creates the necessary library interface through which ASM disk devices are made available to Oracle ASM (instance).
  • Nature
System service
  • Configuration File
/etc/sysconfig/oracleasm
  • Oracle Enterprise Linux Version(s)
  • OEL 4
  • OEL 5
  • Requirement
Optional - needed only if operating system-level management and configuration of Oracle ASM disk devices is required. Not needed if Oracle ASM (instance-only) management of ASM group/disk devices is required/preferred.

oracleasm

/etc/init.d/oracleasm 

$ oracleasm -h
Usage: oracleasm [--exec-path=] [ ]
       oracleasm --exec-path
       oracleasm -h
       oracleasm -V

The basic oracleasm commands are:
    configure        Configure the Oracle Linux ASMLib driver
    init             Load and initialize the ASMLib driver
    exit             Stop the ASMLib driver
    scandisks        Scan the system for Oracle ASMLib disks
    status           Display the status of the Oracle ASMLib driver
    listdisks        List known Oracle ASMLib disks
    querydisk        Determine if a disk belongs to Oracle ASMlib
    createdisk       Allocate a device for Oracle ASMLib use
    deletedisk       Return a device to the operating system
    renamedisk       Change the label of an Oracle ASMlib disk
    update-driver    Download the latest ASMLib driver



OptionDescription
configure
Use the configure option to reconfigure the Automatic Storage Management library driver, if necessary:
# /etc/init.d/oracleasm configure
enable
disable
Use the disable and enable options to change the actions of the Automatic Storage Management library driver when the system starts. The enable option causes the Automatic Storage Management library driver to load when the system starts:
# /etc/init.d/oracleasm enable
start
stop
restart
Use the startstop, and restart options to load or unload the Automatic Storage Management library driver without restarting the system:
# /etc/init.d/oracleasm restart
createdisk
Use the createdisk option to mark a disk device for use with the Automatic Storage Management library driver and give it a name:
# /etc/init.d/oracleasm createdisk DISKNAME devicename
deletedisk
Use the deletedisk option to unmark a named disk device:
# /etc/init.d/oracleasm deletedisk DISKNAME
Caution: Do not use this command to unmark disks that are being used by an Automatic Storage Management disk group. You must delete the disk from the Automatic Storage Management disk group before you unmark it.
querydisk
Use the querydisk option to determine if a disk device or disk name is being used by the Automatic Storage Management library driver:
# /etc/init.d/oracleasm querydisk {DISKNAME | devicename}
listdisks
Use the listdisks option to list the disk names of marked Automatic Storage Management library driver disks:
# /etc/init.d/oracleasm listdisks
scandisks
Use the scandisks option to enable cluster nodes to identify which shared disks have been marked as Automatic Storage Management library driver disks on another node:
# /etc/init.d/oracleasm scandisks

Q&A

  • Is /dev/oracleasm created?
When ASMLIB is configured, a special filesystem is created and mounted: /dev/oracleasm.
   
$ df -ha
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc2              13G   11G  1.9G  85% /
none                     0     0     0   -  /proc
none                     0     0     0   -  /dev/pts
usbdevfs                 0     0     0   -  /proc/bus/usb
/dev/hdc1             101M   14M   81M  15% /boot
none                  250M     0  250M   0% /dev/shm
/dev/sda1             8.4G  4.8G  3.2G  60% /oradata2
/dev/sde1             8.3G  6.6G  1.4G  84% /oradata3
oracleasmfs              0     0     0   -  /dev/oracleasm

When command oracleasm createdisk is executed, a block device is created under /dev/oracleasm/disks.   This is the device discovered by ASMLIB using the string ORCL:*. 
$ ll /dev/oracleasm/disks
total 0
brw-rw----  1 oracle dba 8,  97 Apr 28 15:20 VOL001
brw-rw----  1 oracle dba 8,  81 Apr 28 15:20 VOL002
brw-rw----  1 oracle dba 8,  65 Apr 28 15:20 VOL003
brw-rw----  1 oracle dba 8,  49 Apr 28 15:20 VOL004
brw-rw----  1 oracle dba 8,  33 Apr 28 15:20 VOL005
brw-rw----  1 oracle dba 8,  17 Apr 28 15:20 VOL006
brw-rw----  1 oracle dba 8, 129 Apr 28 15:20 VOL007
brw-rw----  1 oracle dba 8, 113 Apr 28 15:20 VOL008

  • Checking if ASMLIB was installed properly:
[root@arlnx2 asm_tar]# /etc/init.d/oracleasm status
Checking if ASM is loaded:                                  [  OK  ]
Checking if /dev/oracleasm is mounted:                [  OK  ]

If the command fails, use strace and generate a log file:

strace -f -o asm_status.out /etc/init.d/oracleasm status

Additional information to verify the installation can be found in note 269194.1 

  • Listing the ASMLIB disks:
$ /etc/init.d/oracleasm listdisks
VOL001
VOL002
VOL003
VOL004
VOL005
VOL006
VOL007
VOL008

$ ll /dev/oracleasm/disks

total 0
brw-rw----  1 oracle dba 8,  97 Apr 28 15:20 VOL001
brw-rw----  1 oracle dba 8,  81 Apr 28 15:20 VOL002
brw-rw----  1 oracle dba 8,  65 Apr 28 15:20 VOL003
brw-rw----  1 oracle dba 8,  49 Apr 28 15:20 VOL004
brw-rw----  1 oracle dba 8,  33 Apr 28 15:20 VOL005
brw-rw----  1 oracle dba 8,  17 Apr 28 15:20 VOL006
brw-rw----  1 oracle dba 8, 129 Apr 28 15:20 VOL007
brw-rw----  1 oracle dba 8, 113 Apr 28 15:20 VOL008

You will find an entry under /dev/oracleasm/disks.   This is the block device associated to the physical device. If the file exist the command will return information, but if not, plese execute:

strace -f -o asm_listd.out /etc/init.d/oracleasm listdisks
  • How to identify the physical disk bound to the ASMLIB disk.
  Use  /etc/init.d/oracleasm querydisk   where NAME is any name under /dev/oracleasm/disks.
[root@arlnx2 asm_tar]# /etc/init.d/oracleasm querydisk -d VOL1

Disk "VOL1" is a valid ASM disk on device [8, 33]
The command reports the device identified with major,minor numbers which are unique numbers associated to each disk.  File /proc/partitions can be used to find the name of the device associated with those numbers:

$ more /proc/partitions

major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

   8     0    8891620 sda 39715 78016 941080 417000 156198 242472 3189752 214180 0 420630 631180
   8     1    8891376 sda1 39691 77970 940922 416780 156198 242472 3189752 214180 0 420410 630960
   8    16    8891620 sdb 87 250 803 740 0 0 0 0 0 740 740
   8    17    8891376 sdb1 57 193 632 480 0 0 0 0 0 480 480
   8    32   17783250 sdc 745 2993 8321 8300 0 0 0 0 0 5250 8300
   8    33     977904 sdc1 87 139 644 1040 0 0 0 0 0 1040 1040 
   8    34     977920 sdc2 35 193 456 230 0 0 0 0 0 230 230
   8    35          1 sdc3 4 0 8 40 0 0 0 0 0 40 40
   8    37     977904 sdc5 57 193 632 1240 0 0 0 0 0 1240 1240
   8    38     977904 sdc6 57 193 632 1170 0 0 0 0 0 1170 1170

Also connected as root you can run the same command but referencing the physical device:

[root@arlnx2 dbs]# /etc/init.d/oracleasm querydisk /dev/sdc1
Disk "/dev/sdc1" is marked an ASM disk with the label "VOL1"


Any error on this command will require using strace:
strace -f -o asm_query.out /etc/init.d/oracleasm querydisk
  • How to identify if ASMLIB is used or not
SQL> select path ,library from v$asm_disk;
PATH                 LIBRARY
-------------------- ------------------------------------------------------------
ORCL:VOL001          ASM Library - Generic Linux, version 2.0.2 (KABI_V2)
ORCL:VOL002          ASM Library - Generic Linux, version 2.0.2 (KABI_V2)
ORCL:VOL003          ASM Library - Generic Linux, version 2.0.2 (KABI_V2)
ORCL:VOL004          ASM Library - Generic Linux, version 2.0.2 (KABI_V2)

PATH                                               LIBRARY
-------------------------------------------------- ------------------------------------------------------------
/dev/oracleasm/disks/ASM7                          System
/dev/oracleasm/disks/ASM2                          System
/dev/oracleasm/disks/ASM1                          System
/dev/oracleasm/disks/ASM5                          System
/dev/oracleasm/disks/ASM6                          System
/dev/oracleasm/disks/ASM4                          System
/dev/oracleasm/disks/ASM3                          System

Troubleshooting ASM/ASMLIB issues

1) In order to check if the ASMLIB API is correctly configured, please execute the next commands and provide us the output (from each node if this is RAC): 
$> cat /etc/*release 
$> uname -a 
$> rpm -qa |grep oracleasm 
$> df -ha
2) Check the discovery path (from each node if this is RAC): 
$> /etc/init.d/oracleasm status 
$> /usr/sbin/oracleasm-discover 
$> /usr/sbin/oracleasm-discover 'ORCL:*'

3) Please check if the ASMLIB devices can be accessed (from each node if this is RAC): 
$> /etc/init.d/oracleasm scandisks 
$> /etc/init.d/oracleasm listdisks 
$> /etc/init.d/oracleasm querydisk  
$> ls -l /dev/oracleasm/disks
4) Upload the next files from each node if this is RAC: 
=)> /var/log/messages* 
=)> /var/log/oracleasm
=)> /etc/sysconfig/oracleasm
5) Please show us the partition table (from each node if this is RAC): 
$> cat /proc/partitions
6) If you are using multipath devices (mapper devices or emcpower) then show me the output of: 
$> ls -l /dev/mpath/* 

$> ls -l /dev/mapper/* 

$> ls -l /dev/dm-*  

$> ls -l /dev/emcpower* 
Or if you have another multipath configuration then list the devices: 
$> ls -l /dev/*
7) Finally connect to your ASM instance, execute the next script and upload me the output file (from each node if this is RAC): 
spool asm<#>.html
SET MARKUP HTML ON 
set echo on

set pagesize 200

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';

select 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , sysdate " " from dual;


select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';

select * from v$asm_diskgroup;

SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER; 

SELECT * FROM V$ASM_CLIENT; 

select * from V$ASM_ATTRIBUTE;

select * from v$asm_operation;
select * from gv$asm_operation


select * from v$version;

show parameter asm
show parameter cluster
show parameter instance_type
show parameter instance_name
show parameter spfile

show sga

spool off

exit

No comments: