数据库进程占用CPU大的问题,一直普遍存在,通过下面的方法可以进行可以在操作系统层面获取进程pid,然后抓出在数据库中的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;
转载于:https://blog.51cto.com/marvelyu/393429