当前位置:Gxlcms > 数据库问题 > oracle造成系统CPU过高的检查sql

oracle造成系统CPU过高的检查sql

时间:2021-07-01 10:21:17 帮助过:14人阅读

1、 根据占用CPU高的进程号来查询这个进程执行的SQL语句:

CPU过高的进程号:

#首先找到CPU过高的进程号
# top -bn1 是静态找到占用最高的进程
[root@localhost ~]# 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

标签:gre   asc   where   ddr   order by   语句   rom   csharp   logs   

人气教程排行