Thursday, October 28, 2010

Open Transactions

Need to see information about the open transactions?


-- Open Transactions
select s.osuser "o/s-user"
, s.username "ora-user"
, s.sid "session-id"
, s.serial# "serial"
, s.process "process-id"
, s.status "status"
, s.sql_id "sql id"
, r.name "rollback"
, t.start_time "started"
, t.log_io "log i/o"
, t.phy_io "phy i/o"
, t.used_ublk "undo blks"
, t.used_urec "undo recs"
, sa.sql_text "sql text"
, st.sql_fulltext "full sql"
, sa.executions "executions"
, sa.disk_reads "disk reads"
, sa.sorts "sorts"
, sa.buffer_gets "buffer gets"
, sa.sharable_mem "sh mem"
, sa.persistent_mem "per mem"
, sa.runtime_mem "run mem"
from v$session s
, v$transaction t
, v$rollname r
, v$process p
, v$sql st
, v$sqlarea sa
where s.taddr = t.addr
and t.xidusn = r.usn
and p.addr = s.paddr
and s.sql_address = st.address(+)
and s.sql_address = sa.address(+)
and s.sql_hash_value = sa.hash_value(+)
and to_date(t.start_time,'mm/dd/yy HH24:MI:SS') < sysdate-0.00
order by s.sid
;

No comments: