Shrink tempdb

  • Hi all,

    I have a tempdb that is set to initial size of 30gb (single file)

    its never using more than 1-3%

    If i run

    ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'tempdev', SIZE = 2048MB , FILEGROWTH = 512MB )

    It runs successfully, but doesnt shrink the file,

    If i run

    DBCC SHRINKDATABASE (tempdb, TRUNCATEONLY);

    I get that min size is 3054776

    Which i guess is down to the fact that it wont shrink down, so its just releasing space from the inital size.

  • You can't go below the initial size, so you'll have to set that initial size lower. Here is an article from Microsoft that discusses most of the details. There's also an old thread from SQL Server Central that discusses some of other issues you might run into.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Did you restart the instance after runing the alter database statement? If you did, tempdb should now start with the file size that statement specified.

    Also, it may be that the size of tempdb is not correctly reported after shrink - this used to be true way back when, don't know whether it still is. But I think what you want to do is alter the startup size, not just the current size, so maybe what shrink does is irrelevant.

    Tom

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply