patternMinor
Shrinking MDF File
Viewed 0 times
mdfshrinkingfile
Problem
I have a large database on sql server 2005.
After shrinking the data file, the database is still very big: around 9 GB.
Here is some data from sp_spaceused:
can I use
without losing user data on that database?
After shrinking the data file, the database is still very big: around 9 GB.
Here is some data from sp_spaceused:
exec [dbname].dbo.sp_spaceused
reserved |data kb |index_size |unused |
10221976 KB |849240 KB |9367456 KB |5280 KB |can I use
DBCC SHRINKFILE(logic_name_dat, 1000(Mb))without losing user data on that database?
Solution
Yes, you will not lose any user data by shrinking the file. However, the file grows so that the growth operation isn't happening all the time and so by shrinking it you're likely choosing physical size over performance. Furthermore, if it's growing too fast, you should change how it grows and by how much to control it - but it grows at a percentage of the actual size of the file by default.
Remember, all you're doing is asking it to take up less disk space with the buffer portion of the file, it is not going to shrink past what it's able to using the physical data as its limit.
Remember, all you're doing is asking it to take up less disk space with the buffer portion of the file, it is not going to shrink past what it's able to using the physical data as its limit.
Context
StackExchange Database Administrators Q#24449, answer score: 4
Revisions (0)
No revisions yet.