SQL server attche数据文件失败

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文件位置变成你新的位置

你可能感兴趣的:(SQL Server)