1、先从v$session视图里按照机器名(machine或是programe或logon_time)找到相应的sid,serial#
select * from v$session
where logon_time>to_date('20120601180301','yyyymmddhh24miss')
and program='toad.exe'
2 、将上一步查出来的sid,serial#用下面的sql查出数据库中正在执行的sql
select *
from v$sqlarea a
where exists(
select 1 from v$session s
where a.sql_id=s.sql_id and s.sid=2571 and s.serial#=10626)
或
select *
from v$sqltext
where sql_id in(
select sql_id from v$session s
where s.sid=2571 and s.serial#=10626)
order by sql_id,piece