Search This Blog

Total Pageviews

Sunday, 3 July 2011

Oracle Top sql for last 10 min

SELECT sql_id,
count(*)
FROM v$active_session_history
WHERE sample_time > sysdate - 10/1440
AND session_type <> 'BACKGROUND'
GROUP BY sql_id
ORDER BY count(*) DESC;

SQL_ID COUNT(*)
------------- ----------
gkhffs7nr887f 3
17523pja0qf64 1



SELECT sql_text FROM v$sqlarea WHERE sql_id = '&sql_id';


or

Dump the Contents of ASH or Rolling buffer to a trace file created in User Dump Destination

ALTER SESSION SET EVENTS ‘immediate trace name ashdump, Level 10’;

OR
SQL> oradebug setmypid
SQL> oradebug unlimit
SQL> oradebug dump ashdump 10 -- This will dump last 10 minute content
SQL> oradebug tracefile_name

No comments:

Oracle DBA

anuj blog Archive