• If you have snapshot row-versioning in any of your user DBs, this very fact will prevent you from shrinking tempdb. I had to shrink such a tempdb this week, trick was to take user DB out of that mode temporarily while I shrank tempdb. Here's script I used:

    --check which dbs are in snapshot isoation mode

    select name, is_read_committed_snapshot_on, snapshot_isolation_state, snapshot_isolation_state_desc, *

    from sys.databases

    order by 1

    go

    --take DB out of this mode temprarily in order to shrink it

    alter database MY_USER_DB set READ_COMMITTED_SNAPSHOT off with rollback after 30 seconds

    go

    use tempdb

    go

    --select 16* 1024 --(convert GB to MB)

    dbcc shrinkfile (tempdev, 16384)

    go

    select (size*8)/1024 as FileSizeMB from sys.database_files--check new size

    go

    --restore original DB settings

    alter database MY_USER_DB set READ_COMMITTED_SNAPSHOT on with rollback after 30 seconds

    go