@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Display the statistic names
*  Version    : 
*  Parameters : 1 - Metric Name (Use % as wildcard and \ as escape character)
*               
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  08-Oct-12  Vishal Gupta  Created
*
*/


DEFINE statname="&&1"

Prompt
Prompt   ***************************************************************************************************
Prompt   *    ALL Statistics Names like '&&statname'
Prompt   ***************************************************************************************************

COLUMN statistic#         HEADING "Stat#"              FORMAT 9999
COLUMN class_name         HEADING "Class"              FORMAT a10
COLUMN name               HEADING "Statistics Name"    FORMAT a80
 
SELECT * FROM  
(
SELECT s.statistic#
     , DECODE(s.class
              , 1   , 'User'
              , 2   , 'Redo'
              , 4   , 'Enqueue'
              , 8   , 'Cache'
              , 16  , 'OS'
              , 32  , 'RAC'
              , 33  , 'RAC,User'
              , 40  , 'RAC,Cache'
              , 64  , 'SQL'
              , 72  , 'SQL,Cache'
              , 128 , 'Debug'
              , 192 , 'SQL,Debug'
              , class) class_name
     , name
  FROM v$statname s
)  
WHERE ( UPPER(name)          like UPPER('&&statname') ESCAPE '\'
        OR UPPER(class_name) like UPPER('&&statname') ESCAPE '\')
ORDER BY UPPER(name)  
;
        
UNDEFINE statname

@@footer
