SQL Server 超时是否被记录?

发布于 2024-07-09 14:40:59 字数 122 浏览 6 评论 0原文

SQL Server 超时(特别是 SELECT 查询)是否记录在 ERRORLOG 文件中?

背景是一位客户的网站偶尔会出现“请求超时”消息,我认为超时是由数据库超时引起的。 相关错误日志中没有超时错误。

Are SQL Server timeouts (SELECT queries, in particular) logged in the ERRORLOG file?

Background is a customer with a web site having occasional "Request timeout" messages, looking to me assuming that the timeout is caused by a database timeout. There are no timeout errors in the ERRORLOG in question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

笑饮青盏花 2024-07-16 14:40:59

不可以。您需要使用 SQL Profiler。 具有锁定超时事件和死锁图事件的标准跟踪应该可以做到这一点。

除了硬件之外(例如足够的 RAM 和快速驱动器,以及在适当的 RAID 配置上适当放置数据和日志文件),大多数超时是由于没有适合您的工作负载的足够“好的”索引集而导致。

你们有定期安排索引维护计划吗?

No. You will need to use SQL Profiler. A standard trace with the Lock Timeout event and Deadlock Graph events should do it.

Hardware aside (such as enough RAM and fast drives, and appropriate placement of Data and Log files on the appropriate RAID configurations) most timeouts are caused by not having a sufficently 'good' set of indexes for your workload.

Do you have index maintenance plans scheduled regularly?

输什么也不输骨气 2024-07-16 14:40:59

SQL Server 超时作为注意事件从客户端启动,并且不会记录在 SQL Server 错误日志中。

您可以使用以下方式监视注意事件:

SQL Server timeouts are initiated from the client-side as Attention Events and are not recorded in the SQL Server Error Log.

You can monitor for Attention Events using:

捎一片雪花 2024-07-16 14:40:59

您还可以使用在超时和死锁事件时引发的事件通知。 触发后,您可以将其写入表格或向自己发送电子邮件。

我在这里展示了一般技术:

无需更改现有代码即可立即发出死锁通知

You could also use Event Notifications that get raised on the timeout and deadlock events. After it fires, you can write it to a table and or send yourself an email.

I've shown the general technique here:

Immediate deadlock notifications without changing existing code ????

July 18, 2008

This way you don't have to run Profiler; which can impact performance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文