时间:2021-07-01 10:21:17 帮助过:15人阅读
环境:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
CentOS release 6.5 X64
现象:系统CPU使用率达到75%,查看系统进程资源状态。
数据库中查看
select t.sql_text,s.sid, s.serial#,s.program,s.process,s.USERNAME,p.spid from v$sqlarea t ,v$session s ,v$process p where t.address=s.sql_address and t.hash_value=s.sql_hash_value and s.paddr=p.addr and p.spid in (PID);
pid 为操作系统中PID。
查看结果sql语句和program 程序,
查看执行计划:
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3345675291
------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 66 | 48343 (1)| 00:09:41 |
| 1 | SORT AGGREGATE | | 1 | 66 | | |
| 2 | VIEW | VM_NWVW_1 | 1 | 66 | 48343 (1)| 00:09:41 |
| 3 | HASH GROUP BY | | 1 | 67 | 48343 (1)| 00:09:41 |
|* 4 | HASH JOIN ANTI NA | | 426 | 28542 | 48342 (1)| 00:09:41 |
|* 5 | TABLE ACCESS FULL| T_PPS | 42578 | 997K| 37806 (1)| 00:07:34 |
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|* 6 | TABLE ACCESS FULL| PUSH_USENT | 2883K| 118M| 10521 (1)| 00:02:07 |
------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("QN"."CIMEI0"="CIMEI")
5 - filter("QN"."CDATE">=TO_DATE(‘ 2015-06-07 00:00:00‘, ‘syyyy-mm-dd hh24:mi:ss‘)
AND (LENGTH("QN"."CIMEI0")=14 OR LENGTH("QN"."CIMEI0")=15) AND "QN"."CDATE"<=TO_DATE(‘
2015-06-28 00:00:00‘, ‘syyyy-mm-dd hh24:mi:ss‘))
6 - filter("CLASTIME">TO_DATE(‘ 2015-07-01 00:00:00‘, ‘syyyy-mm-dd hh24:mi:ss‘))
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
做的是全表扫描,已经有几百条这样的sql都同时在执行,导致CPU资源暴涨。
解决:
1、结束程序进程释放资源:
alter system kill session ‘sid,serial#‘;
2、如果太多PID占用进程,可以考虑重启库释放资源。
3、sql语句的优化及索引优化。
本文出自 “虫子” 博客,请务必保留此出处http://worms.blog.51cto.com/969144/1669715
oracle 数据库服务器CPU资源占用超高(75%)
标签:oracle 数据库服务器cpu资源占用超高