question

Raj More avatar image
Raj More asked

Tables dropped - must give up space to other databases

I have a dev database that is 220G. It is set to simple recovery. I truncated some tables that we did not need for development so now I have 120GB free space inside this dev database. However, I need space for other databases to grow on the same server and I want to give up as much as I can of this 120GB back to the OS. How do I give the space back to the OS?
sql-server-2008-r2fragmentationdisk-space
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Håkan Winther avatar image
Håkan Winther answered
I guess this is the only case when you should shrink your datafiles DBCC SHRINKFILE ('filename', 120000) GO Remember to rebuild your indexes when you'r done, and use the SORT\_IN_TEMPDB option to save space in your database
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.