CarCrazyBen
CarCrazyBen

Reputation: 1136

how to identify "unused" Azure SQL database

We have approximately 2 dozen SQL Database in our Azure portal. I have been asked to evaluate these and see if any are no longer being used and can be dropped. I know how to query their original Quotas and current sizes but I am baffled as to how to query DTUs.

How can I query each DB and see when someone last logged into or initiated any queries?

Thank you!

Upvotes: 0

Views: 643

Answers (1)

Alberto Morillo
Alberto Morillo

Reputation: 15648

The following query should give you an idea if the database has been used based on resource consumption over the last 7 days:

SELECT * 
FROM sys.dm_db_resource_stats
WHERE --database_name = 'AdventureWorksLT' AND
    end_time > DATEADD(day, -7, GETDATE())
ORDER BY end_time DESC;

Upvotes: 1

Related Questions