MSSQL 2016: SQL 工作無法順利完成

Microsoft.SQLServer.2016.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 也用於執行系統管理員定義的複寫工作。

組態

此規則只會偵測出現有關工作失敗的事件記錄通知的工作,是否失敗。若要設定有事件記錄通知的工作,可以執行以下動作:

解決方式

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

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

可覆寫的參數

名稱

描述

預設值

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

2

Element properties:

TargetMicrosoft.SQLServer.2016.Agent
CategoryEventCollection
EnabledFalse
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2016: SQL 工作無法順利完成
{0}
Event LogApplication
CommentMom2016ID='{8CCE3391-B79E-4182-922E-BB540ED8396E}';MOM2016GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

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

Source Code:

<Rule ID="Microsoft.SQLServer.2016.A_SQL_job_failed_to_complete_successfully_1_5_Rule" Target="SQL2016Core!Microsoft.SQLServer.2016.Agent" Enabled="false" ConfirmDelivery="true" Remotable="true" Comment="Mom2016ID='{8CCE3391-B79E-4182-922E-BB540ED8396E}';MOM2016GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<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="SQL2016Core!Microsoft.SQLServer.2016.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="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2016.A_SQL_job_failed_to_complete_successfully_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue>$Data/Params/Param[1]$</SuppressionValue>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>