--从LINUX进程消耗CPU获得SQL
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