Category Archives: ASM

UDEV

Oracle recently announced that ASMlib will not be certified or supported on Red Hat Enterprise Linux 6. To be more specific, MOS note “Oracle ASMLib Software Update Policy for Red Hat Enterprise Linux Supportd by Red Hat [ID 1089399.1]”, the quote of interest being:

“For RHEL6, Oracle will only provide ASMLib software and updates when configured with a kernel distributed by Oracle. Oracle will not provide ASMLib packages for kernels distributed by Red Hat as part of RHEL6. ASMLib updates will be delivered via Unbreakable Linux Network(ULN) which is available to customers with Oracle Linux support. ULN works with both Oracle Linux or Red Hat Linux installations, but ASMlib usage will require replacing any Red Hat kernel with a kernel provided by Oracle.”

Oracle has indicated that all other major components of the Oracle database stack, including ASM and RAC, will be supported on Red Hat Enterprise Linux 6 moving forward, and the certification process is currently underway.

Udev is a native component of Red Hat Enterprise Linux and as such is fully supported by Red Hat. Oracle has published several white papers and technical guides on configuring their database with udev-managed devices, demonstrating their support for the technology as well.

The purpose of this document is to explain how the udev device manager can be used to replace ASMlib for ASM-backed Oracle instances. This document attempts to bridge the gap for those familiar with either udev or ASMlib, but not necessarily with both. Additionally, it details how to create new ASM disk groups from scratch using udev and explains how to perform an in-place migration from an ASMlib implementation on Red Hat Enterprise Linux 5 to an equivalent, supported udev configuration without requiring any re-installation or re-configuration of database components.

In linux Oracle’s ASMLib is used to provide device persistence and ownership after a reboot. UDEV is an alternative to ASMlib to provide device persistence and ownership on devices. This article outlines the steps that are required to establish device persistence and setup new device names with desired permissions and ownership in REDHAT6.1 using udev.

Universally Unique Identifiers (UUIDs) are a standardized method for identifying computers and devices in distributed computing environments. This section uses UUIDs to identify iSCSI, SRP, or Fibre Channel LUNs. UUIDs persist after restarts, disconnection and device swaps. The UUID is similar to a label on the device.

<br data-mce-bogus="1">

[root@dbsl2001 etc]# cat redhat-release
 <strong>Red Hat Enterprise Linux Server release 6.1 (Santiago)</strong>

 

Single path configuration

Edit the /etc/scsi_id.config file.
Add the following line:
options=–whitelisted –replace-whitespace
To display the UUID for a given device run the
scsi_id –whitelisted –replace-whitespace –device=/dev/sd*
command.
example:
[root@dbsl2001 etc]# scsi_id –whitelisted –replace-whitespace –device=/dev/sdd
14f504e46494c45525971777468462d5a3277382d42727976

 

Verify the UUID output from the:

scsi_id –whitelisted –replace-whitespace –device=/dev/sd*

 

command is correct and as expected.
Create a rule to name the device.

Create a file named 20-names.rules in the:

/etc/udev/rules.d directory.

Add new rules to this file. All rules are added to the same file using the same format. Rules follow this format:

KERNEL==”sd*”, SUBSYSTEM==”block”, PROGRAM=”/sbin/scsi_id –whitelisted –replace-whitespace /dev/$name”, RESULT==”UUID”, NAME=”devicename”,OWNER=”<OS user>”, GROUP=”,OS group>”, MODE=”0660?

Replace UUID and devicename with the UUID retrieved above, and a name for the device. This is an example for the rule above for three example iSCSI luns:

KERNEL==”sd*”, SUBSYSTEM==”block”, PROGRAM=”/sbin/scsi_id –whitelisted –replace-whitespace /dev/$name”, RESULT==”14f504e46494c45525971777468462d5a3277382d42727976″, NAME=”asm1″,OWNER=”grid”,GROUP=”dba”,MODE=”0660″

