Microsoft sql ошибка 824

How To Fix SQL Database Error 824 — Causes & Solutions

Recently my friend was facing SQL database error 824 while working with the server database. After encountering error 824, she was unable to access the serves NDF and MDF files. I helped her to fix it and like to help others who are facing the same issue. Therefore I’m writing this blog to demonstrate how to fix SQL database error 824 quickly and safely.

SQL servers are the best database management system of all the time. However, despite being the perfect functioning tool it faces various errors periodically. One such error is SQL error 824 which originated due to logical consistency and is a fatal error.

SQL error code 824 is a logical Input/Output (I/O) error means the page is successfully read from the disk however there is an issue in the page itself. In simple words, the main reason for error 824 is a corrupted database where corruption is transpired due to a faulty I/O subsystem component.

Cause for SQL Database Error 824

There are several reasons for the cause of the SQL server error which are as follows:

  1. SQL servers uses Windows API’s to execute I/O operations. Once the I/O operation is executed, server checks for any errors related to APIs. If the API fails then sever receive report error 824.
  2. Insufficient storage capacity on hard drive is one common cause for this error.
  3. Software or hardware failure also triggers this error.
  4. Corrupt or damaged database files are the prime reason for the problem.

This server database error 824 affects the functionality and integrity of the database. Therefore it is always advised to perform regular check of the database via the free inbuilt utility.

Methods to fix SQL Database Error 824

There are two methods that you can use to fix SQL error 824:

  1. Manual solution
  2. Automated SQL Database Repair Tool

Did You Know — Causes & Solution to Fix SQL Server Error 926

Manual Solution

  • Step 1. Thoroughly examine the suspect_page table in msdb to verify that other pages are not facing the same error.
  • Step 2. With the help of inbuilt DBCC CHECKDB command check the state of consistency of the SQL server database.
  • Step 3. If the PAGE_VERIFY CHECKSUM database is not switched on, then turn it on asap.
  • Step 4. Utilize the SQLIOSim tool to verify the state of the SQL 824 error.
  • Step 5. Check whether the error has occurred due the OS, drivers or storage device. Use Windows event logs to check.

It is recommended to create a backup of the SQL server database before attempting to resolver error. Follow these steps to generate backups:

  1. Close all the SQL services.
  2. Now copy and save the corrupted database at a new location on the drive.
  3. Restart SQL server and create a blank SQL database with the same name.
  4. Separate the new database with the original database and run the following commands/query.
  • EXEC sp_resetstatus ‘db_name’ ;
  • ALTER DATABASE db_name SET EMERGENCY
  • DBCC CHECKDB(‘db_name‘)
  • ALTER DATABASE db_name SET SINGLE_USER Mode
  • With ROLLBACK IMMEDIATE DBCC CHECKDB (‘db_name’ , REPAIR_ALLOW_ DATA_LOSS)
  • ALTER DATABASE ‘db_name’ SET MULTI_USER

Using the above steps you can troubleshoot SQL error 824. However, there are some drawbacks of these methods and few of them are mentioned below:

  • Complex and hard to follow for novice users.
  • Very time consuming and one small mistake can corrupt the whole database.
  • Not very safe as there is a risk of permanent damage to the database.
Automated SQL Database Repair Tool

The best alternative to remove SQL server database error 824 is to use a fully automated professional SQL database repair tool. This tool is developed with a high-end algorithm which can easily recover tables, views, stored procedure, programmability, triggers, default, and functions. It two recovery modes can recover maximum possible data from the damaged database. Also, it can even repair corrupted MDF and NDF files. The interface of this tool is simple and self-understanding which aids novice users.

Conclusion

We have discussed several manual methods and a automated solution to fix SQL database error 824. You can use any one of them according to your convenience, however, if you want a quick and 100% safe result then you should opt SQL database repair tool.

 Download Now    Buy Now

Summary:
This blog will describe how to troubleshoot Microsoft SQL database error 824 by using a manual step-wise approach or by using a specialized SQL database repair software. Also, it will cover the possible reasons behind the 824 error.

Free Download for Windows

Contents

  • SQL Database Error 824: Error Message & Description
  • What Causes SQL Database Error 824?
  • Troubleshooting SQL Database Error 824
  • End Note

SQL database error 824 can render the database’s MDF and NDF files inaccessible, preventing you from accessing the objects stored in the database. You must troubleshoot the SQL server error 824 immediately to continue working on the database without any interruption or data loss.

SQL Database Error 824: Error Message & Description

Error Message:

Msg 824, Level 24, State 2, Line 1.

SQL error 824

Description:

