将【%cpu】占用率最高的那条的【PID】复制取出,去数据库执行下面语句,即可查询出是哪条sql语句占导致cpu占用很高
SELECT
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