Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'database' is compressed but does not reside in a read-only database or filegroup

Tags:

sql-server

Q&A: A user of our software reported a SQL Server Error. The software had been running fine previously. The error is:

The file at C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\DATA{database}.mdf is compressed but does not reside in a read-only database or filegroup. The file must be decompressed. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

What's the fix please?

Posting as a Q&A as I couldn't find a step-by step answer on StackOverflow and Windows is now recommending file compression when your disk is nearly full.

like image 398
JsAndDotNet Avatar asked Apr 02 '19 14:04

JsAndDotNet


People also ask

What is filegroup in database?

The filegroup contains the primary data file and any secondary files that aren't put into other filegroups. User-defined filegroups can be created to group data files together for administrative, data allocation, and placement purposes.

Can databases be compressed?

Database compression is a set of techniques that reorganizes database content to save on physical storage space and improve performance speeds. Compression can be achieved in two primary ways: Lossless: Original data can be fully reconstructed from the compressed data.

What is Filestream filegroup in SQL Server?

A FILESTREAM filegroup is a special filegroup that contains file system directories instead of the files themselves. These file system directories are called data containers. Data containers are the interface between Database Engine storage and file system storage.

Are SQL databases compressed?

The SQL Server data compression reduces the amount of physical disk space required to store data and the amount of disk I/O is saved by performing SQL Server data compression.


1 Answers

As stated here, SQL Server databases are not supported on compressed volumes.

In this case, Windows had recommended compression to make more room on their hard drive, so they did just that.

The fix was:

  1. Go to 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL' ('MSSQL14.SQLEXPRESS' might be different, depending on your SQL Server Version).
  2. Right click the 'DATA' folder (i.e. the folder that contains .mdf files)
  3. Choose 'Properties'
  4. Click the 'Advanced' button
  5. Uncheck the 'Compress contents to save disk space' checkbox
  6. Click 'Ok'.
like image 180
JsAndDotNet Avatar answered Oct 12 '22 11:10

JsAndDotNet