Friday, December 5, 2014

Shrinking tempdb in SQL Server 2008r2

Say you’ve done some fairly complex query on a 6 billion row table. It took 5 hours but it completed. Yay! However, now you have a 200GB tempdb and your drives are all full. Since this was a one-time deal, you want to shrink that tempdb back down to something much smaller.


If you try doing the typical database shrinking stuff but it doesn’t actually finish – in SSMS > System Databases > right click on tempdb > shrink > files > then find the big file and try to shrink it. Check the specified initial size in the database files properties – right-click tempdb > properties > Files > look for initial size column. One file may have a really big initial size specified. Just make that number smaller.





No comments:

Post a Comment