SQL Server Error 928 occurs when the database engine encounters a critical internal exception during a database upgrade or a consistency check, typically indicating that the database is in a state that the system cannot reconcile. To resolve this, you must identify the specific corrupted page or system object causing the exception, perform a full backup, and then use the DBCC CHECKDB command with repair options or restore from a known healthy backup to clear the internal state error.

What You'll Need

  • Administrative access to the SQL Server instance (sysadmin role).
  • SQL Server Management Studio (SSMS) installed on the local or remote machine.
  • A current, verified full backup of the affected database.
  • Sufficient disk space to perform a database consistency check and potential repair operations.
  • Access to the SQL Server Error Logs to identify the specific severity and state of the exception.

Step-by-Step

  1. Identify the Error Details: Open SQL Server Management Studio (SSMS) and connect to the instance. Navigate to Management > SQL Server Logs. Locate the Error 928 entry. Note the severity level and the state number. These details are critical because they tell you if the error is a transient memory issue or a persistent physical corruption of the database pages.
  2. Isolate the Database: Set the affected database to SINGLE_USER mode to ensure no other processes interfere with the repair process. Run the following command: ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;. This disconnects all active users and prevents new connections.
  3. Run a Full Consistency Check: Execute a comprehensive check to find the exact location of the exception. Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;. This command scans the entire database for structural inconsistencies. Look specifically for messages regarding "page" or "allocation" errors that coincide with the 928 exception.
  4. Perform an Immediate Backup: Before attempting any repair that could lead to data loss, create a tail-log backup or a full backup. Even if the database is corrupted, having a snapshot of the current state is essential if the repair process fails or worsens the corruption.
  5. Attempt a Non-Destructive Repair: If the error is related to minor index corruption, try rebuilding the indexes. Use ALTER INDEX ALL ON [TableName] REBUILD; for tables identified in the CHECKDB report. If the error persists during the upgrade process, move to the next step.
  6. Execute REPAIR_REBUILD: If DBCC CHECKDB reports errors that can be fixed without data loss, run DBCC CHECKDB ('YourDatabaseName', REPAIR_REBUILD);. This option fixes missing or corrupted indexes and system metadata without deleting user data.
  7. Execute REPAIR_ALLOW_DATA_LOSS (Last Resort): If the 928 exception is caused by a corrupted data page that cannot be rebuilt, you may need to use DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);. Warning: This command will delete any corrupted pages to make the database structurally sound, which means you will lose the data contained in those pages. Only do this if you have no valid backups.
  8. Verify the Fix: Run DBCC CHECKDB ('YourDatabaseName') once more to ensure that no errors remain. The output should report that the database is consistent.
  9. Restore Multi-User Access: Return the database to its normal operational state by running ALTER DATABASE [YourDatabaseName] SET MULTI_USER;.
  10. Resume the Upgrade: Restart the SQL Server upgrade process or the specific script that triggered the exception. The system should now be able to progress past the point where the 928 error occurred.

Common Mistakes

One of the most frequent mistakes is attempting to run repair commands without first taking a full backup. Because Error 928 often involves internal exceptions that can be exacerbated by repair attempts, failing to have a restore point can lead to permanent data loss. Another common error is ignoring the "State" and "Severity" numbers in the error log. These numbers often point to whether the problem is in the TempDB, the system catalogs, or a specific user table; treating every 928 error as a general corruption issue can lead to unnecessary and risky repair steps.

Users also frequently forget to set the database to SINGLE_USER mode. If you attempt to run a repair while other applications are writing to the database, the repair may fail or, worse, create new inconsistencies because the database state is changing while the tool is trying to fix it. Finally, some administrators mistakenly believe that restarting the SQL Server service will fix Error 928. While a restart might clear a transient memory exception, it will not fix the underlying physical or logical corruption that usually triggers this error during an upgrade.

Tips

To prevent Error 928 during future upgrades, always run DBCC CHECKDB on all databases before starting the upgrade process. This ensures you are upgrading a healthy database rather than discovering corruption in the middle of a version migration. Additionally, ensure that your underlying storage hardware is healthy. Many 928 exceptions are symptoms of failing disk sectors or faulty RAID controllers that cause "bit rot" or page corruption.

When analyzing the error logs, look for "CheckSum" errors. If you see CheckSum failures accompanying Error 928, it is a definitive sign of physical corruption. In these cases, restoring from a backup is always safer than using REPAIR_ALLOW_DATA_LOSS. If you are working in a high-availability environment (Always On Availability Groups), check the secondary replicas. Sometimes a secondary replica is healthy while the primary is corrupted, allowing you to failover to a clean copy of the data.

Troubleshooting

If the DBCC CHECKDB command fails to run or hangs indefinitely, the corruption may be located in the system tables or the boot page of the database. In this scenario, try starting the SQL Server instance in minimal configuration mode using the -f startup parameter. This allows you to access the system databases and attempt repairs on the master or msdb databases if they are the source of the exception.

If you receive an error stating that the database cannot be set to SINGLE_USER mode because it is currently in use, use the sp_who2 stored procedure to identify the active sessions. Manually kill those sessions using the KILL [SessionID] command before attempting the ALTER DATABASE command again. If the upgrade process itself is stuck in a loop and triggering the 928 error, you may need to roll back the entire instance upgrade to the previous version, fix the database corruption on the older version, and then re-attempt the upgrade.

In cases where REPAIR_ALLOW_DATA_LOSS does not resolve the issue, the only remaining path is to restore the database from the most recent healthy backup. If the backup is also corrupted, you may need to use third-party page-level recovery tools or contact professional data recovery services to extract the raw data from the .mdf files.

Frequently Asked Questions

Does Error 928 always mean my data is lost?

No. Error 928 indicates a database exception, which could be caused by a corrupted index or a transient system error. If the corruption is limited to non-clustered indexes, the data is safe and can be recovered by rebuilding the indexes.

Can I ignore Error 928 if the database seems to be working?

No. Ignoring this error is dangerous because it indicates an underlying structural problem. While the database may appear functional now, the corruption can spread or cause a total database crash during a backup or a system restart.

Why does this happen specifically during an upgrade?

Upgrades often involve updating system catalogs and migrating internal data structures. If there is existing, undetected corruption in the database, the upgrade process will hit that corruption when it tries to modify those specific pages, triggering the exception.

How long does DBCC CHECKDB take to run?

The duration depends entirely on the size of your database and the speed of your disk I/O. For multi-terabyte databases, it can take several hours or even days. It is recommended to run this during a maintenance window.

Is there a way to fix Error 928 without taking the database offline?

Generally, no. Because Error 928 involves critical exceptions in the database engine, the database must be placed in SINGLE_USER mode to ensure a consistent state for repair. Attempting "live" repairs on corrupted system pages is not supported and is highly risky.