[root@dbsl2001 rules.d]# udevadm test /block/sdd

[root@dbsl2001 rules.d]# start_udev
Starting udev:                                             [  OK  ]

Check the names, ownerships and permissions of the devices.
[root@dbsl2001 rules.d]# ls -la /dev/asm*
brw-rw—-. 1 grid disk 8, 49 Sep  5 00:20 /dev/asm1

ASM statistics script


#!/bin/ksh 
############################################################################ 
# Script Name..: 
# Description..: 
# Author.......: Michael Culp 
# Date.........: / /2012 
# Version......: 
# Modified By..: 
# Date Modified: 
# Comments.....: 
# Schema owner.: 
#    alter session set current 
# Login User...: 
# Run Order....: 
# Dependent on.: 
# Script type..: # 
############################################################################ 

echo "ASM File types stored in this instance" 
echo ----------------------------------------------------- 
sqlplus -s "/ as sysdba" <<EOF    
set lines 120    
set pagesize 66    
column name format a25    
column type format a20    
select distinct type      
  from v\$asm_file; 
EOF 

echo "ASM files stored in ASM instance (better)" 
echo ----------------------------------------------------- 
sqlplus -s "/ as sysdba" <<EOF 
SET LINESIZE  150 
SET PAGESIZE  9999 
SET VERIFY    off 
COLUMN full_alias_path        FORMAT a63                  HEAD 'File Name' 
COLUMN system_created         FORMAT a8                   HEAD 'System|Created?' 
COLUMN bytes                  FORMAT 9,999,999,999,999    HEAD 'Bytes' 
COLUMN blocks                 FORMAT 9,999,999,999,999    HEAD 'Blocks' 
COLUMN space                  FORMAT 9,999,999,999,999    HEAD 'Space' 
COLUMN type                   FORMAT a18                  HEAD 'File Type' 
COLUMN redundancy             FORMAT a12                  HEAD 'Redundancy' 
COLUMN striped                FORMAT a8                   HEAD 'Striped' 
COLUMN creation_date          FORMAT a20                  HEAD 'Creation Date'
COLUMN disk_group_name        noprint BREAK ON report ON disk_group_name 
SKIP 1 compute sum label ""            of bytes space on disk_group_name 
compute sum label "Grand Total: " of bytes space on report 

SELECT CONCAT('+' || disk_group_name
     , SYS_CONNECT_BY_PATH(alias_name, '/')) full_alias_path   
     , bytes   
     , space   
     , NVL(LPAD(type, 18)
     , '&lt;DIRECTORY&gt;')  type   
     , creation_date   
     , disk_group_name   
     , LPAD(system_created, 4) system_created 
FROM ( SELECT g.name disk_group_name
            , a.parent_index    pindex
            , a.name            alias_name 
            , a.reference_index rindex         
            , a.system_created  system_created         
            , f.bytes           bytes         
            , f.blocks             blocks         
            , f.space              space         
            , f.type               type         
            , TO_CHAR(f.creation_date, 'DD-MON-YYYY HH24:MI:SS')  creation_date       
FROM v\$asm_file f RIGHT OUTER JOIN 
     v\$asm_alias a USING (group_number, file_number)   JOIN 
     v\$asm_diskgroup g USING (group_number)     ) 
WHERE type IS NOT NULL START WITH (MOD(pindex, POWER(2, 24))) = 0     
CONNECT BY PRIOR rindex = pindex; 


echo "Amount of space left on individual ASM disk devices" 
echo ----------------------------------------------------------- 
sqlplus -s "/ as sysdba" <<EOF    
set pagesize 66    
set lines 100    
column path format a20    

select path
       , state
       , total_mb
       , free_mb
  from v\$asm_disk; 

EOF 



echo "IO Stats ASM disks" 
echo ----------------------------------------------------------- 
sqlplus -s "/ as sysdba" <<EOF    
set pagesize 66    
set lines 120    
column path format a20    
column read_time heading "Read Time" format 999,999.99    
column write_time                    format 999,999.99    
column writes                        format 999,999,999,999    
column reads                         format 999,999,999,999   
column bytes_written                 format 999,999,999,999    
column bytes_read                    format 999,999,999,999    

select path
      ,reads
      ,read_time
      ,bytes_read,           writes
,           write_time
,           bytes_written      
from v\$asm_disk; 



echo "Amount of space left on individual ASM disk devices" 
echo ----------------------------------------------------------- 
sqlplus -s "/ as sysdba" &lt;&lt;EOF    
set pagesize 66    
set lines 100    
column path format a20    
select path
      ,state
      ,total_mb
      ,free_mb
 from v\$asm_disk; 

EOF 

echo "IO Stats ASM disks" 
echo ----------------------------------------------------------- 
sqlplus -s "/ as sysdba" <<EOF    

set pagesize 66    
set lines 120    
column path format a20    
column read_time heading "Read Time" format 999,999.99    
column write_time                    format 999,999.99    
column writes                        format 999,999,999,999    
column reads                         format 999,999,999,999    
column bytes_written                 format 999,999,999,999    
column bytes_read                    format 999,999,999,999    
select path
,           reads
,           read_time
,           bytes_read
,           writes
,           write_time
,           bytes_written      
from v\$asm_disk; 
EOF 

#!/bin/ksh 
############################################################################ # Script Name..: # Description..: # Author.......: Michael Culp # Date.........: / /2012 # Version......: # Modified By..: # Date Modified: # Comments.....: # Schema owner.: #    alter session set current # Login User...: # Run Order....: # Dependent on.: # Script type..: # ############################################################################ echo "ASM File types stored in this instance" echo ----------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF    set lines 120    set pagesize 66    column name format a25    column type format a20    select distinct type      from v\$asm_file; EOF echo "ASM files stored in ASM instance (better)" echo ----------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF SET LINESIZE  150 SET PAGESIZE  9999 SET VERIFY    off COLUMN full_alias_path        FORMAT a63                  HEAD 'File Name' COLUMN system_created         FORMAT a8                   HEAD 'System|Created?' COLUMN bytes                  FORMAT 9,999,999,999,999    HEAD 'Bytes' COLUMN blocks                 FORMAT 9,999,999,999,999    HEAD 'Blocks' COLUMN space                  FORMAT 9,999,999,999,999    HEAD 'Space' COLUMN type                   FORMAT a18                  HEAD 'File Type' COLUMN redundancy             FORMAT a12                  HEAD 'Redundancy' COLUMN striped                FORMAT a8                   HEAD 'Striped' COLUMN creation_date          FORMAT a20                  HEAD 'Creation Date' COLUMN disk_group_name        noprint BREAK ON report ON disk_group_name SKIP 1 compute sum label ""              of bytes space on disk_group_name compute sum label "Grand Total: " of bytes space on report SELECT     CONCAT('+' || disk_group_name, SYS_CONNECT_BY_PATH(alias_name, '/')) full_alias_path   , bytes   , space   , NVL(LPAD(type, 18), '&lt;DIRECTORY&gt;')  type   , creation_date   , disk_group_name   , LPAD(system_created, 4) system_created FROM     ( SELECT g.name           disk_group_name,              a.parent_index   pindex,              a.name               alias_name ,              a.reference_index    rindex         , a.system_created     system_created         , f.bytes              bytes         , f.blocks             blocks         , f.space              space         , f.type               type         , TO_CHAR(f.creation_date, 'DD-MON-YYYY HH24:MI:SS')  creation_date       FROM           v\$asm_file f RIGHT OUTER JOIN v\$asm_alias     a USING (group_number, file_number)                                     JOIN v\$asm_diskgroup g USING (group_number)     ) WHERE type IS NOT NULL START WITH (MOD(pindex, POWER(2, 24))) = 0     CONNECT BY PRIOR rindex = pindex; echo "Amount of space left on individual ASM disk devices" echo ----------------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF    set pagesize 66    set lines 100    column path format a20    select path,           state,           total_mb,           free_mb      from v\$asm_disk; EOF echo "IO Stats ASM disks" echo ----------------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF    set pagesize 66    set lines 120    column path format a20    column read_time heading "Read Time" format 999,999.99    column write_time                    format 999,999.99    column writes                        format 999,999,999,999    column reads                         format 999,999,999,999    column bytes_written                 format 999,999,999,999    column bytes_read                    format 999,999,999,999    select path,           reads,           read_time,           bytes_read,           writes,           write_time,           bytes_written      from v\$asm_disk; EOF                                                                                                123,1         Bot echo "Amount of space left on individual ASM disk devices" echo ----------------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF    set pagesize 66    set lines 100    column path format a20    select path,           state,           total_mb,           free_mb      from v\$asm_disk; EOF echo "IO Stats ASM disks" echo ----------------------------------------------------------- sqlplus -s "/ as sysdba" &lt;&lt;EOF    set pagesize 66    set lines 120    column path format a20    column read_time heading "Read Time" format 999,999.99    column write_time                    format 999,999.99    column writes                        format 999,999,999,999    column reads                         format 999,999,999,999    column bytes_written                 format 999,999,999,999    column bytes_read                    format 999,999,999,999    select path,           reads,           read_time,           bytes_read,           writes,           write_time,           bytes_written      from v\$asm_disk; EOF

