File Repair
Database Recovery with Piecemeal Restore in Microsoft SQL Server
July 28, 2026| 7 min read
Summary: SQL Server sometimes throws consistency based I/O error. In this article, we will explain why this error occurs and discuss different ways to resolve the error. We will also mention an MS SQL database repair software that can easily recover the corrupted database.
Free Download 100% SecureWhen trying to modify data in the SQL database, you may encounter the logical consistency-based I/O error.
The complete error message may look like this:
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:1628; actual 0:0). It occurred during a read of page (1:1628) in database ID 10 at offset 0x00000002a70000 in file ‘C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAstellardb.mdf’.
There are several reasons that can damage the database, resulting in the logical consistency-based I/O error. Some common reasons are:
You can try the following ways to fix this error and restore the database.
The easiest way to solve this issue is to restore the database from the most recent backup and replace the corrupt one. You can use the following code in T-SQL to restore the database:
The above code will restore the database, named stellardb, stored at the path e:\backups\stellardb.bak. You can change the database name in the code.
Alternatively, you can restore the database using the user interface in SSMS. Here are the steps:
If you do not have a database backup, then you can use the DBCC CHECKDB command. This option can repair the database if it is corrupt. Follow the below instructions:
ALTER DATABASE stellar SET EMERGENCY;
ALTER DATABASE stellar SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CHECKDB (stellardb, REPAIR_REBUILD) WITH NO_INFOMSGS, ALL_ERRORMSGS;
ALTER DATABASE stellardb SET MULTI_USER;
If it is a single page that is damaged, you can restore that page from the backup. This option is useful if your database is large. For this, open the SSMS and follow the below steps:
SELECT name as FileName, file_id AS FileID FROM sys.database_files;
If the DBCC command does not work and you do not have a backup, then the best option is to use a third-party SQL database repair tool. The software can easily repair MDF and NDF files (SQL Server data files that contain the database’s data). It can restore tables, views, rules, stored procedures, functions triggers, and more. This software is compatible with all the SQL Server editions for Windows, including SQL Server 2022, 2019, 2017, 2016, and earlier versions.
Here’s how to use this software.
It is not uncommon to get the logical consistency-based I/O error in SQL database. Above, we have explained the reasons for the logical consistency-based I/O error and mentioned the solutions to resolve this error. You can restore the database from a backup or repair the database using the DBCC CHECKDB command. If nothing works, you can use the Stellar Repair for MS SQL software that can repair the database and help fix the error.