zoukankan      html  css  js  c++  java
  • Blocked Process Report

    捕获超过10秒的堵塞,开启了trace之后,所有的超过10秒的堵塞会被记录下来(重复记录,例如scenario1的堵塞被记录下来, 过了10秒之后, scenario1会被再次记录

    sp_configure 
    'show advanced options',1 ; 
    GO
     
    RECONFIGURE
    GO
     sp_configure 
    'blocked process threshold',10 ; 
    GO
     
    RECONFIGURE
     
    go
     
    select *from sys.traces
     
     
    declare @rc int 
     
    declare @TraceID int
      
    declare @maxfilesize bigint
      
    set @maxfilesize = 50 
      
    exec @rc = sp_trace_create 
      
    @TraceID output, 2, N'd:\trace\BlockedProcessTrace'
      
    @maxfilesizeNULL 
    --137解释:
    --
     Blocked Process Report Occurs when a process has been blocked for more than a specified amount of time. Does not --include system processes or processes that are waiting on non deadlock-detectable --resources. Use sp_configure to configure the threshold and frequency at which reports are generated.
     
     
    if(@rc =0)
     
    begin
      
    declare @on bit
      
    set @on = 1
      
    exec sp_trace_setevent @TraceID13715@on
      
    exec sp_trace_setevent @TraceID1371@on
      
    exec sp_trace_setevent @TraceID13713@on
     
    end
       
    --exec sp_trace_setfilter   2,35,0,0,N'testdb'

    exec sp_trace_setstatus 21--start the trace
      
    select *from sysprocesses where blocked<>0
    select cast(TextData as XML) , SPID, EndTime, 
       Duration
    /1000/1000from
        fn_trace_gettable(N
    'd:\trace\BlockedProcessTrace.trc'default)
        
    where eventclass = 137
    --exec sp_trace_setstatus 2, 0--stop the trace
    --
    exec sp_trace_setstatus 2, 2--remove the trace definition but remain the trace file
  • 相关阅读:
    前端资源网址
    IDEA激活工具
    新建jsp项目
    jsp笔记
    iOS的SVN
    iOS学习网站
    测试接口工具
    MVP模式
    关于RxJava防抖操作(转)
    注释模板
  • 原文地址:https://www.cnblogs.com/stswordman/p/1790291.html
Copyright © 2011-2022 走看看