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
  • 相关阅读:
    数组循环的各种方法的区别
    数组里面findIndex和indexOf的区别
    选择器的绑定
    把dialog对话框设置成组件的形式
    css font-family字体及各大主流网站对比
    记一下公司的备注怎么写
    可删
    瑞萨电子:嵌入式终端与人工智能融合改变工业格局
    linux有什么作用
    Linux有哪些特点
  • 原文地址:https://www.cnblogs.com/stswordman/p/1790291.html
Copyright © 2011-2022 走看看