SQL Server: proving a .bak restores, with DBCC CHECKDB

RESTORE VERIFYONLY tells you a SQL Server backup can be read, not that it restores into a healthy database. This guide shows a real restore test with DBCC CHECKDB, including differential and log backups.

RESTORE VERIFYONLY checks that the backup set is complete and readable, and with WITH CHECKSUM it also checks the page checksums. It does not create the database, so it cannot find logical damage, a broken chain of differential and log backups, or a database that fails DBCC CHECKDB.

Make backups that can be checked

Take full backups WITH CHECKSUM, so that a restore verifies every page:

BACKUP DATABASE [erp] TO DISK = N'D:\backup\erp-20261116.bak' WITH CHECKSUM, COMPRESSION

Test a backup by hand

Restore into a separate SQL Server of the same or a newer version, under a name that cannot be confused with production, and move its files:

RESTORE FILELISTONLY FROM DISK = N'/backup/erp-20261116.bak';

RESTORE DATABASE [erp_restoretest] FROM DISK = N'/backup/erp-20261116.bak'
WITH MOVE N'erp' TO N'/var/opt/mssql/data/erp_restoretest.mdf',
     MOVE N'erp_log' TO N'/var/opt/mssql/data/erp_restoretest.ldf',
     CHECKSUM, STATS = 10;

DBCC CHECKDB (N'erp_restoretest') WITH NO_INFOMSGS, ALL_ERRORMSGS;

RESTORE FILELISTONLY gives the logical file names for MOVE. Any error from DBCC CHECKDB means the database in the backup is damaged, whatever the backup job reported.

SQL Server runs on Linux in Microsoft's container image (mcr.microsoft.com/mssql/server), which is a convenient isolated test server. Use an edition your licence covers for this: Express is free for databases up to 10 GB.

Differential and log backups

A chain is restored in order, each step WITH NORECOVERY except the last:

RESTORE DATABASE [erp_restoretest] FROM DISK = N'/backup/erp-full.bak' WITH NORECOVERY, MOVE …;
RESTORE DATABASE [erp_restoretest] FROM DISK = N'/backup/erp-diff.bak' WITH NORECOVERY;
RESTORE LOG [erp_restoretest] FROM DISK = N'/backup/erp-log-1.trn' WITH NORECOVERY;
RESTORE LOG [erp_restoretest] FROM DISK = N'/backup/erp-log-2.trn' WITH RECOVERY;

A missing or out-of-order log backup breaks the chain: the restore stops with an LSN error, and every later backup is unusable until the next full backup. That is the failure a chain test exists to find.

After the restore

Run DBCC CHECKDB, compare row counts of the main tables with production or the last test, check the newest rows of a busy table, and note how long the restore took: that is your recovery time. Then drop the test database.

How Restorly does this

Restorly restores full .bak backups, compressed or encrypted ones (with the certificate) and full, differential and log chains in Microsoft's Linux image under your licence settings, in a container with no network. It runs DBCC CHECKDB, compares row counts and the schema with the last run, runs your own SQL checks and signs a report, on a schedule or when a new backup arrives. See SQL Server and the free trial.