select s.sid, s.username, s.program, a.SQL_TEXT from v$session s, v$process p, v$sqlArea a where p.addr = s.paddr and s.OWNERID = a.HASH_VALUE and spid = 19920;
select s.sid,
s.username,
s.program,
a.SQL_TEXT
from v$session s,
v$process p,
v$sqlarea a
where p.addr = s.paddr
[color=#FF0000] and s.SQL_HASH_VALUE = a.HASH_VALUE [/color] and spid = 19920;
------解决方案--------------------
建议步骤: 1.通过操作系统进程ID查询进程执行的SQL select s.sid, s.SERIAL#, s.SQL_ID from v$session s, v$process p where s.PADDR = p.ADDR and s.sql_id is not null and p.spid = &spid;
2.通过sql_id查询出相关sql语句及执行计划 select * from table(dbms_xplan.display_cursor('&sql_id', ''));