web analytics

Oracle: plan of the running query

col object_name FOR a40 SELECT operation,        options,        object_name,    partition_id FROM   v$sql_plan WHERE address IN  ( SELECT sql_address FROM v$session WHERE sid = &sid.) ORDER BY id;

MS SQL: long running queries

select spid,cmd,status,loginame,open_tran,   datediff (s,last_batch,getdate()) as [Waittime (s)] from master..sysprocesses p where open_tran > 0            and spid > 50           and datediff (s,last_batch,getdate()) > 30           and exists ( select * from master..syslockinfo                            where req_spid=p.spid and rsc_type <>2)

Oracle: long running queries

col opname FOR a40 col units FOR a10 SELECT  sid ,opname ,sofar ,totalwork ,units ,elapsed_seconds ,time_remaining FROM v$session_longops WHERE sofar != totalwork;