Search This Blog

Total Pageviews

Tuesday 4 October 2011

Oracle runing sql

currently running sql


col UNAM format a20 word heading 'User'
col STMT format a56 word heading 'Statement'
col RUNT format a08 word heading 'Run Time'
col ltim format a20 word heading 'Logon Time'
col etim format a20 word heading 'Connect Time'
col PROG format a30 word heading 'Program|Client Terminal Details'
col SID format a10 word heading 'SID/|Serial#'
col DR format 999999999 heading 'Disk Reads'
col BG format 999999999 heading 'Buffer Gets'
col thread format 99999 heading 'ThreadID
col sqltext format A64 wrap heading 'Last SQL'

break on unam on sid on status

select S.USERNAME||'('||s.sid||')-'||s.osuser UNAM
-- ,s.program||'-'||s.terminal||'('||s.machine||')' PROG
,s.sid||'/'||s.serial# sid
,s.status "Status",p.spid
,sql_text sqltext
from v$sqltext_with_newlines t,V$SESSION s , v$process p
where t.address =s.sql_address
and p.addr=s.paddr(+)
and t.hash_value = s.sql_hash_value
order by s.sid,t.piece
/


User Serial# Status SPID Last SQL
-------------------- ---------- -------- ------------------------ ----------------------------------------------------------------
SYS(18)-oracle 18/1367 INACTIVE 1212 SELECT DBMS_HM.get_run_report('test_ANUJ2') from dual
SYS(49)-oracle 49/207 ACTIVE 16349 select S.USERNAME||'('||s.sid||')-'||s.osuser UNAM
-- ,

16349 s.program||'-'||s.terminal||'('||s.machine||')' PROG
,s.sid||'/'

16349 ||s.serial# sid
,s.status "Status",p.spid
,sql_text sqltext
from

16349 v$sqltext_with_newlines t,V$SESSION s , v$process p
where t.add

16349 ress =s.sql_address
and p.addr=s.paddr(+)
and t.hash_value = s.s

16349 ql_hash_value
order by s.sid,t.piece


7 rows selected.

No comments:

Oracle DBA

anuj blog Archive