某些 SQL Server 代理作业最近因死锁错误而失败。我想密切关注这个问题,并在 SSMS 中创建了监控警报。然而,该事件从未触发......这似乎是错误的。
警报脚本:
EXEC msdb.dbo.sp_add_alert @name=N'Deadlock(s) detected . . .',
@message_id=0,
@severity=0,
@enabled=1,
@delay_between_responses=720,
@include_event_description_in=1,
@category_name=N'[Uncategorized]',
@performance_condition=N'Locks|Number of Deadlocks/sec|Database|>|0',
@job_id=N'00000000-0000-0000-0000-000000000000'
GO
EXEC msdb.dbo.sp_update_notification @alert_name=N'Deadlock(s) detected . . .',
@operator_name=N'Watchdog', @notification_method = 1
少了什么东西?或者有更好的方法来做到这一点吗?
错误必须写入事件日志,这是代理轮询的内容。1205 默认情况下不会写入事件日志(或错误日志)。您可以使用 sp_altermessage 更改此设置。