Windows 上的 MSSQL: SQL 作業無法成功完成

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

SQL Server Agent 作業失敗。SQL Server Agent 負責執行排定在特定時間或間隔執行的 SQL Server 工作,以及偵測系統管理員已定義動作的特定狀況,如透過呼叫或電子郵件向某人發出警示,或解決該狀況的工作。SQL Server Agent 也用於執行系統管理員定義的複寫工作。注意: 根據預設會停用此規則。必要時請使用覆寫加以啟用。

Knowledge Base article:

摘要

SQL Server Agent 作業失敗。SQL Server Agent 負責執行排定在特定時間或間隔執行的 SQL Server 工作,以及偵測系統管理員已定義動作的特定狀況,如透過呼叫或電子郵件向某人發出警示,或解決該狀況的工作。SQL Server Agent 也用於執行系統管理員定義的複寫工作。注意: 根據預設會停用此規則。必要時請使用覆寫加以啟用。

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

組態

此規則只會偵測具有事件記錄檔通知之作業的作業失敗。若要設定具有事件記錄檔通知的作業,您可以執行下列動作:

解決方式

若要對此失敗進行疑難排解,請檢閱與警示相關聯的事件,以判定失敗的特定作業與作業步驟。同時,也請查看作業的歷程結果,以判定該作業上次運作的日期。若要檢視作業執行歷程記錄,您可以執行下列作業:

另請查看 SQL Server Agent 所使用的服務帳戶,是否為網域使用者群組的成員。LocalSystem 帳戶沒有網路存取權限,因此,若您的工作需要網路上的資源,或是希望透過電子郵件或呼叫器通知操作員,則必須將執行 SQL Server Agent 服務的帳戶,設定為網域使用者群組的成員。

可覆寫的參數

名稱

描述

預設值

允許 Proxy 處理

指定模組是否應收集不是源自 ComputerName 參數所指定之電腦的事件。

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

2

Element properties:

TargetMicrosoft.SQLServer.Windows.Agent
CategoryEventCollection
EnabledFalse
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
Windows 上的 MSSQL: SQL 作業無法成功完成
事件識別碼: {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>$Target/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Data/EventDisplayNumber$</AlertParameter3>
<AlertParameter4>$Data/Params/Param[1]$</AlertParameter4>
<AlertParameter5>$Data/Params/Param[2]$</AlertParameter5>
<AlertParameter6>$Data/Params/Param[3]$</AlertParameter6>
<AlertParameter7>$Data/Params/Param[4]$</AlertParameter7>
<AlertParameter8>$Data/Params/Param[5]$</AlertParameter8>
</AlertParameters>
<Suppression>
<SuppressionValue>$Data/Params/Param[1]$</SuppressionValue>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>