SQL server attche数据文件失败

本文将指导您如何解决在使用SQL Server时遇到的两个常见错误:数据库无法打开(错误5118)和物理文件无法打开(错误5:5)。通过调整数据库文件的属性和配置SQL Server属性,您可以成功解决问题,允许在压缩驱动器上保存和附加数据库。

1. 关于下面的错误

The file "G:\..........\abc.mdf" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.
Could not open new database 'Dotnet67'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 5118)

 

把数据文件的属性的compress选项的勾去掉就可以解决。

Basically I wanted to keep the db file on a drive other than the default operating system drive. But as my other drives are compressed, so I was having problem. But I can still keep the db file on the compressed drive and attach it in sql server. This can be done by going in the properties of the folder that contains the db file. Right click the folder and select properties. Then click Advanced. There un-check the option "Compress contents to save disk space". In this way I am able to keep the db file on a compressed drive and still attach it in sql server.

 

2. Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120

打开SQL Server Configuration Mananger窗口,右键单击SQLServer属性,然后点advanced,把数据的log文件位置变成你新的位置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值