Last login date or read operation in SQL Server database?

Suppose I have a SQL Server with 100 databases. How can I find out which ones are actually used? (without turning them off and without waiting for complaints) So "were available last week" or something like that.

I tried data dates, but they don't seem to represent this, and the databases do not seem to have a property that also reflects this.

+3
source share
3 answers

Take a look sys.dm_db_index_usage_stats. The columns last_user_seek / last_user_scan / last_user_lookup / last_user_update represent the last time the corresponding index was used (heap or b-tree). These values ​​are reset after the server reboots, so you should check them after the server has started for a sufficient time.

+2
source

This SQL query was useful to me.

select max (login_time)as last_login_time, login_name from sys.dm_exec_sessions
group by login_name;
+4
source

You may be able to get this information using some performance-related system views.

http://technet.microsoft.com/en-us/library/ms187743.aspx

0
source

Source: https://habr.com/ru/post/1725687/


All Articles