Wednesday, July 3, 2013

Setting up ASMLib's for ASM on Red Hat Enterprise Linux 5



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 service creates the necessary library interface through which ASM disk devices are made available to Oracle ASM (instance).
Configuration File /etc/sysconfig/oracleasm
ORACLEASM
/etc/init.d/oracleasm 

$ oracleasm -h
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
       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

Option
Description
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

In order to understand how ASMlib works and what it does in terms of server configuration, a detailed ASMlib setup is outlined below.
1. Install the relevant ASMlib components for your operating system/kernel combination.
Below is the command to verify the kernel version of the OS. /home/oracle>uname -r
2.6.18-308.20.1.el5
Download the relevant ASMlib’s from below web link. http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html

 2. Run /etc/init.d/oracleasm configures and assigns the appropriate environment variables.

         
 NOTE: Creating new ASM disks will fail if you use non-standard Oracle user/group names and fail to specify them correctly here.


3. Run /etc/init.d/oracleasm createdisk for each partition that will be assigned to a disk group.
 4. Note that Oracle creates new device entries under /dev/oracleasm/disks for each disk created. The key benefits of ASMlib are that it creates consistent device names, assigns the correct user/group ownership for files (dbauser/dbagroup), and assigns the correct permissions (660).


Question & Answers
  • 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

  • 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
$ 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
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 <NAME>  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:
  
$ grep -w 8 /proc/partitions |grep -w 33
   8    33  230685336 sdc1

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 <NAME>

  • 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)
Below LUN’s are not using ASM Libraries.
PATH                                               LIBRARY
---------------------------------------------------------------------
/dev/oracleasm/disks/ASM2                          System
/dev/oracleasm/disks/ASM1                          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 the output to Oracle support.(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 <each disk from previous output>
$> 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/<multi path device name>*
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:

Post a Comment