此监视器检查长期运行的 SQL 代理作业。
此监视器检查长期运行的 SQL 代理作业。如果作业的运行时间超出配置的阈值,将生成一个警告或错误警报。
不正常状态是由运行时间超出定义的阈值的 SQL Server 代理作业引起的。这可能表示作业存在问题。
SQL Server 代理负责运行计划在特定时间或间隔发生的 SQL Server 任务,还负责检测管理员已为其定义了操作的特定情况(例如通过页面或电子邮件向某人发出警报)或将解决此情况的任务。SQL Server 代理还用于运行管理员定义的复制任务。
要确定引起警告或错误状态的作业,请检查状态更改或警报的上下文。
检查 SQL Server Management Studio 以确定正在运行哪些作业。如果这些作业运行的时间过长,请对它们进行调查以查明原因。
使用 sp_help_jobactivity 以查看有关当前正在运行作业的信息。
或者,如果期望某些代理作业长时间运行:
替代监视器以更改此特定 SQL 实例或所有实例的阈值
禁用此特定 SQL 实例或所有实例的此监视器
Target | Microsoft.SQLServer.2008.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.2008.AgentLongRunningJobsProvider | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.2008.Agent.LongRunningJobs" Accessibility="Public" Enabled="false" Target="SQL2008Core!Microsoft.SQLServer.2008.Agent" ParentMonitorID="SystemHealth!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2008.AgentLongRunningJobsProvider" ConfirmDelivery="false">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2008.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>