TempDB Size and Monitoring

I was working on a requirement recently to monitor the TempDB to check on the space it was occupying. The requirement was to monitor and identify the TempDB space occupied by applications.

To find out the space used by all the TempDB files, use this simple query

SELECT SUM(size)*1.0/128 AS [TempDBSizeMB]
FROM tempdb.sys.database_files

However to monitor the TempDB size, I found a nice article by Sunil Agarwal called TempDB Monitoring and Troubleshooting: Out of Space to identify TempDB space allocations. Here’s the output that shows the allocations in TempDB by the currently running apps.

image

You can download the query here

No comments:

Post a Comment