select /*+ ORDRRED */ 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;
----说明:根据 操作系统上 oracle 相关的 进程 PID 查询 此进程正在执行的 sql 语句。
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;
----说明:根据 操作系统上 oracle 相关的 进程 PID 查询 此进程正在执行的 sql 语句。