运维联盟俱乐部

 找回密码
 立即注册
查看: 99|回复: 0

[性能优化] final_blocking_session

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2024-3-6 16:10:54 | 显示全部楼层 |阅读模式

    1. set pages 1000
    2. set lines 120
    3. set heading off
    4. column w_proc format a50 tru
    5. column instance format a20 tru
    6. column inst format a28 tru
    7. column wait_event format a50 tru
    8. column p1 format a16 tru
    9. column p2 format a16 tru
    10. column p3 format a15 tru
    11. column Seconds format a50 tru
    12. column sincelw format a50 tru
    13. column blocker_proc format a50 tru
    14. column fblocker_proc format a50 tru
    15. column waiters format a50 tru
    16. column chain_signature format a100 wra
    17. column blocker_chain format a100 wra

    18. SELECT *
    19. FROM (SELECT 'Current Process: '||osid W_PROC, 'SID '||i.instance_name INSTANCE,
    20. 'INST #: '||instance INST,'Blocking Process: '||decode(blocker_osid,null,'<none>',blocker_osid)||
    21. ' from Instance '||blocker_instance BLOCKER_PROC,
    22. 'Number of waiters: '||num_waiters waiters,
    23. 'Final Blocking Process: '||decode(p.spid,null,'<none>',
    24. p.spid)||' from Instance '||s.final_blocking_instance FBLOCKER_PROC,
    25. 'Program: '||p.program image,
    26. 'Wait Event: ' ||wait_event_text wait_event, 'P1: '||wc.p1 p1, 'P2: '||wc.p2 p2, 'P3: '||wc.p3 p3,
    27. 'Seconds in Wait: '||in_wait_secs Seconds, 'Seconds Since Last Wait: '||time_since_last_wait_secs sincelw,
    28. 'Wait Chain: '||chain_id ||': '||chain_signature chain_signature,'Blocking Wait Chain: '||decode(blocker_chain_id,null,
    29. '<none>',blocker_chain_id) blocker_chain
    30. FROM v$wait_chains wc,
    31. gv$session s,
    32. gv$session bs,
    33. gv$instance i,
    34. gv$process p
    35. WHERE wc.instance = i.instance_number (+)
    36. AND (wc.instance = s.inst_id (+) and wc.sid = s.sid (+)
    37. and wc.sess_serial# = s.serial# (+))
    38. AND (s.final_blocking_instance = bs.inst_id (+) and s.final_blocking_session = bs.sid (+))
    39. AND (bs.inst_id = p.inst_id (+) and bs.paddr = p.addr (+))
    40. AND ( num_waiters > 0
    41. OR ( blocker_osid IS NOT NULL
    42. AND in_wait_secs > 10 ) )
    43. ORDER BY chain_id,
    44. num_waiters DESC)
    45. WHERE ROWNUM < 101;
    复制代码


    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-2 09:37 , Processed in 0.046008 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表