I was left with a scenario where my Database Initial size is 370GB.
When I checked the EXEC sp_spaceused
, I can see almost 360GB of unallocated space .
Does unallocated space means unused space? If it is unused space, why this is causing the issue for storage?
What options do I have apart from shrinking the .mdf file with 360GB of unallocated space?
Also, as this is a huge database, what level of increments I can mention in the place of 'x' below – can I start from 10,000 MB every time I shrink?
USE Demo
GO
DBCC SHRINKFILE (N ‘Demo’, x)
GO
Is there anything else I should consider in this type of situations?
Would adding a new data file help?
Best Answer
Do you know everything that goes on with this app / database?
Imagine this scenario:
You don't want that to happen, do you?
All that being said, if you're sure that the database:
then by all means, shrink it.
Maybe there was a typo in the filesize when this database was first created (someone tacked a 0 onto the end of "37" - poof, 370 GB database file).
Maybe there was a one-time data load / deletion that will never happen again that caused the DB to grow to this size.
Make sure to give some thought to the "target size" you use with SHRINKFILE if you do this. You say it's only 10 GB of used space, but I wouldn't immediately set it to 10 GB - you are putting some data into this database, right?