如何在SQL 2005探查器中查找超时语句

时间:2022-11-14 09:02:32

I'm trying to find SQL statements that timed out using the SQL 2005 profiler. Is there a way to set such a filter?

我正在尝试使用SQL 2005探查器找到超时的SQL语句。有没有办法设置这样的过滤器?

3 个解决方案

#1


7  

In Profiler, you can add the event "Attention" under "Errors and Warnings". It's definition is

在Profiler中,您可以在“错误和警告”下添加事件“注意”。它的定义是

Collects all attention events, such as client interrupt request or when a client connection is broken.

收集所有注意事件,例如客户端中断请求或客户端连接中断。

As far as other errors (deadlocks, contraints, etc), try "Execution Warning" (reports warning that occurred during the execution of SQL statement or procedure) or "User Error Message" (the error message displayed to the user in the case of an error or exception).

至于其他错误(死锁,约束等),请尝试“执行警告”(报告在执行SQL语句或过程期间发生的警告)或“用户错误消息”(在以下情况下向用户显示错误消息)错误或例外)。

#2


1  

Yes.

是。

  • Check "All Events"
  • 查看“所有活动”
  • Go to the lock section
  • 转到锁定部分
  • Specify the "lock: Timeout" events
  • 指定“lock:Timeout”事件

Lock event in Books Online

在联机丛书中锁定事件

Now, this works with server side locks (@@LOCK_TIMEOUT <> 0). I don't know if a client side timeout will be trapped.

现在,这适用于服务器端锁(@@ LOCK_TIMEOUT <> 0)。我不知道客户端超时是否会被困。

#3


0  

One option, if you know what your client configured timeouts are set to (ie. 30 seconds by default), you can set a filter on your trace to only collect events with a duration greater than or equal to your timeout (minus a second or two).

一个选项是,如果您知道客户端配置的超时设置为(默认情况下为30秒),则可以在跟踪上设置过滤器,以仅收集持续时间大于或等于超时的事件(减去一秒或二)。

#1


7  

In Profiler, you can add the event "Attention" under "Errors and Warnings". It's definition is

在Profiler中,您可以在“错误和警告”下添加事件“注意”。它的定义是

Collects all attention events, such as client interrupt request or when a client connection is broken.

收集所有注意事件,例如客户端中断请求或客户端连接中断。

As far as other errors (deadlocks, contraints, etc), try "Execution Warning" (reports warning that occurred during the execution of SQL statement or procedure) or "User Error Message" (the error message displayed to the user in the case of an error or exception).

至于其他错误(死锁,约束等),请尝试“执行警告”(报告在执行SQL语句或过程期间发生的警告)或“用户错误消息”(在以下情况下向用户显示错误消息)错误或例外)。

#2


1  

Yes.

是。

  • Check "All Events"
  • 查看“所有活动”
  • Go to the lock section
  • 转到锁定部分
  • Specify the "lock: Timeout" events
  • 指定“lock:Timeout”事件

Lock event in Books Online

在联机丛书中锁定事件

Now, this works with server side locks (@@LOCK_TIMEOUT <> 0). I don't know if a client side timeout will be trapped.

现在,这适用于服务器端锁(@@ LOCK_TIMEOUT <> 0)。我不知道客户端超时是否会被困。

#3


0  

One option, if you know what your client configured timeouts are set to (ie. 30 seconds by default), you can set a filter on your trace to only collect events with a duration greater than or equal to your timeout (minus a second or two).

一个选项是,如果您知道客户端配置的超时设置为(默认情况下为30秒),则可以在跟踪上设置过滤器,以仅收集持续时间大于或等于超时的事件(减去一秒或二)。