TempDB full how can i resolve?

Sanjay Kumawat 20 Reputation points
2023-07-07T03:28:14.6833333+00:00

TempDB full how can resolve without restart services?

SQL Server Other
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-07-07T04:56:06.91+00:00

    Restarting SQL Server service is an easy way, because TempDB get recreated on initial file size. But in a 24/7 enviroment hardly possible.

    You can try to shrink the database, see
    https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkdatabase-transact-sql?view=sql-server-ver16

    https://learn.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-database?view=sql-server-ver16

    Don't work always. Other option is to add additional database file on disk with enough free space.

    See https://learn.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database?view=sql-server-ver16


  2. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-07-07T09:00:14.05+00:00

    If tempdb is genuinely full, you can shrink it.

    But it is not common to see tempdb to be full for a longer period of time, as the cause is some operation that requires workspace in tempdb, and when that operation fails, the space it has allocated will be released. In this case, you can try tio shrink tempdb, but what's the point? It's not full any more, so there is no issue.

    If tempdb is full and remains full, this would be because someone has created a large table and is clinging to that table. In that case, you would need to find that table and drop it. (And possibly talk kindly with the user behind it.)

    0 comments No comments

  3. ZoeHui-MSFT 41,491 Reputation points
    2023-07-07T09:11:50.49+00:00

    Hi @Sanjay Kumawat,

    You may also check Shrink the tempdb database.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.