The SQL Database error 824 is a logical Input/Output (I/O) error. A logical I/O means that the page is successfully read from the disk. However, there’s an error in the page itself. Moreover, a ‘logical consistency error’ clearly indicates damage due to corruption in the database where corruption is due to an I/O subsystem component that is faulty.

The SQL Server error 824 contains several  information that are as follows:

  • The database to which the database file belongs.
  • The database file against which the I/O operation is performed.
  • The offset with the database file where the I/O operation was attempted.
  • The page number associated with the I/O operation.
  • Information whether the operation was ‘read’ or ‘write’.
  • Particulars of failed logical consistency check. (The particular are: Type of check, actual value, and expected value used for this check.)

Note – If you come across this SQL database error 824, while raising a query or modifying data, the application is returned the error message, and the database connection is dismissed.

What Causes SQL Database Error 824?

For executing I/O operations, Microsoft SQL Server uses Windows API’s, such as ReadFile, WriteFile, ReadFileScatter, and WriteFileGather. After executing these I/O operations, the server checks for errors related to these API calls. If the API calls that have been stated here fail with an Operating System error, then the SQL Server reports error 823. There are circumstances when the ‘Windows API call’ is successful but the data moved by the I/O operation has met with logical consistency issues. Further, these issues are reported through SQL Server error 824.

Following are some other reasons responsible for SQL Server error 824:

  1. Issues in the underlying storage system
  2. Hardware or driver issue in the I/O path
  3. Corrupt or damaged SQL Server database MDF or NDF file
  4. Discrepancies in the SQL’s file system

Troubleshooting SQL Database Error 824

You can try to fix SQL database error 824 by using:

  • Manual Approach
  • Software Approach

Manual Approach

  1. Check the suspect_pages table in msdb to check if other pages in the same database or different databases are encountering this error.
  2. With the built-in DBCC CHECKDB command check the reliability of the databases that are located in the same volume (as the one stated in the 824 message). If you find discrepancies on using this command, then troubleshoot the reported database consistency errors.
  3. If the PAGE_VERIFY CHECKSUM database option in database is not switched on, do it as soon as possible.

Note: SQL error 824 can occur due to other reasons than a checksum failure. However, CHECKSUM offers you to validate a page’s consistency after it has been written on to the disk.

  1. Use the SQLIOSim utility to check if the SQL 824 error can be replicated outside of regular I/O requests in SQL Server.

Note – SQL Server 2008 comes with this utility. For another SQL version, you need to download it from the official website.

  1. Work with the vendor of your hardware or device manufacturer to ensure the following:
    • The ‘device drivers’ and other ‘supporting software components’ of all devices in the I/O path are updated and efficient.
    • The hardware devices and the configuration approve to the I/O requirements of SQL Server.
  2. If the hardware vendor or device manufacturer has provided you with diagnostic utilities, you should use them to assess if the I/O system is in working condition or not.
  3. Assess if there are ‘Filter Drivers’ existing in the path of I/O requests that face issues. To do so, check the following:
    • If there is any update to these ‘filter drivers.’
    • Can these ‘filter drivers’ be disabled or removed to observe if the issue that results in the SQL error 824 is fixed.

With these resolutions, you can troubleshoot SQL error 824. However, there are some disadvantages associated with these methods. All of them being manual, are lengthy and will consume a lot of your time. Plus, they involve risk of data loss and as well as failure due to lack of technical expertise.

Software Approach

Another alternative to fix SQL Server error 824 is to use SQL database repair software, as it helps repair the database to resolve SQL errors while reducing human intervention.

Recommended by Microsoft MVPs and DBAs, Stellar Repair for MS SQL is one software you can rely upon to resolve almost every issue that you can face while working with SQL Server database. Designed to repair the damaged SQL database (MDF) file successfully, the software performs the following as well:

  • Recovers objects, such as tables, triggers, keys, rules, indexes, defaults, and other databases objects
  • Recovers ‘deleted table records’ from the SQL Server
  • Allows selective recovery of database objects
  • Provides preview facilities of the database objects before saving them
  • Permits to save the repaired file in MS SQL (MDF), XLS, HTML, and CSV file formats
    • Users can save the SQL database as a New or Live database under the MDF option.
  • Supports SQL Server 2019, 2017, 2016, 2014, 2012, 2008, and all older editions
free download

End Note

As this blog suggests a number of manual methods and as well as an automatic way to fix error 824 in SQL database, you can use any. However, for quick and successful results you should go for Stellar Repair for MS SQL – an external but result-oriented software!

About The Author

Jyoti Prakash

Problem solver and Data recovery specialist. Usually share informative articles on data recovery, database corruption and ways to recover lost data.

