温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

abdti主机dgyt库问题导致工单系统缓慢

发布时间:2020-08-07 23:38:26 来源:ITPUB博客 阅读:105 作者:a635186971 栏目:关系型数据库
应用反馈工单系统缓慢,登上主机查询LOCAL=NO以及v$session数量,发现连数确实比平时高出50%以上。后来咨询业务,发现这是月底正常业务现象。

1、查看SunOS操作系统情况:
    1)内存:

点击(此处)折叠或打开

  1. root@abdit # prtconf |grep Memory
  2. Memory size: 32768 Megabytes
  3. root@abdit # echo "::memstat"|mdb -k
  4. Page Summary Pages MB %Tot
  5. ------------ ---------------- ---------------- ----
  6. Kernel 364339 2846 9%
  7. Anon 2158855 16866 52%
  8. Exec and libs 74791 584 2%
  9. Page cache 62215 486 2%
  10. Free (cachelist) 1391728 10872 34%
  11. Free (freelist) 65421 511 2%
  12. Total 4117349 32166
  13. Physical 4095711 31997
    可见,该主机内存共32G,空闲11G,使用21G,使用率65%。
    查看数据库sga为10G,pga为1G,应该该主机只有dgyt库,所以sga配置太低,建议调整。
    2)cpu
    mpstat  共16个逻辑cpu
    sar -u 3 20   cpu使用率15%
    而数据库已经使用了主机所有的16个cpu。
    cpu_count   integer     16
    3)IO
    由iostat -xd 2查看到各个盘的io较为繁忙,初步怀疑是IO导致数据库缓慢。
2)、查看数据库情况(10.2.0.5 基于asm的rac单实例)
    1)查看数据库的等待事件:
    select event#,event,count(*) from v$session group by event#,event order by 3;

点击(此处)折叠或打开

  1. EVENT# EVENT COUNT(*)
  2. ---------- ------------------------------ ----------
  3. 150 db file parallel write 1
  4. 135 log file parallel write 1
  5. 199 direct path read temp 1
  6. 350 SQL*Net message to client 1
  7. 200 direct path write 1
  8. 201 direct path write temp 2
  9. 144 log file sync 10
  10. 148 db file scattered read 11
  11. 147 db file sequential read 14
  12. 98 read by other session 205
  13. 198 direct path read 342
    可见主要的问题都是direct path read以及read by other session等待事件导致。
    2)查看导致direct path read的sql。
    select sql_id,username,count(*) from gv$session where event#=198 group by sql_id,username order by 3;
    得知基本是由于******用户的如下两个sql导致的:d7d83k6fzn7db和bbqffj0cd01xm
    3)  查看对应的sql内容已经执行计划
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('bbqffj0cd0qxm',NULL));
    得知内容如下:     

点击(此处)折叠或打开

  1. select title, itemid,formId,predictFinishTime 
  2. from (select mw.title,mw.itemid,mw.itemtype as formId,ia.predictFinishTime 
  3.     from ta_***** tp,form_****** fw,mw_workitem mw,Item_******* ia 
  4.     where tp.****='waiting' 
  5.     and (tp.defName='??t·?? or tp.defName='??·?? or tp.defName='??·??) 
  6.     and tp.rootinstid = fw.processid 
  7.     and fw.itemid =mw.itemid 
  8.     and mw.relatingRoom in ('2??ф-2???

点击(此处)折叠或打开

  1. ------------------------------------------------------------------------------------------------------
  2. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  3. ------------------------------------------------------------------------------------------------------
  4. | 0 | SELECT STATEMENT | | | | 17302 (100)| |
  5. | 1 | COUNT STOPKEY | | | | | |
  6. | 2 | HASH JOIN | | 1 | 265 | 17302 (1)| 00:03:28 |
  7. | 3 | NESTED LOOPS | | 4 | 812 | 10380 (1)| 00:02:05 |
  8. | 4 | NESTED LOOPS | | 2752 | 812 | 10380 (1)| 00:02:05 |
  9. | 5 | HASH JOIN | | 344 | 52632 | 8660 (1)| 00:01:44 |
  10. | 6 | TABLE ACCESS FULL | MW_***** | 342 | 37962 | 8006 (1)| 00:01:37 |
  11. | 7 | TABLE ACCESS FULL | FORM_***** | 290K| 11M| 652 (1)| 00:00:08 |
  12. | 8 | INDEX RANGE SCAN | TAI_*****_ROOTID | 8 | | 2 (0)| 00:00:01 |
  13. | 9 | TABLE ACCESS BY INDEX ROWID| TA_***** | 1 | 50 | 5 (0)| 00:00:01 |
  14. | 10 | TABLE ACCESS FULL | ITEM_****** | 601K| 35M| 6918 (1)| 00:01:24 |
  15. ------------------------------------------------------------------------------------------------------
    可以看到主要是部分表存在全表扫描,虽然表的数据量不大(约170w行),但是并发高的情况下可能还是会造成性能影响的。故考虑创建索引,如下:

点击(此处)折叠或打开

  1. create index *****.idx_*****_****_**** on ****.Item_******(***,***,****) online parallel 8 tablespace TBS_*****;
  2. create index *****.idx_***** on *****.form_**** (*****) online tablespace TBS_*****;
  3. create index *****.idx_*****_***** on *****.MW_****(*****,*****) online tablespace TBS_*****;
    4)调整sga参数:
    alter system set sga_max_target=20g scope=spfile sid='*';
    重启库。
    5)因在分析问题时,业务就已经恢复了。所以无法验证改动是否启作用,待后续观察是否业务故障是否会重现。
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI