Read time 5 minutes

Summary: Interrupted transactions in SQL Server due to hardware or software issues lead to deferred transactions, causing errors like Msg 7929. Solutions include restarting SQL Server, restoring from backups, or using risky methods like DBCC REPAIR_ALLOW_DATA_LOSS. A safer option is Kernel SQL Database Recovery, efficiently recovering corrupt SQL databases without backups, reducing data loss risks and manual troubleshooting efforts.

SQL Server stores data in MDF/LDF files. If a transaction is interrupted due to hardware or software failure during SQL Server operation, it may result in incomplete transactions and subsequent errors or inaccessible tables. In such cases, running the DBCC CHECKDB command can assess the database’s health. If the database couldn’t complete the transaction and is in a deferred state, it will generate an error message like this:

Msg 7929, Level 16, State 1, Line 1
Check Statement aborted. Database contains deferred transactions

What is a deferred transaction?

A deferred transaction is an incomplete transaction that failed to finish the roll-forward process. In enterprise SQL servers, it arises from a high transaction volume, while in other editions, it manifests as a startup error. This issue occurs due to input-output errors, preventing the necessary page reading for the transaction.

If the SQL Server is suddenly started or stopped, it halts the transaction roll-forward process, hindering data retrieval from the table. Additionally, a deferred transaction can occur when a restore process is partially completed, stopping at a point where offline data is needed, necessitating a rollback.

Resolve the 7929 error from SQL Server

Error 7929 occurs due to a deferred transaction. Resolving the transaction will automatically eliminate the error. Here’s a detailed guide on how to fix it:

  1. Restart the SQL Server, and if the reason behind the deferred transaction is temporary, then it will get sorted automatically.
  2. If the error was due to an offline filegroup, then bring the filegroup online by applying the command:
  3. RESTORE DATABASE <DatabaseName> FILEGROUP=<FilegroupName>
  4. Restore the database with the help of a recent backup. The backup will remove any deferred transaction and resolve it automatically. The online restore will also sort the issue of corrupt page.
  5. If the deferred transaction occurs due to the offline filegroup, then defunct the filegroup. The transactions related to the defunct filegroup will also become defunct, thus removing the deferred situation.
  6. NOTE: You cannot recover a defunct filegroup.

  7. If you did not take a recent backup or the deferred transaction occurs due to a bad page in the database, then you need to set the database at an emergency mode:
ALTER DATABASE <DatabaseName> SET EMERGENCY

Now run the repair command DBCC REPAIR_ALLOW_DATA_LOSS for the database along with DBCC CHECKDB.

NOTE: The repair command deallocates the corrupt pages and allows to recover deleted records in the SQL Server and achieves a consistent state. However, executing this command might lead to significant data loss, which may be unrecoverable. It’s advisable to resort to this method only when other alternatives have failed.

If you encounter an error preventing database access and manual recovery poses risks, consider utilizing Kernel SQL Database Recovery tool It doesn’t require a backup file for database recovery. This SQL Recovery tool can access MDF/LDF files and eliminate errors, ensuring the database is restored to full health.

Here is the total procedure of recovering the data from a corrupt SQL database file –

  1. Install and run the software. A wizard automatically opens up. Click the Browse button.
    Install and run the software
  2. After browsing the database file, choose the scan mode based on the severity of corruption. Also, check the box to detect the database version automatically. Finally, click Recover.
    check the box to detect the database version automatically
  3. The tool recovers the complete data and brings you the whole database along with all the objects as they were saved in the SQL Server. Check any object to get its preview. Click the Save button.
  4. To save the data on SQL Server, input the Server name, database name, and authentication method (the second option is to keep the offline batch file at any location). Click OK.
    Click OK
  5. The tool saves the data at the selected database, thus removes any deferred transaction. Click OK.
    saves the data at the selected database

Conclusion

Kernel SQL Database Recovery software is a lightweight and streamlined tool capable of accessing SQL databases across various versions and eliminating corruption or errors. It prevents the need for manual troubleshooting, reducing the risk of accidental data deletion.

Kernel for SQL Database Recovery