Monday, January 23, 2012

TO GET SESSION ID AND SEE WHICH QUERY IS HITTING DB


select
   c.owner,
   c.object_name,
   c.object_type,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   v$locked_object a ,
   v$session b,
   dba_objects c
where
   b.sid = a.session_id
and
   a.object_id = c.object_id;



select a.sid, a.serial#, b.sql_text
    from v$session a, v$sqlarea b
    where a.sql_address=b.address
   and a.username='RMI';

select a.sid, a.serial#,a.time_remaining,a.elapsed_seconds,b.sql_text,b.users_executing
    from v$session_longops a, v$sqlarea b
    where a.sql_address=b.address
   and a.username='RMI';

No comments:

Post a Comment