Thursday, July 31, 2014

Details w.r.t. SID from Oracle backend

--> the below sql gives the details w.r.t. a SID
--> SQL currently running for the request
--> whether the SQL is stuck or NOT

SELECT vs.inst_id,
         fcr.request_id,
         vs.process,
         vs.sid,
         vsql.sql_text current_running_sql,
         vsw.event,
         vsw.wait_time,
         vsw.seconds_in_wait,
         vsw.state,
         vsw.p2text,
         vsw.p2,
         vsw.p3text,
         vsw.p3,
         vs.sid || ',' || vs.serial# sid_serial,
         p.spid,
         vs.process,
         vs.username || '/' || vs.osuser username,
         vs.status,
         TO_CHAR (vs.logon_time, 'DD-MON-YY HH24:MI:SS') logon_time
    FROM fnd_concurrent_requests fcr,
         gv$session vs,
         gv$sqltext_with_newlines vsql,
         gv$session_wait vsw,
         gv$process p
   WHERE     1 = 1
         AND vsql.address = vs.sql_address
         AND vsql.inst_id = vs.inst_id
         AND hash_value = sql_hash_value
         AND vs.sid = vsw.sid
         AND fcr.OS_PROCESS_ID = vs.process
         AND vs.paddr = p.addr
         AND vs.inst_id = p.inst_id
         AND vs.inst_id = vsw.inst_id
         AND fcr.request_id = <>
ORDER BY vsql.piece


No comments:

Post a Comment