How to drop #Temp_______hex tables?

221 views Asked by At

Our Temp DB has grown very large and we'd like to clean it up.

When i open the tempdb, temptables folder, I notice a like of tables named like so:

#Somename________hexcode
#Someothername________hexcode

etc...

we know we can delete them because those aren't being used. When I query the sysobjects they are listed. But when I try to drop them, it says they don't exist.

Any ideas on how to remove those would be welcome. Thank you.

1

There are 1 answers

0
Aaron Bertrand On

You can't drop #temp tables created by someone else's session. You can clean up tempdb by cycling the SQL Server service or waiting for those sessions to go out of scope so the tables can be destroyed (there's a background process for doing this). It may not be happening if you're hitting an obscure bug in certain versions with the Temp Tables for Destruction counter.