Backup & Restore Readiness

Status: Reviewed (deep-dive v1)
Stack: PowerShell collect → SQL store/procs → Blazor Server UI
Depends on: SQL-01 Inventory (population list = managed instances)
Goal: Know every database is backed up to policy, restorable, and visible when it isn’t.


Why this second

Inventory tells you what exists. Backup readiness tells you whether you can survive losing it. Fix coverage gaps before optimizing indexes.


What “good” looks like


Database classes (starting defaults — confirm with Rick)

Class Example RPO (start) Full Diff Log
A — Critical OLTP prod, auth, billing ≤ 15 min Daily Every 4–6 h Every 5–15 min
B — Standard Internal apps ≤ 1–4 h Daily Daily / every 12 h Every 15–30 min (FULL)
C — Low Dev/test, scratch ≤ 24 h Daily or weekly Optional SIMPLE often OK

SIMPLE recovery → no log backups required; still need full (+ optional diff).
Do not invent final estate policy — use these as scaffolding until Rick sets real targets.


Checklist — collect (PowerShell)

Scope = instances from inventory (LastSeenAt fresh). Prefer T-SQL via Invoke-Sqlcmd / SMO against msdb + sys.databases.

Keep it read-only on prod. No BACKUP DATABASE from the collector.


Checklist — store (SQL + stored procedures)

Table Purpose
dbo.DbBackupClass Class name, RPO minutes, full/diff/log interval targets
dbo.SqlDatabase DB identity tied to SqlInstance
dbo.SqlDatabaseBackupStatus Latest backup timestamps + computed gap flags
dbo.SqlDatabaseBackupHistory Optional trim of recent backupset facts
dbo.BackupPolicyException Approved gaps (who/when/why)

Procs:

Scoring idea (simple):


Checklist — present (Blazor Server)

Drive grids from procs only.


Restore verification (ops, not just backup)

Backing up ≠ restorable. Lean program:

PS can orchestrate restore to a dedicated verify instance; SQL stores results; UI shows freshness.


Operator runbook (short)

  1. Open Backup coverage → filter Red
  2. Confirm recovery model vs expected class
  3. Check SQL Agent backup jobs + msdb history on that instance
  4. If job OK but file missing: storage/share permissions / retention wiping too early
  5. If FULL and log overdue: check log backup job, disk full, AG secondary backup preference
  6. After fix: wait for next collect or request recollect; confirm Green
  7. For incidents needing restore: use last good full + diff + log chain; document in change notes

Common failure patterns (cheat sheet)

Symptom Likely cause
Never a full Job missing / filtered DB / new DB not in maintenance plan
Log overdue, FULL Log job stopped; AG backup on wrong replica; log VLFs/disk full
Only copy_only fulls Ad-hoc backups; scheduled job not running true fulls
Green in msdb, file gone Retention script; wrong path; share moved
Diff without base full Broken chain after file restore / recovery model flip

Permissions notes


Done definition for this topic


Next after this

Index & statistics maintenance — safer once backup coverage is trusted.


SQL Dude — SQL-02 Backup & Restore Readiness v1