Link to home
Create AccountLog in
Avatar of Richard Lloyd
Richard Lloyd

asked on

I cannot shrink my MSSQL TempDB

I have a MSSQL instance (14.0.1000.169) that has various databases.

My tempdb seems to have grown to 50GB and I and trying to shrink the size as it is taking too much disk space. 99% of the allocated space is free, see screenshot.User generated image
I have tried using Management Studio to shrink the files and the database, I have restarted the MSSQL service and have performed a hardware reboot of the server. Nothing seem to reduce the file sizes.

When I try
DBCC SHRINKDATABASE(tempdb, 10);

I get the following:
DBCC SHRINKDATABASE: File ID 1 of database ID 2 was skipped because the file does not have enough free space to reclaim.
DBCC SHRINKDATABASE: File ID 3 of database ID 2 was skipped because the file does not have enough free space to reclaim.
DBCC SHRINKDATABASE: File ID 2 of database ID 2 was skipped because the file does not have enough free space to reclaim.

Can anyone suggest a another way to reduce the amount od space the temdb is taking up?


Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

If TempDB grew to 50GB then it means this space was necessary in the past. The TempDB returns into the initial size after SQL Server service restart. You may set the initial size in TempDB properties:
User generated image
Avatar of Richard Lloyd
Richard Lloyd

ASKER

Thanks. I have tried this, but it did not work.

I'll try it again!
SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks. I'll give it a try later when I have less users on the system.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
And I agree, if there are actively working users in the TempDB then the size update may be more complicated task...
OK. I'm going to restart my server completely this evening.