您的位置:首页 > 数据库

Microsoft SQL Server, Error: 823 一次真实的经历

2015-12-18 15:43 441 查看
1,Case Description

有Dev skype 我,说在使用SSMS 打开DB的时候,报错

“The operating system returned error 59(An unexpected network error occurred.) to SQL Server during a read at offset 0x00000000474000 in file '\\Serveryyy\\xxxx.ndf'. 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. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. (Microsoft SQL Server, Error: 823)”

Error Number:823, 823错误说明Sql Server 在向OS申请某个页面的时候遇到 Windows 读取或写入请求失败。823错误是发出一个page 读写请求时发生的,和sql server 本身无关,通常是物理文件损坏导致此错误,如果真的是物理文件损坏,那就很难修复了。

这个Case 是由于 “An unexpected network error occurred” 导致的,我使用Windows Foler manger能够打开远程Serveryyy上的文件夹,这说明不是network的问题。错误消息中,已经提示使用DBCC CheckDB来 做一个database consistency check,我在做dbcc checkdb的时候,不能将db设置single user access mode,报的错误信息和上述相同,甚是棘手,无措ing。

2,查看Windows log, 在 Event Viewer中,看到在发生上述错误之前,Windows log 中还记录以下类型的错误

“The operating system returned error 2(The system cannot find the file specified.) to SQL Server during a read at offset 0x00000795e94000 in file '\\Serveryyy\\xxxx.ndf'. 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. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

唯一不同的是Error number和对error的描述,从Microsoft Support 中找到如下描述

SQL Server I/O and Windows API

SQL Server 2000 uses standard Windows API calls, such as ReadFile, ReadFileScatter, WriteFile, and WriteFileGather, to perform I/O with its database files. When SQL Server 2000 uses the Windows API calls, the file has already been opened successfully, or SQL Server 2000 would not try to read from it or write to it. Therefore, if a Windows API call is not successful and if the error is anything other than the operating system error 6 ("Invalid Handle"), the error is likely being raised in Windows or by a lower-level software component, such as a device driver. Because the operating system error 6 is an invalid handle, the problem may occur if SQL Server is using an invalid handle to make a Windows API call. However, this may still be a system problem.
For example, if you encounter the following error message in the SQL Server Errorlog file, SQL Server encountered operating system error 2 when it uses a Windows API call to write to the tempdb primary database file:

Error: 823, Severity: 24, State: 4 I/O error 2(The system cannot find the file specified.) detected during write at offset 0x00000000284000 in file 'D:\Program Files\Microsoft SQL Server\MSSQL\data\tempdb.mdf'

Because SQL Server has already successfully opened the file and did not receive an “Invalid Handle” error, the error is likely being raised in a lower-level kernel software component, such as the file system or a device driver. This problem does not indicate a problem in SQL Server, and it must be investigated as an issue with the file system or a device driver that is associated with the file.

对Solution的描述模棱两可,“This problem does not indicate a problem in SQL Server”,查看msdb.dbo.suspect_pages,没有返回任何数据行,可能不是一个problem,稍感欣慰。

select *
from msdb.dbo.suspect_pages


The suspect_pages table is used for maintaining information about suspect pages, and is relevant in helping to decide whether a restore is necessary. The suspect_pages table resides in the msdb database and was introduced in SQL Server 2005.

A page is considered "suspect" when the SQL Server Database Engine encounters one of the following errors when it tries to read a data page:

An 823 error that was caused by a cyclic redundancy check (CRC) issued by the operating system, such as a disk error (certain hardware errors)

An 824 error, such as a torn page (any logical error)

我在windows Log 中看到 server 有一些update的,安装过一些更新包,如下图,



所以,我猜测server可能需要restart ,restart之后,问题解决。

参考文档:
https://support.microsoft.com/en-us/kb/828339 https://support.microsoft.com/en-us/kb/2015755 https://msdn.microsoft.com/en-us/library/ms191301(v=sql.110).aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: