Category Archives: ASM

asm_common.ksh


#!/bin/ksh
############################################################################
# Script Name..: asm_com.ksh
# Description..: Common library for ASM items
# Author.......: Michael Culp
# Date.........: 10/17/2014
# Version......: .08
# Modified By..:
# Date Modified:
# Comments.....: imported from asm_diskmnt.ksh
# Schema owner.:
#    alter session set current
# Login User...:
# Run Order....:
# Dependent on.:
# Script type..:
############################################################################

# set -vx

initialize()
{
hostnm=`hostname -s`
log_file=asm_db_diskspc.log
# This won't be the same on all clusters
crs_dir=/oracle_crs/product/11.2.0/crs_1/bin/
}

get_asm_info_txt()
############################################################################
# Start ASM procedure put a copy in asm_sum.txt
# All this does is create the text file
############################################################################
{

${ORACLE_HOME}/bin/sqlplus -s "/ as sysdba" <<EOF > asm_sum.txt

SET LINESIZE  175
SET PAGESIZE  9999
SET HEADING OFF

-- set verify off
-- COLUMN group_name             FORMAT a32           HEAD 'Disk Group Name'
-- COLUMN state                  FORMAT a11           HEAD 'State'
-- COLUMN type                   FORMAT a6            HEAD 'Type'
-- COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
-- COLUMN free_mb                FORMAT 999,999,999   HEAD 'Free Size (MB)'
-- COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
-- COLUMN pct_used               FORMAT 999.99        HEAD 'Pct. Used'

select name, state, type, total_mb, free_mb, (total_mb - free_mb) used_mb, ROUND((1-(free_mb / total_mb))*100, 2) pct_used FROM v\$asm_diskgroup ORDER BY pct_used;


-- COLUMN group_name             FORMAT a20           HEAD 'Disk Group|Name'
-- COLUMN lun_size               FORMAT 9999          HEAD 'LUN Size|(GB)'
-- COLUMN total_luns             FORMAT 9999          HEAD 'Total|LUNs'

-- compute sum label "Grand Total: " of total_luns on report

-- SELECT vadg.name group_name,
--       ceil(round(vad.total_mb)/1024) lun_size,
--       count(*) total_luns
-- FROM v\\$asm_diskgroup vadg,
--     v\\$asm_disk vad
-- WHERE vad.group_number=vadg.group_number
-- GROUP BY vadg.name, vad.total_mb
-- ORDER BY vadg.name, vad.total_mb;

EOF

# cat asm_sum.txt
# testdisp=`cat asm_sum.txt`
# echo "this is the echo"
# echo "$testdisp"
# testdisp=$(<asm_sum.txt)
# echo "$testdisp"
#### End procedure
}

asm_file_type()
##################################################################
# Function name: asm_stat
# Description..: show file types in ASM
# Author.......: Michael Culp
##################################################################
{

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

}

asm_files()
##################################################################
# Function name: asm_files
# Description..: show file types in ASM
# Author.......: Michael Culp
##################################################################
{

echo
echo
echo "ASM files stored in ASM instance (better)"
echo -----------------------------------------------------
echo
echo

sqlplus -s "/ as sysdba" <<EOF
SET LINESIZE  150
SET PAGESIZE  9999
SET VERIFY    off

COLUMN full_alias_path        FORMAT a80                  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), '<DIRECTORY>')  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;

EOF
}

asm_spc_free()
{

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 a25
   select path,
          state,
          total_mb,
          free_mb
     from v\$asm_disk;
EOF

}

asm_io_stat()
{

echo "IO Stats by ASM disk devices"
echo -----------------------------------------------------------

sqlplus -s "/ as sysdba" <<EOF
   set pagesize 66
   set lines 120
   column path format a25
   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_unbal()
{

echo "ASM Unbalanced report"
echo -----------------------------------------------------------
sqlplus -s "/ as sysdba" <<EOF
set lines 150
set pages 150
-- spool <some file name>

column "Diskgroup" format A30
column "Imbalance" format 99.9 Heading "Percent|Imbalance"
column "Variance"  format 99.9 Heading "Percent|Disk Size|Variance"
column "MinFree"   format 99.9 Heading "Minimum|Percent|Free"
column "DiskCnt"   format 9999 Heading "Disk|Count"
column "Type"      format A10  Heading "Diskgroup|Redundancy"

SELECT g.name "Diskgroup",
       100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance",
       100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance",
       100*(min(d.free_mb/d.total_mb)) "MinFree",
       count(*) "DiskCnt",
       g.type "Type"
  FROM v\$asm_disk d,
       v\$asm_diskgroup g
 WHERE d.group_number = g.group_number and
       d.group_number <> 0 and
       d.state = 'NORMAL' and
       d.mount_status = 'CACHED'
 GROUP BY g.name, g.type;

-- spool off
EOF


}

asm_stub()
{
sqlplus -s "/ as sysdba" <<EOF
-- spool <some file name>

-- spool off
EOF
}

asm_dg_size()
################################################################
# Script Name..: asm_disk_size.ksh
# Description..: ASM Disk Group sizing
# Author.......: Michael Culp
################################################################
{

echo -----------------------------------------------------------
echo "ASM Diskgroups"
echo -----------------------------------------------------------

sqlplus -s "/ as sysdba" <<EOF
spool asm_diskgroups.txt

SET LINESIZE  145
SET PAGESIZE  9999
SET VERIFY    off

COLUMN group_name             FORMAT a20           HEAD 'Disk Group|Name'
COLUMN sector_size            FORMAT 99,999        HEAD 'Sector|Size'
COLUMN block_size             FORMAT 99,999        HEAD 'Block|Size'
COLUMN allocation_unit_size   FORMAT 999,999,999   HEAD 'Allocation|Unit Size'
COLUMN state                  FORMAT a11           HEAD 'State'
COLUMN type                   FORMAT a6            HEAD 'Type'
COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
COLUMN pct_used               FORMAT 999.99        HEAD 'Pct. Used'

break on report on disk_group_name skip 1

compute sum label "Grand Total: " of total_mb used_mb on report

SELECT
    name                                     group_name
  , sector_size                              sector_size
  , block_size                               block_size
  , allocation_unit_size                     allocation_unit_size
  , state                                    state
  , type                                     type
  , total_mb                                 total_mb
  , (total_mb - free_mb)                     used_mb
  , ROUND((1- (free_mb / total_mb))*100, 2)  pct_used
FROM
    v\$asm_diskgroup
ORDER BY
    name;


COLUMN group_name             FORMAT a20           HEAD 'Disk Group|Name'
COLUMN lun_size               FORMAT 9999          HEAD 'LUN Size|(GB)'
COLUMN total_luns             FORMAT 9999          HEAD 'Total|LUNs'

compute sum label "Grand Total: " of total_luns on report

SELECT
   vadg.name                                   group_name
  ,ceil(round(vad.total_mb)/1024)              lun_size
  ,count(*)                                    total_luns
FROM
   v\$asm_diskgroup vadg,
   v\$asm_disk vad
WHERE
   vad.group_number=vadg.group_number
GROUP BY
   vadg.name
  ,vad.total_mb
ORDER BY
   vadg.name
  ,vad.total_mb;

spool off

EOF

}

asm_disk_2_dg()
######################################################################
# Disk device to diskgroup mapping
######################################################################
{

sqlplus -s "/ as sysdba" <<EOF
set lines 150
set pages 150
column name format a20
column value format a20
-- spool <some file name>

SELECT SUBSTR(d.name,1,16) AS asmdisk,
       d.mount_status,
       d.state,
       dg.name AS diskgroup
  FROM V\$ASM_DISKGROUP dg,
       V\$ASM_DISK d
 WHERE dg.group_number = d.group_number
  order by dg.name;

SELECT dg.name AS diskgroup,
       SUBSTR(a.name,1,18) AS name,
       SUBSTR(a.value,1,24) AS value,
       read_only
  FROM V\$ASM_DISKGROUP dg,
       V\$ASM_ATTRIBUTE a WHERE dg.name = 'SHARED_DATA_DG01' AND
       dg.group_number = a.group_number;

SELECT dg.name AS diskgroup,
       SUBSTR(a.name,1,18) AS name,
       SUBSTR(a.value,1,24) AS value,
       read_only
  FROM V\$ASM_DISKGROUP dg,
       V\$ASM_ATTRIBUTE a WHERE dg.name = 'SHARED_FRA_DG01' AND
       dg.group_number = a.group_number;
-- spool off
EOF


}

asm_dsk_dev_lst()
########################################################
# Disk device listing
########################################################
{

echo
echo "ASM Disk devices....."
echo
ls -l /dev/mapper/asm*p1

echo
echo "ASM Disk devices (data)....."
echo
ls -l /dev/mapper/asm_d*p1

echo
echo "ASM Disk devices (fra)....."
echo
ls -l /dev/mapper/asm_f*p1

echo
echo "ASM Disk devices (system)....."
echo
ls -l /dev/mapper/asm_s*p1


# ls -l /dev/mapper/fra*p1
echo
echo "All devices from /dev/mapper directory ....."
echo
ls -l /dev/mapper
ls -l /dev/mapper/oraclevg*

}


asm_dsk_sze()
####################################################
# Shows the sizes of the diskgroups
# No prereq for ASM env
####################################################
{

clear

sqlplus -s "/ as sysdba" <<EOF
set wrap off
set lines 155 pages 9999
col "Group"      for 999
col "Group Name" for a25    Head "Group|Name"
col "Disk Name"  for a10
col "State"      for a10
col "Type"       for a10   Head "Diskgroup|Redundancy"
col "Total GB"   for 9,999,990 Head "Total|GB"
col "Free GB"    for 9,999,990 Head "Free|GB"
col "Imbalance"  for 99.9  Head "Percent|Imbalance"
col "Variance"   for 99.9  Head "Percent|Disk Size|Variance"
col "MinFree"    for 99.9  Head "Minimum|Percent|Free"
col "MaxFree"    for 99.9  Head "Maximum|Percent|Free"
col "DiskCnt"    for 9999  Head "Disk|Count"

prompt
prompt ASM Disk Groups
prompt ===============

SELECT g.group_number  "Group"
,      g.name          "Group Name"
,      g.state         "State"
,      g.type          "Type"
,      g.total_mb/1024 "Total GB"
,      g.free_mb/1024  "Free GB"
,      100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance"
,      100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance"
,      100*(min(d.free_mb/d.total_mb)) "MinFree"
,      100*(max(d.free_mb/d.total_mb)) "MaxFree"
,      count(*)        "DiskCnt"
FROM v\$asm_disk d, v\$asm_diskgroup g
WHERE d.group_number = g.group_number and
d.group_number <> 0 and
d.state = 'NORMAL' and
d.mount_status = 'CACHED'
GROUP BY g.group_number, g.name, g.state, g.type, g.total_mb, g.free_mb
ORDER BY 1;
EOF

}

asm_0002()
{
sqlplus -s "/ as sysdba" <<EOF

set wrap off
set lines 175 pages 9999

prompt ASM Disks In Use
prompt ================

col "Group"          for 999
col "Disk"           for 999
col "Header"         for a9
col "Mode"           for a8
col "State"          for a8
col "Created"        for a10          Head "Added To|Diskgroup"
--col "Redundancy"     for a10
--col "Failure Group"  for a10  Head "Failure|Group"
col "Path"           for a19
--col "ReadTime"       for 999999990    Head "Read Time|seconds"
--col "WriteTime"      for 999999990    Head "Write Time|seconds"
--col "BytesRead"      for 999990.00    Head "GigaBytes|Read"
--col "BytesWrite"     for 999990.00    Head "GigaBytes|Written"
col "SecsPerRead"    for 9.000        Head "Seconds|PerRead"
col "SecsPerWrite"   for 9.000        Head "Seconds|PerWrite"

select group_number  "Group"
,      disk_number   "Disk"
,      header_status "Header"
,      mode_status   "Mode"
,      state         "State"
,      create_date   "Created"
--,      redundancy    "Redundancy"
,      total_mb/1024 "Total GB"
,      free_mb/1024  "Free GB"
,      name          "Disk Name"
--,      failgroup     "Failure Group"
,      path          "Path"
--,      read_time     "ReadTime"
--,      write_time    "WriteTime"
--,      bytes_read/1073741824    "BytesRead"
--,      bytes_written/1073741824 "BytesWrite"
,      read_time/reads "SecsPerRead"
,      write_time/writes "SecsPerWrite"
from   v\$asm_disk_stat
where header_status not in ('FORMER','CANDIDATE')
order by group_number
,        disk_number;

EOF

}


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.

&amp;lt;br data-mce-bogus="1"&amp;gt;

[root@dbsl2001 etc]# cat redhat-release
 &amp;lt;strong&amp;gt;Red Hat Enterprise Linux Server release 6.1 (Santiago)&amp;lt;/strong&amp;gt;

 

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.