标签:
在查询一个DB中的Table时,SQL Server 抛出异常:
The operating system returned error 2(The system cannot find the file specified.) to SQL Server during a read at offset 0x00000000204000 in file ‘\\ServerName\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).
经过确认,异常消息中涉及的 .ndf 文件存在于指定的路径中,但SQL Server为什么还抛出异常?
原因是Local Server上的DB,有一些数据文件存储在远程Server上,在每次重启Server时,由于Server重启的顺序导致DB不能连接到远程的database files。
此时,选择重启SQL Server Service 就可以解决问题。但是重启Service会导致Instance上的所有DB都要重启,太暴力来,可以使指定的DB处于offline,等待几秒之后,使其Online即可。
use master go alter database database_name set offline -- wait for several seconds alter database database_name set online
参考doc:
DBCC CheckDB The operating system returned error 21(The device is not ready.)
SQL Server出现异常:The system cannot find the file specified
标签:
原文地址:http://www.cnblogs.com/ljhdo/p/5766079.html