ASM Views

Oracle has several main v$ views to expose ASM details. Oracle Automated Storage Management has several v$ views to see information About Automated Storage Management disks, diskgroups and other internals.

There are seven new v$ views provided in Oracle Database to monitor ASM structures.

v$asm_diskgroup: Describes a disk group (number, name, size related info, state, and redundancy type) Contains one row for every open ASM disk in the DB instance.
v$asm_client: Identifies databases using disk groups managed by the ASM instance. Contains no rows.
v$asm_disk: Contains one row for every disk discovered by the ASM instance, including disks that are not part of any disk group. Contains rows only for disks in the disk groups in use by that DB instance.
v$asm_file: Contains one row for every ASM file in every disk group mounted by the ASM instance. Contains rows only for files that are currently open in the DB instance.
v$asm_template: Contains one row for every template present in every disk group mounted by the ASM instance. Contains no rows
v$asm_alias: Contains one row for every alias present in every disk group mounted by the ASM instance. Contains no rows.
v$asm_operation: Contains one row for every active ASM long running operation executing in the ASM instance. Contains no rows.

Oracle v$ views for ASM and their x$ tables

The v$ views for ASM are built upon several ASM fixed tables, called x$ tables. The x$ tables are not really tables, they are C language structures inside the SGA RAM heap:

X$ Table v$ View
X$KFGRP V$ASM_DISKGROUP
X$KFGRP_STAT V$ASM_DISKGROUP_STAT
X$KFDSK V$ASM_DISK
X$KFKID V$ASM_DISK
X$KFDSK_STAT V$ASM_DISK_STAT
X$KFKID V$ASM_DISK_STAT
X$KFFIL V$ASM_FILE
X$KFALS V$ASM_ALIAS
X$KFTMTA V$ASM_TEMPLATE
X$KFNCL V$ASM_CLIENT
X$KFGMG V$ASM_OPERATION
X$KFENV V$ASM_ATTRIBUTE
X$KFNSDSKIOST V$ASM_DISK_IOSTAT

Support for ASMLib on Red Hat

Oracle will no longer release ASMLib kernel drivers for RHEL 6 kernels. See this note on support.oracle.com

Oracle ASMLib Software Update Policy for Red Hat Enterprise Linux Supported by Red Hat (Doc ID 1089399.1)

Going to Oracle EL 6 is an option, and may save money in the long run, one vendor to support OS and database. Oracle is much closer to the drivers that are used for database purposes exclusively, and support may actually be less expensive.