MSSQLSERVER 错误 823MSSQLSERVER error 823

适用于: 是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: YesSQL Server NoAzure SQL Database NoAzure Synapse Analytics (SQL DW) NoParallel Data Warehouse

详细信息Details

产品名称Product Name SQL ServerSQL Server
事件 IDEvent ID 823823
事件源Event Source MSSQLSERVERMSSQLSERVER
组件Component SQLEngineSQLEngine
符号名称Symbolic Name B_HARDERRB_HARDERR
消息正文Message Text 在文件 '%ls' 中、偏移量为 %#016I64x 的位置执行 %S_MSG 期间,操作系统已经向 SQL Server 返回了错误 %ls。The operating system returned error %ls to SQL Server during a %S_MSG at offset %#016I64x in file '%ls'. SQL Server 错误日志和系统事件日志中的其他消息中可能有更详细的信息。Additional messages in the SQL Server error log and system event log may provide more detail. 这是一个威胁数据库完整性的严重系统级错误条件,必须立即纠正。This is a severe system-level error condition that threatens database integrity and must be corrected immediately. 请运行一次完整的数据库一致性检查 (DBCC CHECKDB)。Complete a full database consistency check (DBCC CHECKDB). 此错误可能是由多种因素导致的;有关详细信息,请参阅 SQL Server 联机丛书。This error can be caused by many factors; for more information, see SQL Server Books Online.

说明Explanation

SQL Server 使用 Windows API(例如 ReadFileWriteFileReadFileScatterWriteFileGather)执行文件 I/O 操作。SQL Server uses Windows APIs (for example, ReadFile, WriteFile, ReadFileScatter, WriteFileGather) to perform file I/O operations. 执行这些 I/O 操作后,SQL Server 检查所有与这些 API 调用相关联的错误条件。After performing these I/O operations, SQL Server checks for any error conditions associated with these API calls. 如果 API 调用因操作系统错误而失败,则 SQL Server 报告错误 823。If the API calls fail with an Operating System error, then SQL Server reports Error 823.

823 错误消息包含以下信息:The 823 error message contains the following information:

  • 对其执行 I/O 操作的数据库文件The database file against which the I/O operation was performed
  • 尝试执行 I/O 操作的文件中的偏移。The offset within the file where the I/O operation was attempted. 这是距文件开头的物理字节偏移。This is the physical byte offset from the start of the file. 如果将此数字除以 8192,将得到受错误影响的逻辑页码。Dividing this number by 8192 will give you the logical page number that is affected by the error.
  • I/O 操作是一个读取请求还是写入请求Whether the I/O operation is a read or write request
  • 操作系统错误代码和括号中的错误说明The Operating System error code and error description in parentheses

操作系统错误: 读取或写入 Windows API 调用失败,SQL Server 遇到与 Windows API 调用相关的操作系统错误。Operating system error: A read or write Windows API call is not successful, and SQL Server encounters an operating system error that is related to the Windows API call. 下面是 823 错误的示例消息:The following message is an example of an 823 error:

Error: 823, Severity: 24, State: 2.
2010-03-06 22:41:19.55 spid58 The operating system returned error 1117 (The request could not be performed because of an I/O device error.) to SQL Server during a read at offset 0x0000002d460000 in file 'e:\program files\Microsoft SQL Server\mssql\data\mydb.MDF'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe, system-level error condition that threatens database integrity and must be corrected immediately. It is recommended to complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

在错误消息中,你可能会在与文件相关联的数据库上看到 DBCC CHECKDB 语句的错误。You may or may not see errors from the DBCC CHECKDB statement on the database that is associated with the file in the error message. 出现 823 错误时,你可运行 DBCC CHECKDB 语句。You can run the DBCC CHECKDB statement when you see an 823 error. 如果 DBCC CHECKDB 语句未报告任何错误,则可能会出现间歇性系统问题或磁盘问题。If the DBCC CHECKDB statement does not report any errors, you probably have an intermittent system problem or a disk problem.