title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic helpviewer_keywords

MSSQLSERVER_824

MSSQLSERVER_824: SQL Server detected a logical consistency-based I/O error.

MashaMSFT

mathoma

jopilov, randolphwest

12/13/2022

sql

supportability

reference

824 (Database Engine error)

MSSQLSERVER_824

[!INCLUDESQL Server]

Details

Attribute Value
Product name [!INCLUDEssNoVersion]
Event ID 824
Event Source MSSQLSERVER
Component SQLEngine
Symbolic Name B_HARDSSERR
Message Text SQL Server detected a logical consistency-based I/O error: %ls. It occurred during a %S_MSG of page %S_PGID in database ID %d at offset %#016I64x in file ‘%ls’. Additional messages in the SQL Server error log or system event log may provide more detail.

Symptom

You might encounter the following error message in the [!INCLUDEssNoVersion] error log or the Windows Application event log if a logical consistency check fails after reading or writing a database page:

2022-11-02 15:46:42.90 spid51      Error: 824, Severity: 24, State: 2.
2022-11-02 15:46:42.90 spid51      SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:43686; actual 0:0). It occurred during a read of page (1:43686) in database ID 23 at offset 0x0000001554c000 in file 'H:MSSQL16.MSSQLSERVERMSSQLDATAmy_db.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

If a SELECT or DML query runs into this message, the error message is returned to the application, and the database connection is terminated.

Cause

This error indicates that Windows reports that the page is successfully read from disk, but [!INCLUDEssNoVersion] has discovered something wrong with the page. This error is similar to error 823, except that Windows didn’t detect the error. Error 824 usually indicates a problem in the I/O subsystem such as failing disk drives, firmware problems, faulty device drivers, and so on. For more information about I/O errors, see Microsoft SQL Server I/O Basics, Chapter 2.

[!INCLUDEssNoVersion] uses the following Windows APIs to perform the I/O operations: ReadFile, WriteFile, ReadFileScatter, and WriteFileGather. After completing these I/O operations, [!INCLUDEssNoVersion] checks for any error conditions associated with these API calls. If these API calls fail with an Operating System error, then [!INCLUDEssNoVersion] reports Error 823. There can be situations where the Windows API call actually succeeds, but the data transferred by the I/O operation might have encountered a logical consistency problem. These logical consistency problems are reported through Error 824.

The 824 error contains the following information:

  • The database file against which the I/O operation is performed
  • The offset with the file where the I/O operation was attempted
  • The database to which this file belongs
  • The page number that was involved in the I/O operation
  • Was the operation a read or write operation
  • Details about the logical consistency check that failed (the type of check, actual value, and expected value used for this check)

These logical consistency checks are integrity checks performed by [!INCLUDEssNoVersion] to ensure key elements of the data that was involved in the I/O transfer remained intact throughout the I/O operation. The checks include Checksum, Torn Page, Short transfer, Bad Page ID, Stale Read, and Page Audit Failure. The nature of the checks performed vary depending on different configuration options at the database and server level.

The 824 error message usually indicates that there’s a problem with underlying storage system or the hardware or a driver that is in the path of the I/O request. You can encounter this error when there are inconsistencies in the file system or if the database file is damaged.

Resolution

If you encounter error 824, you can try the following resolutions:

  • Review the suspect_pages table in msdb to check if other pages (in the same database or different databases) are encountering this problem.

    SELECT * FROM msdb..suspect_pages
      WHERE (event_type = 1 OR event_type = 2 OR event_type = 3);
  • Check the consistency of the databases that are located in the same volume (as the one reported in the 824 message) using DBCC CHECKDB command. If you find inconsistencies from the DBCC CHECKDB command, use the guidance from Knowledge Base article How to troubleshoot database consistency errors reported by DBCC CHECKDB.

  • If the database that encounters these 824 errors doesn’t have the PAGE_VERIFY CHECKSUM database option turned on, turn on the option immediately. 824 errors can occur for other reasons than a checksum failure but CHECKSUM provides the best option to verify consistency of the page after it has been written to disk. Use this script to identify databases where CHECKSUM option isn’t enabled:

     SELECT * FROM sys.databases
       WHERE page_verify_option_desc != 'CHECKSUM';
  • Review the Windows Event logs for any errors or messages reported from the Operating System or a Storage Device or a Device Driver. If they’re related to this error in some manner, you should address those errors first. For example, apart from the 824 message, you may also notice an event like «The driver detected a controller error on DeviceHarddisk4DR4» reported by the Disk source in the Event Log. In that case, you have to evaluate if this file is present on this device and then first correct those disk errors.

  • Use the SQLIOSim utility to find out if these 824 errors can be reproduced outside of regular [!INCLUDEssNoVersion] I/O requests. SQLIOSim ships with [!INCLUDEsql2008-md] and later versions, so there’s no need for a separate download.

  • Work with your hardware vendor or device manufacturer to ensure:

    • The hardware devices and configuration conform to the I/O requirements of SQL Server.
    • The device drivers and other supporting software components of all devices in the I/O path are updated.
  • If the hardware vendor or device manufacturer provided you with any diagnostic utilities, use them to evaluate the health of the I/O system.

  • Evaluate if there are Filter Drivers that exist on the I/O path of these requests. You can run the following commands to list all filter drivers on the system:

    fltmc filters
    fltmc instances
    • Exclude database and log files from being scanned by such filter drivers. For more information, see Directories and file name extensions to exclude from virus scanning
    • Check if there are any updates to these filter drivers
    • Can these filter drivers be removed or disabled to observe if the problem that results in the 824 error goes away?
  • If you’re running a virtual machine, ensure all virtualization drivers are updated or check with the virtualization vendor for more information.

  • If the problem isn’t hardware-related and a known clean backup is available, restore the database from the backup.

