加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQLServer 无法打开物理文件 "path\XX.mdf"。操作系

发布时间:2020-12-12 13:02:32 所属栏目:MsSql教程 来源:网络整理
导读:迁移数据库文件后,使其在线时无法访问: USE master GO ALTER DATABASE test SET MULTI_USERGOALTER DATABASE test SET ONLINEGO 控制台输出信息: 消息 5120,级别 16,状态 101,第 1 行无法打开物理文件 "D:testtest.mdf"。操作系统错误 5:"5(拒绝访问

迁移数据库文件后,使其在线时无法访问:

USE master   
GO  
ALTER DATABASE test SET MULTI_USER
GO
ALTER DATABASE test SET ONLINE
GO


控制台输出信息:

消息 5120,级别 16,状态 101,第 1 行
无法打开物理文件 "D:testtest.mdf"。操作系统错误 5:"5(拒绝访问。)"。
消息 5120,级别 16,状态 101,第 1 行
无法打开物理文件 "D:testtest_log.ldf"。操作系统错误 5:"5(拒绝访问。)"。
消息 945,级别 14,状态 2,第 1 行
由于文件不可访问,或者内存或磁盘空间不足,所以无法打开数据库 'test'。有关详细信息,请参阅 SQL Server 错误日志。
消息 5069,级别 16,状态 1,第 1 行
ALTER DATABASE 语句失败。

错误日志信息:

Setting database option MULTI_USER to ON for database test.
Starting up database 'test'.
错误: 17204,严重性: 16,状态: 1。
FCB::Open failed: Could not open file D:testtest.mdf for file number 1.  OS error: 5(拒绝访问。).
错误: 17204,严重性: 16,状态: 1。
FCB::Open failed: Could not open file D:testtest_log.ldf for file number 2.  OS error: 5(拒绝访问。).
错误: 5105,严重性: 16,状态: 1。
A file activation error occurred. The physical file name 'D:testtest_log.ldf' may be incorrect. Diagnose and correct additional errors,and retry the operation.
错误: 928,严重性: 20,状态: 1。
During upgrade,database raised exception 945,severity 14,state 2,address 00000000009F3BD7. Use the exception number to determine the cause.


解决方法:

在数据库所在的目录中,右键文件夹——属性——添加SqlServer服务的启动账户——勾选“完全控制”——确定退出。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读