Thursday, November 1, 2012

Find the last time all databases were used

select stat.database_id as database_id ,db.name as database_name ,max(stat.last_user_scan) as last_user_scan from sys.dm_db_index_usage_stats as stat join sys.databases as db on db.database_id = stat.database_id group by stat.database_id,db.name order by db.name asc

No comments:

Post a Comment