Oracle 查询当前用户正在执行的SQL

--查询当前用户正在执行的SQL

select a.sid,

       a.serial#,

       a.paddr,

       a.machine,

       nvl(a.sql_id, a.prev_sql_id) sql_id,

       b.sql_text,

       b.sql_fulltext,

       b.executions,

       b.first_load_time,

       b.last_load_time,

       b.last_active_time,

       b.disk_reads,

       b.direct_writes,

       b.buffer_gets

  from v$session a, v$sql b

 where a.username = sys_context('USERENV', 'CURRENT_USER')

   and a.status = 'ACTIVE'

   and nvl(a.sql_id, a.prev_sql_id) = b.sql_id;


 

你可能感兴趣的:(Oracle,开发)