DBAtlas · Database operations atlas

Find corrupt pages (suspect_pages) and restore single pages

SQL ServerRestore & Recovery

Command

-- Pages that hit 823/824 or checksum errors:
SELECT DB_NAME(sp.database_id) AS db, sp.file_id, sp.page_id,
       CASE sp.event_type WHEN 1 THEN '823/824 error' WHEN 2 THEN 'bad checksum'
            WHEN 3 THEN 'torn page'     WHEN 4 THEN 'restored'
            WHEN 5 THEN 'repaired'      WHEN 7 THEN 'deallocated by DBCC' END AS event_desc,
       sp.error_count, sp.last_update_date
FROM   msdb.dbo.suspect_pages sp
ORDER BY sp.last_update_date DESC;

-- Page restore (example 1:336): FULL + later logs + a new log backup
RESTORE DATABASE [Musteri] PAGE = '1:336'
FROM DISK = N'D:\Backup\Musteri_full_20261008.bak' WITH NORECOVERY;
RESTORE LOG [Musteri] FROM DISK = N'D:\Backup\Musteri_log_1200.trn' WITH NORECOVERY;
BACKUP LOG [Musteri] TO DISK = N'D:\Backup\Musteri_log_pagetail.trn' WITH INIT;
RESTORE LOG [Musteri] FROM DISK = N'D:\Backup\Musteri_log_pagetail.trn' WITH RECOVERY;

-- Verify:
DBCC CHECKDB (N'Musteri') WITH NO_INFOMSGS, ALL_ERRORMSGS;

What it does

Lists pages that hit I/O (823/824), checksum or torn page errors from msdb.dbo.suspect_pages; repairs individual corrupt pages by taking them from the FULL backup and rolling them forward with logs, without restoring the whole database.

When to use it

On 823/824 errors in the error log, consistency errors limited to a few pages in CHECKDB, or a user query failing with "incorrect checksum".

Caution

Requires FULL or BULK_LOGGED recovery and an unbroken log chain. Online page restore is Enterprise/Developer only; on other editions the database is offline during the restore. Allocation pages (GAM/SGAM/PFS), file headers and the boot page (1:9) cannot be restored this way. 823/824 usually means a storage problem; do not close the case without checking the disk/controller/SAN, or it will recur. With many bad pages a full database restore is faster.

Open in DBAtlas →

Related