Friday, September 20, 2013

Tracking long running sessions via gv$session_longops

Find long running sessions from gv$session_longops

 Details from Oracle docs;

 "V$SESSION_LONGOPS displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution, and more operations are added for every Oracle release. To monitor query execution progress, you must be using the cost-based optimizer and you must: Set the TIMED_STATISTICS or SQL_TRACE parameters to true Gather statistics for your objects with the DBMS_STATS package"

target - Object on which the operation is carried out
time_remaining - Estimate (in seconds) of time remaining for the operation to complete

set linesize 200 col OPNAME for a40 col target for a10 select inst_id, sid, serial#, opname, target, sofar, totalwork, time_remaining from gv$session_longops where time_remaining > 0;

******************************************
 keywords: longops
******************************************
 rdbms version: 11.2
******************************************

No comments: