码迷,mamicode.com
首页 > 数据库 > 详细

SQL Server出现异常:The system cannot find the file specified

时间:2016-08-12 19:40:03      阅读:347      评论:0      收藏:0      [点我收藏+]

标签:

在查询一个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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!