See also

  • Manage the suspect_pages Table (SQL Server)

Multiple Methods to Fix SQL Server Error 824 Severity 24 State 2

“Hello! I am new to this forum. Kindly help me by solving this issue. I have been using SQL Server 2008 R2 for quite some time. Till now there have been no issues and everything was going fine. Only two days back, the SQL Server stopped working. There was no apparent reason and I am still wondering about its cause. When it stopped, an error message appeared that says: ‘SQL Server Detected A Logical Consistency-Based I/O Error: Incorrect Checksum. (Microsoft SQL Server Error 824).’ Please help me to fix this problem. I will be very grateful. Thanks.”

SQL Server is a relational database management system. Due to ease of use and other features, it has gained immense popularity. Therefore, its usage as a database management system is very common. Just because it is full of useful features, does not mean it has no demerits. For SQL Server users, various types of error are not unusual. When SQL database faces any error it usually stops working. So, as an SQL Server user, people have no way to ignore the errors.

For this post, we have chosen to discuss SQL Error 824 Severity 24 State 2. This is a logical consistency related error that occurs frequently to SQL Database users. As readers can see in the beginning, multiple users have asked for the solution to this error. Therefore, we will talk about the symptoms, reasons, and solutions for this error message.

Download Purchase Now

This page-level error usually occurs due to the logical inconsistency of SQL Server. When some issue is detected in the page while performing read/write command. This error appears.

Various information can be found in the SQL error message 824. Once you know the meaning of all parts of the error message, you will have a better understanding of the error.

  • The file belongs to which database
  • I/O operation was performed against which database file
  • Whether the operation was read or write
  • The I/O operation was related to which page number
  • Complete information about the failed logical consistency check (Actual and expected value used for checking, the category of checking, etc.)

Reasons for SQL Error 824

It is not quite easy to determine the exact cause of this error. Many facts can contribute to the occurrence of SQL Server error 824 severity 24 state 2.

  • Insufficient Storage: If the SQL Database does not have sufficient storage space, this error can occur.
  • Driver Issue: The drive (also called hardware) that is located in the I/O path can also be the main culprit behind this error.
  • File System inconsistency: Any sort of inconsistency in the file system can be the cause that user is getting SQL Error 824.
  • Damaged Database: If SQL Server Database is damaged in any way, it will show 824 error while trying to use.
  • Corruption: If the file system is corrupt, SQL Server error message 824 can appear.

How to Fix SQL Server Error 824 Severity 24 State 2

If you have encountered this error message while running SQL Server, you can try these remedial techniques sequentially.

1. Check if any other page (whether in the same or different databases) is having the same error. To do that, review the table in MSDB that contains the suspect pages.
2. You should also check the database consistency with DBCC CHECKDB command. If some issues are found, troubleshoot them. It has to be the database situated in the same volume mentioned in the error 824 error message.
3. If the PAGE_VERIFY CHECKSUM database option is turned off in the database with error 824, turn it on immediately. Though this error can be the result of many reasons, CHECKSUM is the best way to verify page consistency after a page gets written to disk.
4. Go through Windows Event logs to see if any error got reported by Operating System, Device Driver or Storage Device. If the reports or messages are any way connected to error 824, resolve those errors first. Guess, an event like “The driver detected a controller error on DeviceHarddisk4DR4” is present in the event log, being reported by the Disk Source. Then you have to find if the file is located in this device and then resolve the disk errors.
5. There is s built-in utility in SQL Server 2008 named SQLIOSim. It can be used to know if the error can be recreated outside regular SQL I/O requests. Remember to find this utility within SQL Server 2008 and you do not have to download it separately.
6. You have to work in collaboration with hardware vendor or device manufacturer in order to evaluate:

  • If the hardware and their configuration match the requirements of SQL Server IQ.
  • If all hardware (drivers) and software elements of I/O path device are updated or not

