SQL Server - Shrink tempdb without sql server restart

13 January,2011 by Jack Vamvas

Despite best efforts to size a tempdb ,sometimes the tempdb expands to a size as big as the drive. Because the drive is full the tempdb can no longer expand. This triggers a situation in a monitoring framework. A quick solution is required, to shrink down the tempdb . Following are 2 different methods I use , that don’t require a SQL Server restart. 

It is important to focus on the reason for continious TEMDB growth , as the problem will just reappear

 If I receive consistency errors , than I resort to a SQL Server restart , depending on the situation

 DBCC DHRINKFILE will allow you to decrease to a size smaller than the original size



Use tempdb


--shrink the main data file

DBCC shrinkfile (tempdev,’)


--shrink the main log file

DBCC shrinkfile (templog, ’)


---e.g DBCC shrinkfile (tempdev, 5000)




 --e.g DBCC SHRINKDATABASE(tempdb,20)

 Related Posts

TempDB performance and strategy checklist

SQL Server – tempdb and solid state drives

Author: Jack Vamvas (http://www.sqlserver-dba.com)


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on SQL Server - Shrink tempdb without sql server restart

sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer