PAGE_VERIFY
PAGE_VERIFY is a database option that sets how SQL Server finds out whether a data page was corrupted on disk (torn write, bit error). Unlike PostgreSQL full page writes or the InnoDB doublewrite buffer, SQL Server keeps no separate page copy during normal operation. It only detects corruption; repair means restoring the page from a backup or fetching it from another replica in an availability group.
Key Specifications
| Item | Value |
|---|---|
| Values | CHECKSUM (default for new databases since 2005), TORN_PAGE_DETECTION (older method), NONE |
CHECKSUM | Records a check value for the whole page in the header when the page is written to disk, and compares it on read |
TORN_PAGE_DETECTION | Records 2 bits per 512-byte sector, so it detects only the case where some sectors were written |
| When corruption is found | Error 824 (logical consistency error), recorded in msdb.dbo.suspect_pages |
| When it takes effect | From the next page rewrite after the option is changed. Existing pages keep the old method until they are rewritten |
| Page copy | None normally |
| Recovery method | Page-level restore (RESTORE DATABASE ... PAGE), automatic page repair in availability groups and mirroring |
How It Works
Figure. Detecting and repairing corruption with CHECKSUM
flowchart LR
A["Write the page to disk<br/>store the check value in the header"] --> B["Read the page later"]
B --> C{"Is the recomputed check value the same?"}
C -- "Yes" --> D["Use normally"]
C -- "No" --> E["Error 824<br/>recorded in suspect_pages"]
E --> F["Availability group: automatic page repair from another replica"]
E --> G["Standalone server: restore the page from a backup + apply log backups"]
Diagram description: When a page is written, the check value goes into the header, and on read SQL Server recomputes it and compares. If it differs, the query fails with Error 824 and the page number is left in suspect_pages. In an availability group (or database mirroring), SQL Server fetches a good page from another replica and replaces it automatically. On a standalone server, you restore only that page from a full backup and then apply log backups to bring it up to date. For this reason, a page restore needs the FULL recovery model and an unbroken chain of log backups.
When the check happens. The check runs only when a page is read from disk. A page that stays in the buffer pool, or a page that is never read, is not checked, so run DBCC CHECKDB periodically to make it read every page. BACKUP ... WITH CHECKSUM also verifies the check values while backing up.
Do not use NONE. A corrupt page can be read as is and return wrong results. A database upgraded from an earlier version can remain on TORN_PAGE_DETECTION or NONE, so check it.
Configuration and Inspection
SELECT name, page_verify_option_desc FROM sys.databases;
ALTER DATABASE tune SET PAGE_VERIFY CHECKSUM;
-- Pages where corruption was detected
SELECT database_id, file_id, page_id, event_type, error_count, last_update_date
FROM msdb.dbo.suspect_pages;
-- Check every page
DBCC CHECKDB (N'tune') WITH NO_INFOMSGS, ALL_ERRORMSGS;
-- Restore a single page (FULL recovery model, then apply the log backups in order)
RESTORE DATABASE tune PAGE = '1:57' FROM DISK = N'/var/opt/mssql/backup/tune.bak' WITH NORECOVERY;
Comparison with Other DBMSs
| SQL Server | PostgreSQL | InnoDB | Oracle | |
|---|---|---|---|---|
| Tear detection | PAGE_VERIFY CHECKSUM | Data checksum (initdb option) | Page checksum | Block checksum |
| Intact copy | None normally | Full page image in the WAL | doublewrite area | None normally |
| Recovery | Restore the page from a backup, automatic repair from a replica | Overwrite with the image, then Redo | Replace with the copy, then Redo | RMAN block-level recovery |
In the Articles
- 5.1 Power loss during a page write
- 5.3 The rule of writing the log before the data page
- 5.6 DBMS differences and a one-line summary
NOTE Defaults and the conditions for automatic page repair can vary by version and configuration.