@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Display resumable sessions
*  Version    : 10.1 and above
*  Parameters : NONE
*               
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  15-Oct-12  Vishal Gupta  Created
*  
*
*/



PROMPT 
PROMPT ****************************************
PROMPT * R E S U M A B L E    S E S S I O N S
PROMPT ****************************************
PROMPT 

COLUMN SID                   HEADING "SID"                   FORMAT 99999
COLUMN inst_id               HEADING "I#"                    FORMAT 99
COLUMN status                HEADING "Resumable|Status"      FORMAT a10
COLUMN timeout               HEADING "Timeout|(sec)"         FORMAT 999999
COLUMN username              HEADING "DB|UserName"           FORMAT a15
COLUMN osuser                HEADING "OS|UserName"           FORMAT a15 TRUNCATE
COLUMN name                  HEADING "Name"                  FORMAT a25
COLUMN error_msg             HEADING "Error|Message"         FORMAT a40 WRAP
COLUMN sql_text              HEADING "SQLText"               FORMAT a30 TRUNCATE

SELECT s.sid
     , s.inst_id
     , r.status
     , r.timeout
     , r.start_time
     , r.suspend_time
     , r.resume_time
     , s.username
     , s.osuser 
     --, r.name
     , s.sql_id
     , r.error_msg
     --, r.sql_text
  FROM dba_resumable r
     , dba_users u
     , gv$session s
 WHERE r.user_id = u.user_id
   AND r.instance_id  = s.inst_id
   AND r.session_id   = s.sid
;

@@footer
