如何记录SQL Server代理作业的成功和失败

发布于 2024-07-30 20:01:14 字数 255 浏览 4 评论 0原文

我正在使用 SQL Server 2008,并且正在编写 SQL Server 代理作业。 在我的工作中,有 3 个步骤,在每个步骤中我将执行一个存储过程。 我注意到,在默认通知设置中,仅当失败时才会将信息写入 Windows 事件日志。

我的问题是,有什么简单的解决方案可以将每个步骤的成功和失败信息写入 Windows 事件日志或易于监控的地方? 我的工作每天都在进行,我需要成功和失败的信息来确保我的工作正常进行。

提前致谢, 乔治

I am using SQL Server 2008 and I am writing a SQL Server Agent Job. In my Job, there are 3 steps and in each step I will execute a store procedure. I noticed that in default Notification setting, it write information to Windows event log only when it fails.

My question is, any easy solutions to write both success and fail information of each step to windows event log or somewhere to easily monitored? My job runs daily and I need the information for both success and fail to ensure my job runs.

thanks in advance,
George

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

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

发布评论

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

评论(1

瑶笙 2024-08-06 20:01:17

作业属性中的通知还允许您在作业成功时选择操作! 右边的按钮实际上是一个下拉菜单 - 您可以选择各种结果,例如,在失败时写入事件日志,在成功时发送电子邮件。

如果您选择“如果作业完成”选项,我相信在成功和失败两种情况下都会触发操作(写入事件日志、发送电子邮件等)。

马克

PS:也许这有帮助?
http://msdn.microsoft.com/en-us/library/ms191130。 aspx

如果您想通过电子邮件通知操作员,请选中“电子邮件”,从列表中选择操作员,然后选择以下选项之一:

* When the job succeeds to notify the operator when the job completes successfully.
* When the job fails to notify the operator when the job completes unsuccessfully.
* When the job completes to notify the operator regardless of completion status.

The Notifications in the job properties also allows you to pick an action when the job succeeds! That button to the right is a dropdown, really - you can pick various outcomes, e.g. write to event log when it fails, and send an e-mail when it succeeds.

If you choose the "If job completes" option, I believe the action (write to event log, send e-mail etc.) will be triggered in both cases - success and failure.

Marc

PS: maybe this here helps?
http://msdn.microsoft.com/en-us/library/ms191130.aspx

If you want to notify an operator by e-mail, check E-mail, select an operator from the list, and then select one of the following:

* When the job succeeds to notify the operator when the job completes successfully.
* When the job fails to notify the operator when the job completes unsuccessfully.
* When the job completes to notify the operator regardless of completion status.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文