Tuesday, February 14, 2012

Date & Time when a DB was last accessed

Hi,
Is there a way to find out when a SQL Server 2K database was
last accessed (the date and time) ?
Thanks,
Bujjitry sp_who2

or you can get the 'lastquerybatch' field from the sysprocesses table.

select last_batch from master.dbo.sysprocesses order by last_batch

of course you will need to ignore the very last entry as it will be you.|||Hi Paul,

Thanks for your reply.

Sysprocesses is a dynamic table and if I have to keep reading that table to find out info reg. dbs being accessed, I have to keep reading it every minute. Further, I will not be able to get info on dbs that are not being accessed by any processes if I read sysprocesses.

I wanted to know if SQL Server has a feature that stores the date and time a database was last accessed.

Thanks.

No comments:

Post a Comment