使用跟踪标志 818 时,可能会向 SQL Server 错误日志文件中写入 823 错误的其他诊断信息。Additional diagnostic information for 823 errors may be written to the SQL Server error log file when you use trace flag 818. 有关详细信息,请参阅 KB 826433:添加了其他 SQL Server 诊断以检测未报告的 I/O 问题For more information, see KB 826433: Additional SQL Server diagnostics added to detect unreported I/O problems

原因Cause

823 错误消息通常指示基础存储系统或硬件出现问题,或 I/O 请求路径中的驱动程序出现问题。The 823 error message usually indicates that there is 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. 如果读取了文件,SQL Server 在返回 823 之前已重试了四次该读取请求。In the case of a file read, SQL Server will have already retried the read request four times before it returns 823. 如果重试操作成功,则查询就不会失败,但会将消息 825 写入错误日志和事件日志。If the retry operation succeeds, the query will not fail but message 825 will be written into the ERRORLOG and Event Log.

用户操作User Action

  • 查看 MSDB 中的 suspect_pages 表中是否存在遇到此问题的其他页(在同一数据库或不同数据库中)。Review the suspect_pages table in MSDB for other pages that are encountering this problem (in the same database or different databases).
  • 使用 DBCC CHECKDB 命令检查位于同一卷(823 消息中所报告的卷)上的数据库的一致性。Check the consistency of databases located on the same volume (as the one reported in the 823 message) using DBCC CHECKDB command. 如果发现 DBCC CHECKDB 命令不一致,请使用如何解决 DBCC CHECKB 报告的数据库一致性错误中的指南。If you find inconsistencies from the DBCC CHECKDB command, use the guidance from How to troubleshoot database consistency errors reported by DBCC CHECKB.
  • 查看 Windows 事件日志中是否存在从操作系统或存储设备/设备驱动程序中报告的错误或消息。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 are related to this error in some manner, address those errors first. 例如,除了 823 消息以外,你还可能会注意到事件日志中的磁盘源报告的“驱动程序检测到 \Device\Harddisk4\DR4 上的控制器错误”之类的事件。For example, apart from the 823 message, you may also notice an event like "The driver detected a controller error on \Device\Harddisk4\DR4" 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.
  • 使用 SQLIOSim 实用工具确定这些 823 错误是否可在常规 SQL Server I/O 请求之外重现。Use the SQLIOSim utility to find out if these 823 errors can be reproduced outside of regular SQL Server I/O requests. SQLIOSim 实用工具随 SQL Server 2008 及更高版本进行装配,因此无需单独下载。The SQLIOSim utility ships with SQL Server 2008 and later versions so there is no need for a separate download. 通常可以在 C:\Program Files\Microsoft SQL Server\MSSQLxx.MSSQLSERVER\MSSQL\Binn 文件夹中找到它。You can typically find it in your C:\Program Files\Microsoft SQL Server\MSSQLxx.MSSQLSERVER\MSSQL\Binn folder.
  • 与硬件供应商或设备制造商合作,确保:Work with your hardware vendor or device manufacturer to ensure
    • 硬件设备和配置符合 SQL Server 的 I/O 要求The hardware devices and the configuration conforms to the I/O requirements of SQL Server
    • I/O 路径中所有设备的设备驱动程序和其他支持软件组件都是最新的The device drivers and other supporting software components of all devices in the I/O path are up to date
  • 如果硬件供应商或设备制造商为你提供了一些诊断实用工具,请用这些实用工具评估 I/O 系统的运行状况If the hardware vendor or device manufacturer provided you with any diagnostic utilities, use them to evaluate the health of the I/O system
  • 评估在遇到问题的这些 I/O 请求的路径中是否存在筛选器驱动程序Evaluate if there are filter drivers that exist in the path of these I/O requests that encounter problems.
    • 检查这些筛选器驱动程序是否有任何更新Check if there are any updates to these filter drivers
    • 能否删除或禁用这些筛选器驱动程序,以观察导致 823 错误的问题是否消失Can these filter drivers be removed or disabled to observe if the problem that results in the 823 error goes away