SQL Database Repair

How to Fix Error 832 in MS SQL Server?


Table of Content

    Summary: The error 832 in MS SQL can occur if there is a problem with database pages. In this post, we will learn the ways to detect this error and discuss different solutions to fix this error. We will also mention an SQL database repair tool that can easily and quickly repair the corrupt database.

    Read full summary

    The error 832 is an error related to problems in the SQL Server pages. This error occurs when an external tool (outside the database engine) affects the database pages. The complete error message looks like this:

    Msg 832, Level 24, State 1, Line 1

    A page that should have been constant has changed (expected checksum: 0xE7F987A3, actual checksum: 0xA2B9E4F1, database id: 5, file id: 1, page id: 123456789, expected file size: 1048576, created timestamp: 2023-07-15 10:34:28.283).

    The Level 24 indicates that it is a critical error. This error is related to a problem in the hardware or operative system that has affected one or more pages in the database. In addition, it can happen if a running thread in an MS SQL Server process incorrectly writes on a page in the database.

    How can we detect this error?

    There are different ways to detect this error. You can look for this error in the Event Viewer. To open the Event Viewer, type event Viewer in the Search textbox in your taskbar in your Windows OS.

    Instructions to detect errors and open Event Viewer on Windows OS

    In the Event Viewer, go to Windows Logs > Application. Optionally, you can customize the Filter options to find the error.

    Navigating to Windows Logs > Application in Event Viewer and using Filter options to locate errors.

    Alternatively, you can look for this error in the SQL Server Error Log. In the SQL Server Management Studio (SSMS), go to SQL Server Agent > Error Logs. When you open the log, you will see the SQL Server error messages, including the error 832.

    Finding error in SQL Server Error Log using SQL Server Management Studio (SSMS) by navigating to SQL Server Agent > Error Logs, and viewing SQL Server error messages including error 832.

    Ways to Fix the Error 832 in MS SQL Server

    Here are some ways you can try to fix the error 832 and restore the database.

    Restore the Last MS SQL Database Backup

    The easiest way to fix this problem is to use your last backup or the backup with the date closest to your needs. The following T-SQL command shows how to restore your database.

    RESTORE DATABASE stellardb
    FROM DISK = ‘e:\backups\stellardb.bak’

    The above command restores the backup, named stellardb.bak, stored in the e:\backups folder.

    Alternatively, you can use the SQL Server Management Studio (SSMS) to restore the database. Follow these steps:

    • In the SSMS, select the Databases mode and choose the Restore Database option.
    Selecting Databases mode in SQL Server Management Studio (SSMS) and opting for the Restore Database function.
    • Select the Device option and press the Browse button to select the backup.
    Choosing the Device option and clicking the Browse button to select the backup.
    • Select the backup device.
    Choosing the backup device.
    • Select the Backup sets and press OK.
    Choosing the Backup sets and clicking OK.

    Use the DBCC CHECKDB Command

    If you do not have a backup, you can try to repair the database using the DBCC CHECKDB command. The following commands can be used to repair the database:

    ALTER DATABASE stellardb SET EMERGENCY;

    ALTER DATABASE stellardb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

    DBCC CHECKDB (stellardb, REPAIR_REBUILD) WITH NO_INFOMSGS, ALL_ERRORMSGS;

    ALTER DATABASE stellardb SET MULTI_USER;

    The first command sets the database, named stellardb, in emergency mode:

    ALTER DATABASE stellardb SET EMERGENCY;

    The second command sets the database in single-user mode with an immediate rollback.

    DBCC CHECKDB (stellardb, REPAIR_REBUILD) WITH NO_INFOMSGS, ALL_ERRORMSGS;

    The third command repairs the database.

    DBCC CHECKDB (stellardb, REPAIR_REBUILD)

    The last command sets it back to multi-user mode.

    ALTER DATABASE stellardb SET MULTI_USER;

    Restore only a Single Page

    If only a single page is corrupt, you can restore that page. To do this, in the SQL Server Management Studio (SSMS), go to the Object Explorer and select Tasks > Restore > Page.

    Restoring a single corrupt page using SQL Server Management Studio (SSMS) by navigating to Object Explorer, and selecting Tasks > Restore > Page.

    You need to enter the File ID and the Page ID. The Page ID is displayed in error message when you run the DBCC CHECKDB command and the File ID can be found in the following query:

    SELECT name as FileName, file_id AS FileID
    FROM sys.database_files;

    On the Restore Page, press the Add button and enter the File ID and the Page ID. Then, press OK.

    Adding a page to the Restore Page window by clicking the Add button and entering File ID and Page ID, then confirming by clicking OK.

    What to do if the above solutions do not work?

    If the previous methods do not work, then you can use a powerful SQL database repair tool such as Stellar Repair for MS SQL. This tool is designed to fix corrupted databases. To repair the database, you need to first take the database offline. You can use the following T-SQL commands to take your database offline:

    ALTER DATABASE stellardb SET OFFLINE;

    Next, launch the software and look for the database file you need to repair. You can find the data file using the Find button.

    Launching the software and locating the database file for repair by utilizing the Find button.

    Optionally, you can recover deleted rows by checking the Include Deleted Records option. Once the database file is selected, press the Repair button.

    Opting to recover deleted rows by selecting the Include Deleted Records option. After choosing the database file, initiate the repair process by clicking the Repair button.

    Once repaired, you can save the data in a New Database, in an existing database (Live Database), or in other formats, like Excel, CSV, etc.

    Saving Options for the database with new, Live or other formats for Stellar Repair for MSSQL interface

    Conclusion

    Above, we have discussed how to detect the error 832 and different ways to fix the error. The easiest way to fix this is by restoring the database from backup. You can try the DBCC CHECKDB command to repair the database if you do not have a backup. Restoring a single page can be a valid option if only a single or few pages require fixing. If none of these solutions works, you can use Stellar Repair for MS SQL to repair the corrupt database.

    Was this article helpful?

    No NO

    About The Author

    Daniel Calbimonte linkdin

    Daniel Calbimonte is a Microsoft Most Valuable Professional, Microsoft Certified Trainer, and Microsoft Certified IT Professional for SQL Server. He is an accomplished SSIS author, teacher at IT Academies and has over 10 years of experience as a QE and developer for SQL Server related software. He has worked for the government, oil companies, web sites, magazines and universities around the world. Daniel also regularly speaks at SQL Servers conferences and blogs. Read more

    Leave a comment

    Your email address will not be published. Required fields are marked *

    Image Captcha
    Refresh Image Captcha

    Enter Captcha Here :

    Related Posts

    WHY STELLAR® IS GLOBAL LEADER

    Why Choose Stellar?

    • 0M+

      Customers

    • 0+

      Years of Excellence

    • 0+

      R&D Engineers

    • 0+

      Countries

    • 0+

      PARTNERS

    • 0+

      Awards Received