You track SQL Server backups and restores by building three complementary records: the outcome SQL Server writes to msdb (backup and restore history, plus sys.dm_database_backups for active backup location), the integrity record from RESTORE VERIFYONLY and periodic test restores, and an independent log or alert outside SQL Server that survives a server loss. The first two tell you what the engine believes happened; the third proves it. If you only check one, a silent failure, a full disk, or a deleted backup file can go unnoticed until the day you actually need it.

The steps below assume SQL Server 2016 or later on Windows or Linux, a login with VIEW SERVER STATE and read access to msdb, and at least one database in either full or bulk-logged recovery mode if you need point-in-time recovery. It walks through the queries, the cadence, and the failure modes you'll actually face.

Start With a Baseline: What You Need Before Any Tracking Begins

Before you write a single query, confirm four things, because each one changes what "backed up" means for your instance.

First, know the recovery model of every database. Full and bulk-logged models support log backups and point-in-time restore; simple model does not, and a full backup under simple is all you get. A database in simple recovery mode that everyone assumes has log backups is a gap your tracking must surface, not hide.

Second, know the backup destination paths. Backups written to local disk are single points of failure on the same server. Network shares, Azure Blob, or S3-compatible storage change how you verify existence.

Third, confirm your SQL Server Agent is running and that any backup jobs live in jobs you can query. Ad hoc backups outside a job are the ones most often missed.

Fourth, decide how long you must retain history. msdb keeps backup history rows, but they get deleted by sp_delete_backuphistory or by maintenance jobs, and the default msdb size limit (or its BACKUP HISTORY cleanup) can silently age out the exact evidence you need. Set a retention period matched to your RPO and your audit requirements.

Once those four are settled, the tracking below becomes reliable rather than decorative.

Pull the Core Evidence: Querying msdb for Backup History

msdb is the authoritative record SQL Server keeps of backup and restore operations, and it survives server restarts. The two tables you'll use most are msdb.dbo.backupset and msdb.dbo.backupmediafamily (for file location), joined to backupfile if you need per-file detail.

A clean starting query for "when did each database last get a full backup" looks like this:

type = 'D' means a full database backup; 'I' is a differential, 'L' a transaction log. Filter by backup_finish_date rather than backup_start_date when you want the moment the backup became usable.

For log backups, the same shape with type = 'L' gives you last log backup time and count. Pair it with the database's recovery model:

The database_id > 4 filter drops the system databases, which you may want to track separately with their own cadence.

One practical limit: backupset records operations that completed, but not attempts that failed before writing a backupset row. A failed backup job often leaves nothing here. That's why the next layers exist.

Use Live DMVs for In-Flight and Recent Backups

msdb history is retrospective. To see backups in progress or recently completed, SQL Server exposes dynamic management views.

sys.dm_database_backups (available since SQL Server 2016) shows currently active or recently attempted database backups and their destination. On a busy instance, a query like:

tells you what's running right now. If you expected a backup to start at 02:00 and it's 02:05 with no row, you have a scheduling gap.

For workload context, sys.dm_exec_requests with command = 'BACKUP DATABASE' and BACKUP LOG shows active backup and restore operations. These DMVs clear when the operation ends, so they're for live monitoring, not historical reporting.

Treat the DMV result as a "right now" signal and msdb as the ledger. A monitoring query that exclusively uses DMVs will show nothing wrong at the exact moment a backup has already failed and vanished from the view.

Establish a Backup Freshness Check That Actually Fails Loudly

The single most useful tracking artifact is a freshness check: for each database in full recovery mode, confirm a full backup exists within the last N hours and a log backup within the last N minutes, where N matches your RPO.

One portable pattern is a query that returns only violations:

Empty result means healthy; any row is a breach. Plug this into a SQL Server Agent job that runs every 15 minutes and writes to a monitoring table or raises RAISERROR, then wire that job's failure to your alerting system (email, Slack webhook, PagerDuty, whatever you already use). Alerting on the query's emptiness is the point: a job that succeeds silently when the check returns zero rows still tells on-call nothing. Make the job fail when rows exist.

A worked example makes the timing concrete: suppose your RPO target is 15 minutes. A log backup every 15 minutes plus up to 5 minutes of transit and alert handling is borderline; a 10-minute cadence leaves slack. If the log backup job takes 4 minutes to run and runs every 15, any longer listen latency pushes you past the target. Track the age of the newest log backup, not just its presence.

Verify File Existence and Integrity, Not Just History Rows

A backupset row proves SQL Server logged a successful write. It does not prove the file is still where it was written. Backups get deleted by cleanup jobs, moved by storage tiering, or lost when a network share fills.

Two checks close that gap:

Existence check. Query the physical device names from backupmediafamily, then confirm each file exists through the OS or storage API. On Windows, xp_fileexist is a quick in-T-SQL check; on Linux, use shell tools or query your storage service directly. A scheduled check that flags any backupmediafamily path missing from storage catches the "backups silently deleted" class of failure.

Integrity check. RESTORE VERIFYONLY FROM DISK = 'path' WITH CHECKSUM reads the backup and confirms the header and checksum without restoring it. Run it against yesterday's full and a sample of log backups. It catches corruption that a successful BACKUP didn't, though only a full test restore proves the file can actually be restored and passes RESTORE ... WITH CHECKSUM for the data pages too. A WITH CHECKSUM on the backup itself (add WITH CHECKSUM to your BACKUP statement) makes verification meaningful; without a checksum, VERIFYONLY can only confirm structure.

