SQL Server 2005:为什么我收到错误/秒警报,但日志中没有错误?

发布于 2024-10-27 21:45:29 字数 995 浏览 5 评论 0原文

我刚刚开始尝试 SQL Server 警报。我设置了一个阈值为零的错误/秒警报,认为每当错误写入日志时我都会收到一封电子邮件。我收到了很多电子邮件!我提高了每秒超过一封时通知我的阈值,但我仍然时不时收到不少电子邮件。

例如,我收到包含类似内容的电子邮件:

DESCRIPTION: The SQL Server performance counter 'Errors/sec' (instance '_Total') of object 'MyServerName:SQL Errors' is now above the threshold of 1.00 (the current value is 4.45).

这是我正在使用的警报的命令:

EXEC msdb.dbo.sp_add_alert @name=N'SQL Errors', 
        @message_id=0, 
        @severity=0, 
        @enabled=1, 
        @delay_between_responses=0, 
        @include_event_description_in=1, 
        @notification_message=N'Check the ERRORLOG for details.', 
        @category_name=N'[Uncategorized]', 
        @performance_condition=N'MyServerName:SQL Errors|Errors/sec|_Total|>|0', 
        @job_id=N'00000000-0000-0000-0000-000000000000'

当我查看日志时,我没有发现任何错误。不过,我确实找到了信息性消息(备份​​已完成等)。此警报是否真的是“条目/秒”而不是真正的“错误/秒”,还是我在错误的位置(SSMS | 服务器 | 管理 | SQL Server 日志 | 当前)查找实际错误?

I am just starting to experiment with SQL Server Alerts. I set up an Alert on Errors/sec with a threshold of zero, thinking that I would get an email any time an error was written to the log. I got a lot of emails! I raised the threshold to notify me when it was over one per second, and I still get quite a few emails from time to time.

As an example, I get emails that contains something like this:

DESCRIPTION: The SQL Server performance counter 'Errors/sec' (instance '_Total') of object 'MyServerName:SQL Errors' is now above the threshold of 1.00 (the current value is 4.45).

Here is the command for the alert I am using:

EXEC msdb.dbo.sp_add_alert @name=N'SQL Errors', 
        @message_id=0, 
        @severity=0, 
        @enabled=1, 
        @delay_between_responses=0, 
        @include_event_description_in=1, 
        @notification_message=N'Check the ERRORLOG for details.', 
        @category_name=N'[Uncategorized]', 
        @performance_condition=N'MyServerName:SQL Errors|Errors/sec|_Total|>|0', 
        @job_id=N'00000000-0000-0000-0000-000000000000'

When I look at the log, I don't find any errors. I do find informational messages (a backup completed, etc.) though. Is this alert really "Entries/sec" and not truly "Errors/sec" or am I looking in the wrong place (SSMS | Server | Management | SQL Server Logs | Current) for the actual errors?

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

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

发布评论

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

评论(2

梦初启 2024-11-03 21:45:29

不会记录所有错误,可能会执行可能会破坏约束的插入,并向客户端发出错误,但这并不意味着它会记录在错误日志中。

例如,如果执行以下 t-sql。

RAISERROR ('This is an error!', 16, 1)WITH LOG

错误将记录在错误日志中,省略 WITH LOG 只会导致错误无需伐木即可提高。

错误具有可用于过滤的属性,例如消息 ID、严重性,但您可以通过外观来监视所有内容。严重性可能正是您所需要的。

All errors are not logged, a insert might be executed that might break a constraint, an error will be raised to the client, but it doesn't mean that it is logged in the error log.

For example if you execute the following t-sql.

RAISERROR ('This is an error!', 16, 1) WITH LOG

the error will be logged in the error log, ommitting the WITH LOG will just cause the error to be raised without logging.

Errors have attributes which you can use to filter on, such as message id, severity, but you are monitor all by the looks of things. Severity might be what you need.

影子的影子 2024-11-03 21:45:29

我读过但从未使用过警报。基于此,我相信“SQL警报系统”是基于Windows应用程序事件日志中写入的数据,例如

  • “开始
  • 程序”
  • “管理工具”
  • “事件查看器

”并在“应用程序”条目下查看。 (当你在那里时看看其余的,看看所有那些你从来不知道的错误和错误。这很像在树林里的一块岩石下寻找......)

I have read about but never used Alerts. Based on this, I believe the "SQL Alerts system" is based off of data writtin in the Windows Application Event log, e.g.

  • Start
  • Programs
  • Administrative Tools
  • Event Viewer

and look under the "Application" entry. (Look at the rest of them while you're there, to see all those bugs and errors you never knew about. It's a lot like looking under a rock in the woods...)

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