Oracle %Cpu 100 us
发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,昨天中秋节,本该是团圆的好日子,苦逼的运维我还要值班(哈哈,吐槽一下)本以为会没有啥事,谁知道比较重要的一台Oracle服务器突然报警,CPU 2个core都飙到100%,load average也比
千家信息网最后更新 2025年01月20日Oracle %Cpu 100 us
昨天中秋节,本该是团圆的好日子,苦逼的运维我还要值班(哈哈,吐槽一下)本以为会没有啥事,谁知道比较重要的一台Oracle服务器突然报警,CPU 2个core都飙到100%,load average也比较高,如下图:
AWS CloudWatch也可以看出来CPU长期使用率100%
从图可得:系统us比较高,sy基本可以忽略,Memory和IO都已经检查过,不存在瓶颈,根据以往经验,极有可能是Oracle数据库有SQL在长时间运行,并且没有释放,登录到数据库查看,可以看到sid为410,408,404进程执行的都是同一个SQL,
SYS@xxxxxx>SELECT b.sid oracleID, b.username, b.serial#, spid, paddr, b.machine, c.sql_textFROM v$process a, v$session b, v$sqlarea cWHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value; ORACLEID USERNAME SERIAL# SPID PADDR MACHINE---------- ------------------------------ ---------- ------------------------ ---------------- ----------------------------------------------------------------SQL_TEXT-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 410 PRERNAP2 371 16743 00000002DEC84E60 Prernap2-mbrwith cte as(select distinct weekdate, week_month, week_year, SHIPTO, BUYERPARTNUMBER, dense_rank() over(partition by week_year,SHIPTO, BUYERPARTNUMBER, week_month order by weekdate) as rank_week FROM(Select weekdate, to_char(weekdate, 'MM') as week_month, to_char(weekdate, 'YYYY') as week_year, SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by weekdate), cte1 as (select forecastdate,forecast_month, forecast_year, shipto, buyerpartnumber from (select to_date(forecastdate, 'YYYYMMDD') as forecastdate, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'MM' ) as forecast_month, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'YYYY' ) as forecast_year,SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by forecastdate ), cte2 as (select cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year, max(rank_week) as max_week from cte group by cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year), cte4 as (select cte2.*, cte1.forecast_month, cte1.forecast_y 408 PRERNAP21163 15129 00000002DEC916A0 Prernap2-mbrwith cte as(select distinct weekdate, week_month, week_year, SHIPTO, BUYERPARTNUMBER, dense_rank() over(partition by week_year,SHIPTO, BUYERPARTNUMBER, week_month order by weekdate) as rank_week FROM(Select weekdate, to_char(weekdate, 'MM') as week_month, to_char(weekdate, 'YYYY') as week_year, SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by weekdate), cte1 as (select forecastdate,forecast_month, forecast_year, shipto, buyerpartnumber from (select to_date(forecastdate, 'YYYYMMDD') as forecastdate, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'MM' ) as forecast_month, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'YYYY' ) as forecast_year,SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by forecastdate ), cte2 as (select cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year, max(rank_week) as max_week from cte group by cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year), cte4 as (select cte2.*, cte1.forecast_month, cte1.forecast_y18 PRERNAP2 311 19710 00000002DEC948B0 Prernap2-mbrwith cte as(select distinct weekdate, week_month, week_year, SHIPTO, BUYERPARTNUMBER, dense_rank() over(partition by week_year,SHIPTO, BUYERPARTNUMBER, week_month order by weekdate) as rank_week FROM(Select weekdate, to_char(weekdate, 'MM') as week_month, to_char(weekdate, 'YYYY') as week_year, SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by weekdate), cte1 as (select forecastdate,forecast_month, forecast_year, shipto, buyerpartnumber from (select to_date(forecastdate, 'YYYYMMDD') as forecastdate, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'MM' ) as forecast_month, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'YYYY' ) as forecast_year,SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by forecastdate ), cte2 as (select cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year, max(rank_week) as max_week from cte group by cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year), cte4 as (select cte2.*, cte1.forecast_month, cte1.forecast_y 404 PRERNAP2 665 21911 00000002DEC95960 Prernap2-mbrwith cte as( select distinct weekdate, week_month, week_year, SHIPTO, BUYERPARTNUMBER, dense_rank() over(partition by week_year,SHIPTO, BUYERPARTNUMBER, week_month order by weekdate) as rank_week FROM (Select weekdate, to_char(weekdate, 'MM') as week_month, to_char(weekdate, 'YYYY') as week_year, SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by weekdate ), cte1 as ( select forecastdate,forecast_month, forecast_year, shipto, buyerpartnumber from (select to_date(forecastdate, 'YYYYMMDD') as forecastdate, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'MM' ) as forecast_month, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'YYYY' ) as forecast_year,SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by forecastdate ), cte2 as ( select cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year, max(rank_week) as max_week , cte1.forecast_month, cte1.forecast_year from cte inner join cte1 on cte1.forecast_year>=cte.week_year and cte.shipto = cte1.shipto and c22 SYS 447 23888 00000002DEC96A10 ec2-admart-01SELECT b.sid oracleID, b.username, b.serial#, spid,paddr, b.machine,c.sql_text FROM v$process a, v$session b, v$sqlarea c WHERE a.addr = b.paddrAND b.sql_hash_value = c.hash_value 387 PRERNAP2 313 24261 00000002DEC97AC0 Prernap2-mbrwith cte as( select distinct weekdate, week_month, week_year, SHIPTO, BUYERPARTNUMBER, dense_rank() over(partition by week_year,SHIPTO, BUYERPARTNUMBER, week_month order by weekdate) as rank_week FROM (Select weekdate, to_char(weekdate, 'MM') as week_month, to_char(weekdate, 'YYYY') as week_year, SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by weekdate ), cte1 as ( select forecastdate,forecast_month, forecast_year, shipto, buyerpartnumber from (select to_date(forecastdate, 'YYYYMMDD') as forecastdate, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'MM' ) as forecast_month, TO_CHAR(to_date(forecastdate, 'YYYYMMDD'), 'YYYY' ) as forecast_year,SHIPTO, BUYERPARTNUMBER from AUTO.ford_forecast_details ) order by forecastdate ), cte2 as ( select cte.shipto, cte.buyerpartnumber,cte.week_month, cte.week_year, max(rank_week) as max_week , cte1.forecast_month, cte1.forecast_year from cte inner join cte1 on cte1.forecast_year>=cte.week_year and cte.shipto = cte1.shipto and c6 rows selected.SYS@xxxxxx>select b.sid,b.serial#,b.machine,b.terminal,b.program,b.process,b.statusfrom v$lock a, v$session b where a.SID = b.SID and username is not null and username not in ('SYS','SYSTEM'); SID SERIAL# MACHINE TERMINAL PROGRAM PROCESS STATUS---------- ---------- ---------------------------------------------------------------- ------------------------------ ------------------------------------------------ ------------------------ -------- 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 404 665 Prernap2-mbr unknown SQL Developer 4145 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 408 1163 Prernap2-mbr unknown SQL Developer 3377 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE 404 665 Prernap2-mbr unknown SQL Developer 4145 ACTIVE 408 1163 Prernap2-mbr unknown SQL Developer 3377 ACTIVE 410 371 Prernap2-mbr unknown SQL Developer 5691 ACTIVE 18 311 Prernap2-mbr unknown SQL Developer 1497 ACTIVE 20 221 Prernap2-mbr unknown SQL Developer 4689 ACTIVE 20 221 Prernap2-mbr unknown SQL Developer 4689 ACTIVE 387 313 Prernap2-mbr unknown SQL Developer 6246 ACTIVE15 rows selected.SYS@xxxxxx>select sid, username, blocking_session from v$session where blocking_session is not null; SID USERNAME BLOCKING_SESSION---------- ------------------------------ ---------------- 18 PRERNAP2 408 387 PRERNAP2 404 410 PRERNAP2 408SYS@xxxxxx>select sid, serial#, username from v$session where sid='410'; SID SERIAL# USERNAME---------- ---------- ------------------------------ 410 371 PRERNAP2
解决方法
找到开发人员,询问原因,得到的反馈是在测试几条SQL(我擦,竟然在生产环境测试SQL,哎,一点敬畏之心都没有,可怕!)
kill掉blocked的进程,释放资源,再这么跑下去,系统随时可能崩溃,最后去优化一下的SQL,再去执行
alter system kill session '410,371';
......其他几个进程同理干掉即可
进程
数据
数据库
系统
测试
可怕
重要
人员
使用率
原因
好日子
方法
是在
服务器
环境
瓶颈
经验
资源
之心
长时
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
温州龙湾区软件开发首选
网络安全风险值的计算方法
小沐我的世界服务器号
数据库视图中的列名能修改吗
java表单系统数据库
保定网络技术怎么样
wp 数据库
idea连接远程服务器
停电期间网络安全注意事项
忘却录音软件开发
网络安全审查办法对苹果有何影响
自考计算机网络技术本科
软件开发职业技能大赛
13号星期五数据库
阳原软件开发文档
微信服务器只能和80端口通信
关系型数据库需要的原则
北京哪些网络技术培训学院
定位导航软件开发怎么实现
工行软件开发职业发展
软件开发免费技术支持
郑州应用软件开发怎样收费
深度学习服务器怎么选
中兴zxf20 r520服务器
生物大分子数据库
数据库怎么填写账号
怎样去除数据库表里的空格
山东省重点骨干企业数据库
安徽网络技术分类工程
jsp相册数据库