Fix it now
All three codes are the engine reporting that the storage under it misbehaved. 823 means a Windows file API call failed outright, after four retries on a read. 824 means the read succeeded and the page failed one of six consistency checks. 825 means a read only worked after retrying, which is the early warning nobody alerts on.
SELECT * FROM msdb.dbo.suspect_pages;
DBCC CHECKDB (N'MyDb') WITH NO_INFOMSGS, ALL_ERRORMSGS;
- Read the Windows System event log on the server for disk, controller and multipath errors at the same timestamps. Microsoft’s own user action for 823 puts the operating system and hardware errors first.
- Check for filter drivers in the I/O path:
fltmc filtersandfltmc instancesfrom an elevated prompt. Antivirus and backup filters are named causes. - If the database is online and in full recovery, take a tail-log backup now so you keep everything since the last log backup.
- Plan the recovery from backups. A small, known set of damaged pages is a page restore; widespread damage is a full restore. Do not open with a repair option.
825 is severity 10, which is informational. Nothing alerts on it by default and a database that logs 825 today frequently logs 823 next month. Add it to your alerting.
If the storage is healthy and CHECKDB is clean, you are done and you should still keep the timestamps. If not, the next section explains what each code proves.
Why it happens
SQL Server does its file I/O through the Windows APIs ReadFile, WriteFile, ReadFileScatter and WriteFileGather. When one of those calls returns an error, the engine raises 823 and prints the operating system error, the file, the offset and whether it was reading or writing. The engine did not decide anything was wrong; it was told. That makes 823 the most direct evidence you will get that the storage stack is failing, and it is why Microsoft’s user action starts with the Windows event logs rather than the database.
There is a detail in the 823 documentation that links it to 825 and that most articles skip. For read operations SQL Server retries four times before giving up. If one of those retries succeeds you get 825 instead, logged at severity 10 as an informational entry. So 825 is not a lesser error; it is the same failing hardware, caught on a day when it happened to work on the second attempt.
824 is different in kind and worse in effect. The read succeeded, Windows was satisfied, and SQL Server rejected what came back. Microsoft names the six checks that can fail: checksum, torn page, short transfer, bad page ID, stale read and page audit failure. This is the silent corruption that page checksums exist to catch, which is why PAGE_VERIFY should be CHECKSUM on every database and why an instance running with it set to NONE has no way of knowing.
Failing disks, controllers, paths or firmware
You have this one if 823 or 825 entries with matching disk, HBA or multipath events in the Windows System event log, or several unrelated databases on one volume reporting together.
- Give whoever owns the storage the timestamps, the file names and the offsets from the SQL Server error log.
- Check firmware and driver levels on the controller, the host bus adapter and the array, and the battery or capacitor on any write cache.
- Reproduce it outside SQL Server with SQLIOSim, which ships in the instance’s Binn folder and exists for exactly this question.
- Turn on trace flag 818 for extra diagnostics on unreported I/O problems:
DBCC TRACEON (818, -1);
Errors on several unrelated databases sharing a volume are pointing at the volume. Stop looking at the databases.
A filter driver in the I/O path
You have this one if 824 on a machine whose storage checks out, often a virtual machine, often with an endpoint protection or file-level backup agent installed.
- List what is in the path:
fltmc filtersandfltmc instances. - Check for updates to whatever you find, and consider disabling one to test.
- Exclude database files from real-time antivirus scanning.
- On a virtual machine, update the virtualisation drivers as well.
A contained set of damaged pages, with backups available
You have this one if 824 on specific pages, CHECKDB reports a bounded set of errors, and the database is in full recovery with an unbroken log chain.
- Take the page identifiers from the CHECKDB output and from
msdb.dbo.suspect_pages. - Restore those pages from the most recent full backup WITH NORECOVERY, then apply the differential and log backups in order, also WITH NORECOVERY.
- Take a tail-log backup, then restore that file WITH RECOVERY. That last step is what closes the sequence.
- Re-run CHECKDB and confirm it is clean before returning the database to users.
RESTORE DATABASE [MyDb]
PAGE = '1:57142, 1:57143'
FROM DISK = N'E:\Backups\MyDb_full.bak'
WITH NORECOVERY;
GO
RESTORE LOG [MyDb] FROM DISK = N'E:\Backups\MyDb_log1.trn' WITH NORECOVERY;
GO
BACKUP LOG [MyDb] TO DISK = N'E:\Backups\MyDb_tail.trn';
GO
RESTORE LOG [MyDb] FROM DISK = N'E:\Backups\MyDb_tail.trn' WITH RECOVERY;
Online page restore is an Enterprise edition feature in SQL Server 2019, 2022 and 2025. Every other edition performs the same restore with the database offline, so plan the outage.
Widespread corruption
You have this one if CHECKDB returns errors across many objects, or reports allocation errors as well as consistency errors.
- Restore the whole database from the last known-good backup and roll forward with your log chain.
- Verify each candidate before you depend on it:
RESTORE VERIFYONLY FROM DISK = N'...' WITH CHECKSUM; - If the newest full backup is also damaged, work backwards through the chain until one verifies.
- Consider a repair option only after you have established that no restore path exists, and record that decision.
Page verification was off, so the damage went unnoticed
You have this one if Corruption surfaces long after it happened, and PAGE_VERIFY reads NONE or TORN_PAGE_DETECTION.
- Find them:
SELECT name, page_verify_option_desc FROM sys.databases WHERE page_verify_option_desc <> 'CHECKSUM'; - Set it:
ALTER DATABASE [MyDb] SET PAGE_VERIFY CHECKSUM; - Understand the limit. Existing pages only gain a checksum the next time they are written.
- Back up WITH CHECKSUM so damage is caught at backup time rather than at restore time.
Full reference
What each code proves, and what it does not
| Code | Severity | What the engine is saying |
|---|---|---|
| 823 | 24 | A Windows file API call failed. Reads are retried four times first. The message carries the OS error, the file, the offset and read or write |
| 824 | 24 | The read succeeded and the page failed a logical check: checksum, torn page, short transfer, bad page ID, stale read or page audit |
| 825 | 10 | A read succeeded after failing one or more times. Informational, so nothing alerts on it by default |
| 829 | 21 | A page is marked RestorePending, which may indicate disk corruption. It cannot be used until a restore completes |
| 3183 | 16 | RESTORE detected an error on a page as read from the backup set. The damage is inside the backup, not only in the live files |
Divide the offset in an 823 message by 8,192 to get the logical page number, which is what lets you line the error up against a CHECKDB result or a row in suspect_pages.
What page restore can and cannot touch
Page restore is narrower than people expect, and finding out mid-incident is expensive. Microsoft documents these restrictions.
- Full or bulk-logged recovery model only, and read/write filegroups only.
- The transaction log cannot be page-restored.
- Allocation pages cannot: GAM, SGAM and PFS pages are all excluded.
- Page 0 of any data file, the file boot page, cannot. Nor can page 1:9, the database boot page.
- Full-text catalogues cannot.
- An unbroken chain of log backups must be applied to bring the pages forward to the current log, so a broken chain rules it out.
- In the bulk-logged model a log backup that meets a bad page fails unless you specify WITH CONTINUE_AFTER_ERROR. Microsoft’s own advice is to switch to full recovery before attempting a page restore.
Diagnostics Microsoft names that people skip
| Tool | What it answers | Where it lives |
|---|---|---|
| SQLIOSim | Can the 823 be reproduced outside SQL Server’s own I/O? | ...\MSSQLxx.MSSQLSERVER\MSSQL\Binn |
DBCC TRACEON (818, -1) |
Extra diagnostics for unreported I/O problems | Instance-wide trace flag |
fltmc filters / fltmc instances |
Which filter drivers sit in the path | Elevated command prompt |
msdb.dbo.suspect_pages |
Which pages the engine has already found bad, and why | msdb on the instance |
| Windows System event log | The storage stack’s own account of the same minute | Event Viewer, Windows Logs, System |
Making the next one cheaper
- Run DBCC CHECKDB on a schedule and alert on failure. Damage found within a day is a page restore; damage found within a year is a rebuild.
- Alert on 823, 824 and 825 in the error log, and on new rows in msdb.dbo.suspect_pages. 825 is the one that needs deliberate alerting because its severity keeps it out of most default rules.
- Set PAGE_VERIFY to CHECKSUM everywhere and back up WITH CHECKSUM.
- Retain enough backup history that a clean copy still exists when a problem surfaces late.
- Test a restore. A backup you have never restored is an assumption, not a plan.
Two things worth not doing
Do not run DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS as a first response. Microsoft’s own wording is that it is an emergency last resort, recommended only if restoring from a backup is not possible, and that it can result in more data loss than a restore would. It makes a database structurally consistent by deallocating what it cannot mend, and deallocated data is not recoverable.
And do not move the database to different storage before you have a consistency check and a backup you trust. Moving first destroys the correlation between the errors and the hardware, and cheerfully carries the damaged pages onto the new volume.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
823 |
The operating system returned an error to SQL Server during a read or write at a given offset in a database file. Severity 24; reads are retried four times before this is raised | Microsoft Learn |
824 |
SQL Server detected a logical consistency-based I/O error. The read succeeded and the page failed a checksum, torn page, short transfer, bad page ID, stale read or page audit check | Microsoft Learn |
825 |
A read of a file succeeded after failing one or more times. Severity 10, so it is informational and easy to miss | Microsoft Learn |
829 |
A page is marked RestorePending, which may indicate disk corruption. It stays unusable until a restore completes | Microsoft Learn |
3183 |
RESTORE detected an error on a page in the database as read from the backup set | Microsoft Learn |
Confirm the fix worked
- Run
DBCC CHECKDB (N'MyDb') WITH NO_INFOMSGS, ALL_ERRORMSGS;and confirm it reports no allocation or consistency errors. - Confirm
msdb.dbo.suspect_pagesshows the affected pages as restored or repaired rather than still bad. - Check the SQL Server error log and the Windows System event log for a clear period since the fix, with no new I/O entries and no new 825s.
- Confirm
PAGE_VERIFYreads CHECKSUM for the database, and take a fresh backup WITH CHECKSUM. - Run
RESTORE VERIFYONLY ... WITH CHECKSUMagainst that backup before you rely on it.
Questions people ask about this
Can I just run repair and carry on?
You can, and you should know what you are agreeing to. Microsoft describes REPAIR_ALLOW_DATA_LOSS as an emergency last resort that can lose more data than restoring from the last known good backup would, because it clears errors by deallocating rows and pages. It is right only when no usable backup exists.
Does a higher edition help?
Not with the damage. Enterprise allows an online page restore, so the database stays available while the pages are repaired; every other edition performs the same restore with the database offline. Nothing you buy fixes failing storage.
CHECKDB is clean but I saw 823 in the log. What now?
Take it seriously anyway. A clean check means the pages currently in the database are consistent, not that the storage is healthy. The I/O failure was real and was reported by the operating system, not inferred by SQL Server.
What is 825 really telling me?
That a read failed and only worked on a retry. SQL Server retries a read four times before raising 823, so 825 and 823 are the same hardware problem on different days. It is logged at severity 10, so alert on it deliberately or you will never see it.
Should I move the database to different storage straight away?
Not before you have a consistency check and a backup you trust. Moving first destroys the correlation between the errors and the hardware, and can carry corrupted pages onto the new volume.
