此監視器會檢查長期執行的 SQL Agent 作業。
此監視器會檢查長期執行的 SQL Agent 作業。如有作業長時間持續執行超過設定臨界值,將產生警告或錯誤警示。
由於有 SQL Server Agent 作業執行的時間已超過定義臨界值,而導致狀況不良狀態。這可能表示該作業發生問題。
SQL Server Agent 負責執行排定在特定時間或間隔執行的 SQL Server 工作,以及偵測系統管理員已定義動作的特定狀況,如透過呼叫或電子郵件向某人發出警示,或解決該狀況的工作。SQL Server Agent 也用於執行系統管理員定義的複寫工作。
為判定造成警告或錯誤狀態的作業,請檢視狀態變更或警示的內容資料。
檢查 SQL Server Management Studio 以判定執行中的作業為何。如果這些作業執行的時間過長,請進行調查以找出原因。
使用 sp_help_jobactivity 查看目前執行中作業的相關資訊。
或者,如果希望部分代理程式作業長期執行:
覆寫監視以變更此特定 SQL 執行個體或所有執行個體的臨界值
為 SQL 的此特定執行個體或所有執行個體停用監視
Target | Microsoft.SQLServer.2012.Agent | ||
Parent Monitor | System.Health.PerformanceState | ||
Category | PerformanceHealth | ||
Enabled | False | ||
Alert Generate | True | ||
Alert Severity | MatchMonitorHealth | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SQLServer.2012.AgentLongRunningJobsProvider | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.2012.Agent.LongRunningJobs" Accessibility="Public" Enabled="false" Target="SQL2012Core!Microsoft.SQLServer.2012.Agent" ParentMonitorID="SystemHealth!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2012.AgentLongRunningJobsProvider" ConfirmDelivery="false">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2012.Agent.LongRunningJobs.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="UnderThreshold1" MonitorTypeStateID="UnderThreshold1" HealthState="Success"/>
<OperationalState ID="OverThreshold1UnderThreshold2" MonitorTypeStateID="OverThreshold1UnderThreshold2" HealthState="Warning"/>
<OperationalState ID="OverThreshold2" MonitorTypeStateID="OverThreshold2" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>600</IntervalSeconds>
<SyncTime/>
<ConnectionString>$Target/Host/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ConnectionString$</ConnectionString>
<Threshold1>60</Threshold1>
<Threshold2>120</Threshold2>
<TimeoutSeconds>300</TimeoutSeconds>
</Configuration>
</UnitMonitor>