After months of perfectly flat disk usage, my tempdb file suddenly grew by several gigs over the weekend. Nobody at the company is aware of anything that might have changed.
When I checked the tempdb database, it had only a few very small tables, whose names were strings of hex digits.
In searching for the cause, I found the following message repeated every few minutes for several days in the event log:
DBCC SHRINKDATABASE for database ID 2 is waiting for the snapshot transaction
with timestamp 51743762409 and other snapshot transactions linked to timestamp
51743762409 or with timestamps older than 51801253540 to finish.
I can't find any possible way that DBCC SHRINKDATABASE could have been run by anybody on the tempdb (which is DB ID 2). Microsoft's own documentation says that SHRINKDATABASE should never be run on tempdb while it's online, so I can't imagine that SQL server is running it itself.
I'm trying to figure out:
- What could have caused such sudden rapid growth in the tempdb file? I'm not aware of any code that uses temporary tables or declares table variables on this server. What else uses the tempdb file?
- Why is DBCC SHRINKDATABASE running on tempdb at all, and why is it failing?