Windows 上的 MSSQL: SQL 作业无法成功完成

Microsoft.SQLServer.Windows.CollectionRule.Agent.A_SQL_job_failed_to_complete_successfully_1_5_Rule (Rule)

SQL Server 代理作业失败。SQL Server 代理负责运行计划在特定时间或间隔发生的 SQL Server 任务,还负责检测管理员已为其定义了操作(例如通过页面或电子邮件向某人发出警报)或可解决问题的任务的特定情况。SQL Server 代理还用于运行管理员定义的复制任务。注意: 默认情况下,此规则为禁用状态。请根据需要使用替代进行启用。

Knowledge Base article:

摘要

SQL Server 代理作业失败。SQL Server 代理负责运行计划在特定时间或间隔发生的 SQL Server 任务,还负责检测管理员已为其定义了操作的特定情况(例如通过页面或电子邮件向某人发出警报)或将解决此情况的任务。SQL Server 代理还用于运行管理员定义的复制任务。

Note that this rule does not work if SQL Server on Windows instance is monitored agentlessly.

配置

此规则只为针对作业失败发送事件日志通知的作业检测失败。要将作业配置为发送事件日志通知,可以执行以下操作:

解决方法

要对此失败进行故障排除,请查看与警报相关联的事件,以确定失败的具体作业及作业步骤。同时检查作业的历史输出,以确定作业正常运行的最后日期。要查看作业执行历史记录,可以执行以下操作:

同时检查 SQL Server 代理使用的服务帐户是否为域用户组的成员。LocalSystem 帐户没有网络访问权限,因此在作业需要跨网络的资源,或者需要通过电子邮件或呼叫程序通知操作员时,必须将 SQL Server 代理服务在其下运行的帐户设置为域用户组的成员。

可替代参数

名称

说明

默认值

允许代理

指定模块是否应收集非源自 ComputerName 参数指定的计算机的事件。

已启用

启用或禁用工作流。

优先级

定义警报优先级。

1

严重性

定义警报严重性。

2

Element properties:

TargetMicrosoft.SQLServer.Windows.Agent
CategoryEventCollection
EnabledFalse
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
Windows 上的 MSSQL: SQL 作业无法成功完成
事件 ID: {0}。SQL Server 预定作业“{1}”({2}) - 状态: {3} - 调用时间: {4} - 消息: {5}
CommentMom2017ID='{8CCE3391-B79E-4182-922E-BB540ED8396E}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.SQLServer.Windows.EventProvider Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.Windows.CollectionRule.Agent.A_SQL_job_failed_to_complete_successfully_1_5_Rule" Target="SqlDiscW!Microsoft.SQLServer.Windows.Agent" Enabled="false" ConfirmDelivery="true" Remotable="true" Comment="Mom2017ID='{8CCE3391-B79E-4182-922E-BB540ED8396E}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Microsoft.SQLServer.Windows.EventProvider">
<ComputerName>$Target/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.Agent"]/ComputerName$</ComputerName>
<LogName>Application</LogName>
<AllowProxying>false</AllowProxying>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>208</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.Agent"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Params/Param[3]</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>Failed</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Windows.CollectionRule.Agent.A_SQL_job_failed_to_complete_successfully_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDisplayNumber$</AlertParameter1>
<AlertParameter2>$Data/Params/Param[1]$</AlertParameter2>
<AlertParameter3>$Data/Params/Param[2]$</AlertParameter3>
<AlertParameter4>$Data/Params/Param[3]$</AlertParameter4>
<AlertParameter5>$Data/Params/Param[4]$</AlertParameter5>
<AlertParameter6>$Data/Params/Param[5]$</AlertParameter6>
</AlertParameters>
<Suppression>
<SuppressionValue>$Data/Params/Param[1]$</SuppressionValue>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>