Build1 distinct publisher3 min readUpdated
A dev.to walkthrough automates restore plus CHECKDB on a scratch instance. The interesting part is why homegrown versions fail: backup history lives in msdb on the server you are trying to prove.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
The msdb detail is worth sitting with, because it explains why so many in-house restore drills quietly test nothing. Backup history is written to msdb on the instance that took the backup, and a restore instance's own msdb knows only about backups that instance made [5]. Stand up a scratch box, point it at the file share, ask it which files make up the newest chain for Orders, and it has no record to consult [5]. The author's answer is a split: discovery runs remotely against production's msdb over a linked server, while the RESTORE and the CHECKDB run locally on the scratch instance against files it can reach itself [6].
That split carries one cost the article names and one it does not. The named cost is plumbing: a linked server, plus backup files reachable from the restore box, and the author says file accessibility is where most people get stuck [7]. The unnamed cost is the direction of trust. The machine you deliberately use to mount databases of unknown quality, under temporary names, with a confirmation flag proving it is not production [8], is also the machine holding a login that reads production's msdb [6]. That is a security review, not a checkbox.
The logging design is where I would spend the first hour. RestoreVerifyLog computes RTOBreached as a persisted column, flagging any run where RestoreSeconds exceeds RTOTargetSeconds [11]. RestoreSeconds is nullable [13], so a run that dies partway through leaves it NULL, the comparison is UNKNOWN, and the persisted column stores 0 [1]. The total failure records no RTO breach. Any alerting built on RTOBreached alone therefore reads clean on exactly the night that matters, and the predicate needs Succeeded = 0 handled as its own condition [1].
The same care applies to integrity. RunCheckDB is a per-database switch [10] and CheckDBPassed is nullable [13], so a row can say Succeeded = 1 and say nothing at all about corruption [2]. Silence is not a pass, and whatever dashboard reads this table should render the two differently.
The default RTO target is 1800 seconds [10], which is 30 minutes [3]. It is per-database and configurable [10], which is the point: the value of this harness is not the pass or fail, it is the trend in RestoreSeconds across runs, because that is the number that turns an asserted RTO into a measured one [3]. Chains that lengthen and restores that creep past the target are the failure mode the author says hides behind success indicators [2].
One caveat on the material. The published text breaks off in step 2 while introducing the full backup lookup, before the differential and log chain discovery and before the file path resolution the author calls the hard part [14][7]. Treat it as a design to copy on SQL Server 2016 or later [4], not a script to paste.
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
A backup job reports success once the data is written; what happens to that data afterwards is a separate question, and untested backups are not a retrieval strategy.
Corrupted backups, broken chains and restore times that keep increasing stay hidden behind success indicators until the moment of need.
The prescribed practice is to restore backups regularly, verify them with CHECKDB and time them against RTO, but the process is laborious so it goes undone.
The article publishes a T-SQL solution that runs on a restore server, identifies the backup chain on a production server, restores it, verifies the result with CHECKDB and logs the outcome, for SQL Server 2016 and later.
Backup history lives in msdb on the source server; the msdb on a restore instance knows only about backups taken by that instance, so it cannot answer which files make up the newest chain for a production database.
The design splits the work: history discovery is done remotely by querying the production server's msdb through a linked server, and the RESTORE and CHECKDB are executed locally on the scratch instance using backup files at a path accessible to it.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Concrete code, single source, unfinished
The mechanism claims are directly inspectable: the article supplies real DDL for the config and log tables and a working-shape parameterized sp_executesql query against a linked server's msdb, and the core diagnosis about msdb locality is verifiable SQL Server behaviour. Evidence stays moderate because there is exactly one publisher, no independent corroboration, no measured restore timings or test output, and the walkthrough terminates mid-sentence before the file-reachability step it calls the hardest problem.
No adoption signal in sources
The supplied source is a tutorial with no release, deployment, usage disclosure, download, star, or customer evidence of anyone running this script. Nothing in the material supports estimating adoption, so no value is asserted.
Complete solution promised, partial script delivered
Mildly overstated. The framing ('a complete T-SQL solution' that restores, CHECKDBs and logs) runs ahead of what is shipped: the text stops mid-sentence at the file-reachability step, the log-selection shortcut is admitted to be non-LSN-rigorous, and the logging schema as written can persist RTOBreached = 0 for a failed run and Succeeded = 1 with no integrity check. The underlying insight about msdb locality is sound and unexaggerated, which keeps the gap small rather than large.
Independent tutorial, audience incentive only
Low distortion pressure. The source is a single-author post on a developer publishing platform with no product, vendor, sponsor, pricing or licence being promoted — the solution is plain T-SQL against Microsoft SQL Server rather than anything the author sells. The residual incentive is the ordinary one for platform tutorials: attention, which plausibly explains the confident 'complete solution' framing and the dramatic 2 a.m. hook.
Mechanism solid, delivery and uptake unproven
Confidence is moderate: the structural claims about msdb locality, the remote-discovery/local-restore split, and the exact table definitions are directly readable from the source and internally consistent, so the technical core is reliable. It is held down by a one-publisher cluster, a truncated article, absent adoption evidence, and the fact that two of the most decision-relevant findings are derived from the DDL rather than stated by the author.
build
A year of green backups hid 7 of 10 missing Android signing keys1 distinct publisher
build
Before you restart that Windows service, find out whether StartType survived the update1 distinct publisher
build
Three manual interventions in a month, and every guard was working as designed1 distinct publisher
build
Six MariaDB versions, one real difference: the only reason to leave 10.6 is the July 2026 clock1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 23, 2026