A realistic cadence: verify last night's full each morning, verify a rotating sample of log backups weekly, and do a full test restore into a scratch instance monthly. Each of these produces a record — timestamps, pass/fail, file path — that belongs in your external log, not only in msdb.

Track Restores Separately, Because They're Rare and Under-Exercised

Backup history gets regular exercise; restores usually don't until an incident. Track them anyway, because the failures surface exactly when you can least afford them.

msdb.dbo.restorehistory records completed restores, joined to backupset by backup_set_uuid. A query for recent restores:

What you're really tracking is not the row count but the drill record. For every scheduled test restore, capture the date, the database, the source backup file, the time elapsed, and whether the restored database passed your check (row counts, a known row's value, an integrity check). A restore that "succeeds" but produces a database of the wrong size or missing recent transactions is a failure your log must catch.

A useful failure mode to record: restores that fail because the log chain has a gap. If a log backup was missed, restoring to a point in time fails with an error about the missing log. Your log-backup freshness check from the previous section is the early warning; the drill is the confirmation.

Route Alerts Outside the Instance: Why msdb Alone Isn't Enough

Every query so far reads from the same SQL Server instance that produced the backups. If that instance's storage is lost, or the instance itself is gone, the history goes with it. For a true tracking system, at least one record must live elsewhere.

Three workable patterns:

Push to a central monitoring database or log service. A scheduled job runs the freshness and existence queries, writes results to a table on a separate monitoring instance or appends to a log agent (Splunk, Grafana Loki, Azure Monitor, CloudWatch). A missing row or a failed push is itself alertable.

Snapshot msdb history to storage. Periodically SELECT the key backupset and restorehistory columns into a file or table on separate storage. The snapshot doesn't need to be live; it needs to exist somewhere the primary instance can't delete.

Use SQL Server Agent job history. Agent history for your backup jobs lives in msdb too, so it isn't independent — but if you forward agent job outcomes to your enterprise scheduler or IT monitoring platform, that platform's copy becomes your external record.

I recommend at least one external destination per instance, and for anything with a meaningful RTO, push the freshness-check result to an alerting channel every run. A success message that arrives every 15 minutes is easy to ignore; set a dead-man's-switch alert that fires if no success arrives within 45 minutes, which catches both query failures and instance outages.

Automate the Routine Without Overbuilding It

A practical cadence, once the queries above exist, looks like this:

1: Every 15 minutes: freshness check (full within your full-backup RPO, log within your log RPO), push result to external monitor. 2: Hourly: check active backups via sys.dm_database_backups and sys.dm_exec_requests, alert if a backup has been running beyond a threshold. 3: Daily: verify last night's full with RESTORE VERIFYONLY WITH CHECKSUM; check that paths in backupmediafamily exist for recent backups. 4: Weekly: verify a sample of log backups; check msdb backup history retention (that older rows you still need haven't been deleted). 5: Monthly: full test restore into a scratch instance; record the drill result externally.

SQL Server Agent handles all of this with T-SQL steps. If you prefer external scheduling, keep the queries identical and run them through sqlcmd or your orchestrator; the trade-off is that agent job history no longer serves as a secondary record, so your external log matters more.

The common overbuild failure is a monitoring stack that reproduces all the same blind spots as the backups themselves: alerting that uses only DMVs, or an external log that lives on the same SAN as the databases. Keep at least one independent copy and one dead-man's switch.

Common Mistakes and How to Catch Them

Tracking job success instead of backup freshness. A job that returns "success" because the step didn't raise an error can still write a backup outside your retention window or to a path you don't verify. Query the data, not the job status.

Assuming recovery-model consistency. Databases changed to simple for a bulk load and never changed back lose log backups invisibly. The default trace or a scheduled recovery_model_desc snapshot catches the change; your freshness check then flags the missing logs.

Letting msdb history age out. sp_delete_backuphistory or a full msdb can delete the rows you need for a compliance or forensic check. Set retention explicitly and confirm rows from your target period still exist.

Ignoring backup compression and encryption side effects. Compressed or encrypted backups still verify with VERIFYONLY, but a restore with the wrong certificate or key fails immediately. Store the certificate and key with the backup's metadata and include "decrypt and restore" in your drill.

Not recording failures. A failed backup that retries and succeeds an hour later is a near miss; log it, because three near misses in a week is a trend that will eventually become an outage.

For a concrete success check: after each morning's verification, count the databases that should have a full backup from last night and compare with the count of verified fulls. Equal counts mean the chain is intact for those databases; a shortfall is your first sign that something stopped writing.

As for the professional stop condition: if your freshness check shows multiple databases missing log backups and the cause isn't obvious from one failed job log, or if RESTORE VERIFYONLY fails on a file you consider your last good copy, stop trying to re-run the same backup job repeatedly and involve whoever owns the storage and the instance. Repeated failures at that layer are usually storage, permissions, or licensing, not something the query will fix.

The routine is deliberately boring: scheduled queries that return violations, alerts that fire when nothing arrives, and a monthly restore that proves the whole chain. Boring is the point — it means the day you need a restore, you already know the backups are there.