blocked process threshold 服务器配置选项blocked process threshold Server Configuration Option

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

blocked process threshold 选项用于指定阈值(以秒为单位),超过该阈值将生成阻塞的进程报告。Use the blocked process threshold option to specify the threshold, in seconds, at which blocked process reports are generated. 该阈值可介于 0 到 86,400 之间。The threshold can be set from 0 to 86,400. 默认情况下,不生成阻塞的进程报告。By default, no blocked process reports are produced. 对于系统任务或正在等待未生成可检测死锁的资源的任务,不生成该事件。This event is not generated for system tasks or for tasks that are waiting on resources that do not generate detectable deadlocks.

可以定义一个生成该事件时执行的 警报You can define an alert to be executed when this event is generated. 例如,可以选择通知管理员采取相应的操作来处理阻塞情况。So for example, you can choose to page the administrator to take appropriate action to handle the blocking situation.

阻塞的进程阈值使用死锁监视器后台线程监视等待时间大于(或数倍于)配置的阈值的任务列表。Blocked process threshold uses the deadlock monitor background thread to walk through the list of tasks waiting for a time greater than or multiples of the configured threshold. 每个报告间隔中,为每个阻塞的任务生成一次事件。The event is generated once per reporting interval for each of the blocked tasks.

已通过最大努力完成了阻塞的进程报告。The blocked process report is done on a best effort basis. 不保证报表的数据始终为实时数据,也不保证报表数据接近实时。There is no guarantee of any real-time or even close to real-time reporting.

该设置立即生效,无需停止并重新启动服务器。The setting takes effect immediately without a server stop and restart.


下面的示例将 blocked process threshold 设置为 20 秒,超过该阈值将为阻塞的每个任务生成阻塞的进程报告。The following example sets the blocked process threshold to 20 seconds, generating a blocked process report for each task that is blocked.

sp_configure 'show advanced options', 1 ;  
sp_configure 'blocked process threshold', 20 ;  

另请参阅See Also

sp_trace_setevent (Transact-SQL) sp_trace_setevent (Transact-SQL)
Blocked Process Report 事件类Blocked Process Report Event Class