If we want to monitor when the last action performed on the database? Or to find database last accessed time? The below query is used to monitor those kind of activities on database.
Query
SELECT DISTINCT db_name(sp.dbid) as sysdbname,
sp.loginame, sp.hostname, sp.login_time, sp.last_batch, sp.status, sp.cmd
FROM master..sysprocesses sp
No comments: