0

In my SQL Server, I have 9 user databases and I would like to find out which user database is using how much resources in tempdb, which database is using more and which less, and furthermore, I would like to store the records.

While investigating the issue, I found all solutions on tempdb auto-growth tracking.

Since sys.dm_db_session_space_usage and sys.dm_db_task_space_usage DMVs don't keeps historical data, how can I get database-wise tempdb usage information?

Any suggestions are highly appreciated.

1

1 Answer 1

0

Create a Custom Logging Table: First, create a table in a database where you want to store the tempdb usage information.
Set Up Extended Events: You can use SQL Server's Extended Events to capture the tempdb usage for each database Schedule the Data Retrieval: Create a SQL Server Agent job or use another scheduling mechanism to run the data retrieval script periodically, such as every minute, hour, or as needed.

Sign up to request clarification or add additional context in comments.

2 Comments

AI generated content is currently banned on Stack Overflow. Please read the AI Policy for more information.
I also tried Extended Events. But all events are related to file size change or auto-growth or page latch. But I need very raw data that which user database is using how much in tempdb regularly, may be for a range of one week.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.