DESCRIPTION
This custom report will list the Top N SQL statements in your instance by number of executions. To use this report, run it from SQL*Plus while connected to the Ignite repository database.
SQL*PLUS SCRIPT
select id, name from cond order by name;
prompt Which Database ID
accept DBID
prompt Enter Start Date (mm/dd/yy hh24:mi)
accept BeginDate
prompt Enter End Date (mm/dd/yy hh24:mi)
accept EndDate
prompt How many SQL statements should be shown:
accept HowMany
set pagesize 999
set linesize 132
select * from (
select nvl(n.name, ss.sqlhash) NameOrHash,
sum(execs) "Executions"
from con_stats_sum_&DBID ss, con_sql_name n
where ss.sqlhash = n.hash 
and datehour between to_date('&BeginDate','mm/dd/yy hh24:mi') and to_date('&EndDate','mm/dd/yy hh24:mi')
group by nvl(n.name, ss.sqlhash)
order by 2 desc)
where rownum <= &HowMany
/