解决问题的过程:
1)查看服务器CPU使用情况
输入top
会发现排在前面的都是oracle的进程,而且CPU占用率都是50以上。
$top
top - 16:28:41 up 4 days, 22:35, 1 user, load average: 21.49, 22.14, 22.05
Tasks: 299 total, 31 running, 268 sleeping, 0 stopped, 0 zombie
Cpu(s): 79.2%us, 1.5%sy, 0.0%ni, 18.4%id, 0.8%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 7793040k total, 7659492k used, 133548k free, 165424k buffers
Swap: 10223608k total, 763068k used, 9460540k free, 4435980k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29533 oracle 17 0 3291m 36m 26m R98.9 0.5 98:36.33 oracle
7825oracle 17 0 3285m 30m 25m R 97.0 0.4 267:59.25 oracle
13527 oracle 17 0 3291m 36m 26m R97.0 0.5 362:08.86 oracle
32000 oracle 17 0 3291m 36m 26m R 95.1 0.5 198:58.18 oracle
查出进程的作用
ps -ef|grep 712
oracle 712 1 4 Sep02 ? 01:38:25 oracleuidorcl (LOCAL=NO)
root 2223 2171 0 16:36 pts/3 00:00:00 grep 712
oracle 17712 1 9 Aug31 ? 07:14:20 oracleuidorcl (LOCAL=NO)
oracle 27120 1 0 15:47 ? 00:00:01 oracleuidorcl (LOCAL=NO)
# ps -ef|grep 32000
root 2259 2171 0 16:37 pts/3 00:00:00 grep 32000
oracle 32000 1 5 Sep01 ? 03:19:37 oracleuidorcl (LOCAL=NO)
# ps -ef|grep 16447
root 2283 2171 0 16:37 pts/3 00:00:00 grep 16447
oracle 16447 1 9 Aug31 ? 07:15:57 oracleuidorcl (LOCAL=NO)
是用来做oracle连接的。
2)查出导致慢的原因
查进程执行的是什么语句
sqlplus / as sysdba
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
输入上面的进程ID:29533
SELECT TO_CHAR(current_timestamp AT TIME ZONE 'GMT', 'YYYY-MM-DD
HH24:MI:SS TZD') AS curr_timestamp, COUNT(db_user) AS failed_co
unt FROM sys.dba_common_audit_trail WHERE action BETWEEN 100 AND
102 AND returncode != 0 AND TO_CHAR(extended_timestamp, 'YYYY-M
M-DD HH24:MI:SS') >= TO_CHAR(current_timestamp - TO_DSINTERVAL('
0 0:30:00'), 'YYYY-MM-DD HH24:MI:SS')
发现,每个进程ID都是执行这条语句
后面群上面问了一下,说是建议把审计功能关闭
3)关闭oracle审计,解决问题
查看audit模式
show parameter audit;
shutdown abort;
startup nomount;
alter ystem set audit_trail=none scope=spfile;
shutdown abort;
startup;
删除签权数据,oracle用户登录到数据库服务器:
truncate table SYS.AUD$;
本文出自:亿恩科技【】
如果觉得《oracle查询cpu占用率高 解决oracle进程CPU占用过高问题》对你有帮助,请点赞、收藏,并留下你的观点哦!