SELECT s.sid, p.spid FROM v$session s, v$process p WHERE s.paddr = p.addr AND < p.spid = <os pid>
SELECT s.sid, s.status, q.sql_text FROM v$session s, v$sqltext q WHERE s.sql_hash_value = q.hash_value AND s.sql_address = q.address AND s.sid = <sid> order by q.piece;
SELECT /*+ ORDERED */ sql_text FROM v$sqltext a WHERE (a.hash_value, a.address) IN ( SELECT DECODE (sql_hash_value, 0, prev_hash_value, sql_hash_value ), DECODE (sql_hash_value, 0, prev_sql_addr, sql_address) FROM v$session b WHERE b.paddr = (SELECT addr FROM v$process c WHERE c.spid = '&pid')) ORDER BY piece ASC /
Select s.Sid, s.Status, q.Sql_Text From V$session s, V$sqltext q Where s.Sql_Hash_Value = q.Hash_Value And s.Sql_Address = q.Address And s.Sid In (Select s.Sid From V$session s, V$process p Where s.Paddr = p.Addr And p.Spid = '&pid' ) Order By q.Piece;
原文:http://blog.csdn.net/wenzhongyan/article/details/43562581