|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, December 20, 2012 6:11 AM
Points: 2,
Visits: 104
|
|
The following issue occurred: The datafile of the database has an initial size of 48GB while the data only occupies 29GB of the file. DBCC SHRINKFILE only shrinks the MDF file to the initial size, but doesn't release the space held by the initial filesize or decreases the size of the datafile. Database files are not meant to be shrunk, however sometimes the "overhead" of free space claimed is not in scope with the size of the database.
Following steps solved the issue for me: * Make a full database backup, of the database you want to change. * Make sure you have sysadmin rights and bring the database into restricted user mode. * Select tasks --> shrink --> files from the database menu. * Choose the “Reorganize pages before...” option and enter the desired file size. Make sure the file size is larger than the minimum needed space for the data. * Check the properties of the database files and decrease the initial size of the datafile (if not already changed) * After finishing bring the database back in Multi User mode.
This shrinks the files to the desired file size, without having to migrate data between datafiles (empty file solution) or having to bring the database or instance down.
As any DBA can tell you, be aware of (and know) what you're doing, before you start an action like this. It's not certain this will solve a similar issue for anyone else, but it's worth to investigate.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 6:45 AM
Points: 5,266,
Visits: 11,196
|
|
.and then reindex your database, it will be badly fragmented following the shrink.
---------------------------------------------------------------------
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 5:15 AM
Points: 6,861,
Visits: 8,046
|
|
|
|
|