I have a SQL Server 2008 DB. I store mainly text data in it, but also inserted some blobs in it. The size of the DB increased. Now I deleted the blobs, but it seems that the size of the DB stayed the same. How can I make it shrink?

link|improve this question
1  
Since this really has nothing to do with programming, you should ask it over at Serverfault.com where you have an audience of sysadmins and DBA's - they know this kind of stuff by heart... – marc_s Feb 9 '11 at 12:22
feedback

migrated from stackoverflow.com Feb 11 '11 at 0:21

This question came from our site for professional and enthusiast programmers.

5 Answers

There is a Shrink option available in the context menu of the database in the SQL Server Management Studio.

More information

link|improve this answer
feedback

There is an option to shrink either database or database file. You right-click on the database in management studio -> tasks -> Shrink

link|improve this answer
feedback

from BOL:

DBCC SHRINKDATABASE (UserDB, 10); 
GO

where UserDB is your database name and 10 is the percentage of free space you want to leave.

Using SHRINKDATABASE has performance implications, you can read about them from this question on StackOverflow.

link|improve this answer
feedback

How big is yours t-log file,maybe you only need shrink t-log,it doesn't matter if your delete some of rows from your databse,because that transactions will probably go to t-log.

link|improve this answer
feedback

The DB dosn't shrink automaticaly, but you have now some free space in de file. So if you will save some text in the future, the database the database will grow again when no free space is available any more.

If you really what to shrink it: right click on DB \ tasks \ shrink will to what you want.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.