oracle造成系统CPU过高的检查sql
Posted Frankiee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle造成系统CPU过高的检查sql相关的知识,希望对你有一定的参考价值。
1、 根据占用CPU高的进程号来查询这个进程执行的SQL语句:
CPU过高的进程号:
#首先找到CPU过高的进程号 # top -bn1 是静态找到占用最高的进程 [[email protected] ~]# top -bn1 | awk ‘{print $1}‘ | grep -A2 PID
SQL语句:
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; ####### ex: 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 = ‘31968‘)) ORDER BY piece ASC;
以上是关于oracle造成系统CPU过高的检查sql的主要内容,如果未能解决你的问题,请参考以下文章