SQL Agent Jobs & Schedules

Status: Reviewed (deep-dive v1)
Stack: PowerShell census → SQL history warehouse/procs → Blazor Server UI
Depends on: SQL-01 Inventory (instance list); watches jobs from SQL-02/03 (backups, index maint)
Goal: Know which jobs matter, when they fail or run long, and that nothing critical is missing or overlapping.


Why this fourth

Backups and index work only help if their Agent jobs actually run. Job failure and silent disable are common outage causes. Monitor the babysitters.


What “good” looks like


Job criticality (starting tags — confirm with Rick)

Tag Examples Alert bias
Critical Full/log backup, AG backups, CHECKDB (prod), payroll ETL Page / immediate
High Index maint execute, stats, diff backup Same-day
Standard Housekeeping, cycle error log Daily digest
Ignore Ad-hoc, disabled leftovers (documented) Hide from main board

Maintain a JobCatalog override table so rename/category quirks don’t drop critical coverage.


Checklist — collect (PowerShell + T-SQL)

Scope = inventoried instances where Agent should run.

Read-only collect. Don’t start/stop jobs from the collector.


Checklist — store (SQL + stored procedures)

Table Purpose
dbo.SqlAgentJob Job identity + enabled + category + criticality tag
dbo.SqlAgentSchedule Schedule facts per job
dbo.SqlAgentJobHistory Trimmed history (retain 30–90 days)
dbo.SqlAgentJobBaseline Duration baseline per job
dbo.SqlAgentJobStatus Latest outcome, last success, running flag, overdue schedule

Procs:

Long-running rule (start): running longer than max(2× baseline, baseline + 30 min) → Yellow/Red.

Overdue rule: enabled critical job with schedule and LastSuccess older than schedule interval × 2.


Checklist — present (Blazor Server)


Operator runbook (short)

  1. Open Fail board → Critical first
  2. Read history message (permission, disk, timeout, deadlock victim, step N)
  3. Confirm Agent service running (inventory / PS)
  4. If backup job failed → jump to SQL-02 coverage for that DB
  5. If index job runaway → check SQL-03 window/budget; blocking; log disk
  6. If disabled unexpectedly → change control? re-enable with approval
  7. After fix: confirm next success or run manually under change control; wait for collect to clear Red

Common failure patterns

Symptom Likely cause
All jobs failing Agent stopped; msdb issue; credentials
One step fails Proxy/subsystem; path; linked server
Succeeds but overdue later Schedule disabled; daylight change; AG failover job ownership
Duration creep Data growth; competing maint; blocking
No history Job never ran; Agent history retention too aggressive; wrong instance

Overlap & runaway controls


Permissions notes


Done definition for this topic


Next after this

Security & access hygiene — who can change these jobs and what logins exist.


SQL Dude — SQL-04 SQL Agent Jobs & Schedules v1