The safest way to repair a corrupt SQL Server database without data loss is to restore from a known good backup, using point-in-time recovery if you have log backups. If only a few pages are damaged, a page-level restore fixes them without touching the rest of the database. When no usable backup exists, a third-party SQL recovery software or an online repair service is the remaining option. What to avoid is DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS, which, as the name says, can delete data to make the database consistent.
Corruption stops daily operations and puts finances, reputation and continuity at risk, so it needs a fast and careful response. REPAIR_REBUILD is a data-safe repair option, but its scope is very limited. The methods below are ordered from the safest to the last resort.
Which repair method should you use?

The choice depends on two questions: do you have a valid backup chain, and how much of the database is damaged?
| Situation | Method | Data loss risk |
| Valid full, differential or log backups exist | Restore from backup | Minimal to none |
| Only a few pages are corrupt and the log chain is unbroken | Page-level restore | Low, with a complete log chain |
| Backups are missing or damaged | Repair tool or online repair service | Depends on the tool and the damage |
| Any situation | DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS | High, last resort only |
Whichever route you take, a tested data backup strategy decides how painful the incident is. Backups are only useful if you have restored from them before.
How do you restore a corrupt database from a known good backup?
Restoring from a valid backup is the first method to try, because it gives the best chance of little or no data loss. You need one or more recent backups of these types:
- Full backup: a copy of the complete database
- Differential backup: the changes since the most recent full backup
- Transaction log backup: the sequential history of transactions
Together these let you restore to a specific point in time. The steps below use SQL Server Management Studio (SSMS).
Open the restore dialog

- Launch SSMS and connect to the SQL Server instance that holds your database.
- In Object Explorer, expand the server tree, then expand Databases.
- Right-click the database you want to restore.
- Go to Tasks > Restore > Database.
- On the General page, choose Database under Source and pick the database from the dropdown.
- The Destination field fills in automatically. Use the Timeline button if you need a specific point in time.
- Under Restore Plan, in Backup Sets to Restore, check the backups you want to use. Full and differential backups appear in this list.
Choose the restore options

Open the Options page under Select a Page and pick what applies:
- Overwrite the existing database (WITH REPLACE): replaces the existing database files.
- Preserve the replication settings: keeps the original replication configuration.
- Restrict access to the restored database: limits access to a restricted set of users after recovery.
Pick a recovery state

The Recovery state dropdown has three options:
- RESTORE WITH RECOVERY: rolls back uncommitted transactions and leaves the database ready to use.
- RESTORE WITH NORECOVERY: leaves the database ready to receive more backups.
- RESTORE WITH STANDBY: leaves the database in read-only mode.
Click OK and wait for the message that the restore of the database completed successfully. If SQL Server still stops queries and raises a high-level I/O error afterward, the cause may be page-level corruption, which the next method addresses.
How does a page-level restore work?
If only a few pages are corrupt, restore just those pages. You replace the damaged pages with healthy copies from a valid backup and then apply the later backups to bring the pages forward. That avoids restoring the entire database, which is slow and easy to get wrong.
Prerequisites and limits
- Recovery model: the database must use the Full or Bulk-logged recovery model.
- Filegroups: page restore supports read/write filegroups only.
- Page types: you can restore only standard data pages.
- Backup chain: the log backups must be unbroken, from the full backup up to the current log file.
Step 1: find the file ID and page ID of the corrupt page
You can find these IDs in the SQL Server error log or in event traces. You can also query the suspect pages table directly:
SELECT * FROM msdb..suspect_pages
Another option is to run DBCC CHECKDB to check the pages, indexes and tables for corruption, where SQLTestDB is the database name:
DBCC CHECKDB (SQLTestDB);
To inspect a specific page once you know its ID, turn on trace flag 3604 and run DBCC PAGE:
DBCC TRACEON (3604)
DBCC PAGE('SQLTestDB',1,368,2) WITH TABLERESULTS
Step 2: start the page restore
This method applies to databases that use the Full or Bulk-logged recovery model. Online page restore is an Enterprise Edition feature, so in SSMS the Page option may not be available on Standard Edition.
- Open SSMS and connect to your SQL Server instance.
- In Object Explorer, go to Tasks > Restore > Page.
- In the Page Restore window, check the selected database, the backup set, the backup file and the other details.
- Click Check Database Pages to find the corrupt pages. When it finishes, the page grid appears.
- Use Add or Remove to change which pages are in the grid.
- Click OK to restore the pages listed in the grid.
This is a quick way to restore individual pages. With many damaged pages it becomes slow, and it may not restore the transaction log, allocation pages or page 0 of the database, so experts advise against it in that case.
You can also run a page restore with T-SQL. The Microsoft documentation for RESTORE statements has the syntax. It follows a zero-data-loss strategy as long as you have an unbroken chain of log backups up to the point of failure. The drawbacks are real, though: the process is time-consuming, complicated, error-prone and needs deep technical knowledge. When those costs are too high, or the backup chain is broken, move to a repair tool.
When should you use an online SQL repair service?
If the database is corrupt and backups are unavailable or damaged, an online MSSQL repair service can repair the file without installing desktop software. Stellar offers a free online SQL repair service where you upload a corrupt MDF file, repair it and download the result. The company says it supports MDF files up to 5 GB and recovers database objects and records affected by corruption.
The online route fits these situations:
- Corrupt or inaccessible SQL Server MDF files
- Corruption caused by unexpected shutdowns or system failures
- Recovering tables, records and other objects from a corrupt MDF file
- Repairing a database when no valid backup is available
Because the process runs in a web browser, you do not need to install anything. Remember that uploading an MDF means sending your data to a third party, so check your data-protection obligations first, and work on a copy of the file, never the only original. If the incident exposes weaknesses in your recovery process, a written disaster recovery plan is the next thing to build.
Frequently asked questions
Is DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS safe?
No. It can remove data to restore consistency, so use it only when you have no other option and after taking a copy of the damaged files.
Can I repair a corrupt SQL Server database without a backup?
Sometimes. A repair tool or an online repair service can recover objects and records from a corrupt MDF file, but results depend on the extent of the damage, and no tool can promise full recovery.
When is a page-level restore better than a full restore?
When only a few pages are damaged, the database uses the Full or Bulk-logged recovery model and the log backup chain is unbroken. It saves you from restoring the whole database.
How do I find which pages are corrupt?
Query the suspect pages table in msdb, check the SQL Server error log, or run DBCC CHECKDB.
What should you do first?
Stop writes to the affected database, take a copy of the files, and check which backups you have. If a valid chain exists, restore from it, or restore only the damaged pages. If it does not, test a repair tool on the copy before touching the original.
- How to Redo in VS Code (Shortcuts and Fixes) - December 5, 2026
- Scaling Customer Support Without Losing Quality: A Practical Guide for Growing Companies - December 5, 2026
- Top MySQL CDC Tools for Streaming Changes to a Data Warehouse - December 4, 2026



