liveBook · Manning

RESTORE VERIFYONLY

As explained in 100 SQL Server Mistakes and How to Avoid Them

RESTORE VERIFYONLY is a SQL Server command that checks whether a backup can be read and is suitable for restoration without restoring its data.

Mistake: treating a successful backup job as proof that the backup is usable. RESTORE VERIFYONLY checks whether SQL Server can read a backup and validate its integrity without restoring the database. It is a practical validation step, not a substitute for testing full restores. section 12.4.2 section 12.12

Use verification as part of a safer backup routine:

  • Create backups with CHECKSUM so verification can validate the backup checksum; expect reduced backup throughput, especially for large databases. section 12.4.2
  • Add RESTORE VERIFYONLY as a job step after native backup jobs and monitor whether that step completes successfully. section 12.4.2
  • Do not assume verification proves recoverability: corruption can still exist, so use automated restores when infrastructure capacity permits. section 12.4.2
  • Coordinate with the backup team when an enterprise tool hides verification across the estate; use its API for a scripted approach. section 12.4.2

Verify the Marketing backup

RESTORE VERIFYONLY FROM DISK = 'D:\Backup\MarketingFull27122023.bak' WITH CHECKSUM;

Listing 12.5 Verifying a backup
RESTORE VERIFYONLY
FROM DISK = 'D:\Backup\MarketingFull27122023.bak' 
WITH CHECKSUM ;

Open the complete verification listing for the executable T-SQL example. section 12.4.2

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Shows the verification command, checksum relationship, automation options, and limits, but stops short of full restore testing.
Examples
Uses a Marketing database backup and a RESTORE VERIFYONLY command with CHECKSUM.
What it assumes
Assumes familiarity with SQL Server backups and backup locations while demonstrating the verification command from zero.
What you can do after
Diagnose backup-validation failures by running verification after backup jobs and escalating toward scripted or automated restores.
How it connects
Connects backup integrity with CHECKSUM, automated restores, native backup jobs, and enterprise backup-tool APIs.

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.