7. Proceed to examine I/O path health. If you have any diagnostic utilities provided by the hardware vendor or device manufacturer, use those.
8. Evaluate Filter Drivers existing in I/O requests path that is facing problems:

  • If an update is available for the filter drivers
  • Is it possible to remove or disable filter drivers to check if the error 824 goes away or not

Concluding Words

In this post, we have discussed SQL Server error 824 severity 24 state 2. Since this error can be fatal, users should immediately take necessary steps to get rid of this error. Users can implement the solutions mentioned here and become free from this error. If these methods fail to solve the problem, they can take help of SQL Server database repair utility. This software is capable of solving all types of SQL database corruption.

Frequently Asked Questions

Can I use the DBCC CHECKDB command to repair major level corruption from the SQL database?

You can use the DBCC command to check the damage level of the SQL database. However, it is not able to successfully recover high-level corruption.

What is the best solution to fix SQL database corruption errors?

SQL Recovery is the perfect solution to repair and restore SQL database including all objects like tables, stored procedures, etc.

Since data consistency is a crucial aspect for every user, the server has in-built mechanism which helps to maintain the data consistency at every step. Sometimes, the user may face SQL Server Error 824 while making any SQL query or data modification. It is mainly inconsistency based error that reports an inconsistency during the I/O operation being carried out in the database. When such error is reported by the server, the control automatically comes to the application and the database connection is terminated. The following article is aimed to provide a clear understanding on SQL Server Error 824 and the efficient ways to resolve the error.

What is SQL Serve Error Code 824?

While working on the SQL queries, the user may suddenly face the situation where error 824 is displayed on the screen and database connection is terminated.

The SQL Server error number 824 depicts the following information, which can be useful fir the user during problem resolution:

  • The name of database file for which I/O is inconsistent
  • The file offset for a particular location
  • The actual database name of the inconsistent file
  • The page number for inconsistent I/O operation
  • Details regarding failure of consistency check

Causes of Microsoft SQL Server Error 824

The main reason behind this issue is associated with Windows API that are used by SQL Server to carry out I/O operations. It may be possible that the Windows API have successfully read data to the disk, but the data may have suffered some logical inconsistency. As any kind of logical inconsistency immediately raises an error in SQL, the error code 824 may be the indication of such data inconsistency.

However, other possible reasons behind encountering this error may include:

  • Insufficient disk storage leading to data inconsistency
  • Faulty hardware associated with the I/O devices
  • Highly damaged or corrupted database files
  • Faulty filter drivers in the path of I/O operation
  • Corrupted file system leading to data inconsistency

Resolve SQL Server Error 824

The error 824 can be faced due to many reasons, which have been discussed above. So, the user needs to go through the following measures to resolve the error and resume the efficient working of the SQL Server.

— Run the DBCC CHECKDB command to carry out the consistency check. It scans through the entire database to find its consistency and integrity. Any inconsistency found in the database will be immediately pointed out by this command. Steps can be taken by the user to remove inconsistency.

— Look for the PAGE_VERIFY CHECKSUM database option. It must always be turned on during the database processing as it verifies the data consistency after every write operation on the disk.

— View all suspect_pages of the same database or different database. Check whether the same error is encountered in these pages.

— Check the Windows Event Log to find any generated error from operating system or device driver. If any error is encountered, make sure to fix those errors first.

— Make sure that the device drivers and other associated I/O software are updated.

— Check for the updates of the filter drivers that are used along the path of I/O operation.

— Check whether the filter drivers can be deactivated or not. If user is allowed to disable the drivers, then the filter drivers must be disabled.

Conclusion

Microsoft SQL Server Error 824 is generally reported by the server to indicate any kind of inconsistency faced or I/O devices incompatibility. The various manual ways to resolve the error have been discussed above. The user having a clear understanding of SQL concepts and I/O devices can attempt to resolve the error quickly. An automated third party tool, SQL Recovery allows a complete recovery of the database files without any data loss. However, users are always advised to maintain the database backup at a regular time interval.

Понравилась статья? Поделить с друзьями:
  • Microsoft sql server ошибка 922
  • Microsoft sql server ошибка 15150
  • Microsoft sql server ошибка 15138
  • Microsoft sql server ошибка 1326
  • Microsoft sql server ошибка 1225