Friday, June 24, 2016
Oracle: Query Long Run Session
select
opname, to_char(start_time, 'yyyy-mm-dd-hh24:mi:ss'), target, sofar, totalwork, units, elapsed_seconds, message
from v$session_longops
order by start_time desc;
select
substr(a.spid,1,9) pid,
substr(b.sid,1,5) sid,
substr(b.serial#,1,5) ser#,
substr(b.machine,1,6) box,
substr(b.username,1,10) username,
-- b.server,
substr(b.osuser,1,8) os_user,
substr(b.program,1,30) program
from
v$session b,
v$process a
where
b.paddr = a.addr
and type='USER'
order by spid;
SELECT DISTINCT *
FROM
(SELECT to_date(t.START_DATE,'DD.MM.YYYY HH24:MI:SS') Started_Date ,
s.sid,
s.username,
t.status tr_status,
s.status sess_status,
NVL(s.program,s.module) Program,
sq.sql_text
FROM v$transaction t,
v$session s,
v$sql sq
WHERE t.addr = s.taddr
AND s.sql_address = sq.address(+)
AND t.start_date < (sysdate-4/24)
ORDER BY 1
);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment