Getting Last READ/WRITE/SEEK/SCAN date time of each database

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 509
--Getting Last READ/WRITE/SEEK/SCAN date time of each database in an SQL instance
SELECT a.database_id, b.name, MAX(a.last_user_seek) last_user_seek, MAX(a.last_user_scan) last_user_scan
,MAX(a.last_user_lookup) last_read, MAX(a.last_user_update) last_write
FROM sys.dm_db_index_usage_stats AS a INNER JOIN
sys.sysdatabases AS b ON a.database_id = b.dbid
GROUP BY a.database_id, b.name

Comments or Responses

Login to post response