SQL Server 2005:为什么我收到错误/秒警报,但日志中没有错误?
我刚刚开始尝试 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不会记录所有错误,可能会执行可能会破坏约束的插入,并向客户端发出错误,但这并不意味着它会记录在错误日志中。
例如,如果执行以下 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.
我读过但从未使用过警报。基于此,我相信“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.
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...)