I want to know the date and time of each (or specific) databases which are being used last time.
Any help would be appreciated.
Aron Bertrang may have something you may be interested in on his sql blog http://sqlblog.com/blogs/aaron_bertrand/archive/2008/05/06/when-was-my-database-table-last-accessed.aspx
Thank you very much for your quick turn around...
In the same way can we know which user has accessed last time along with date and time?
For such scenario is the best choice the SQL Server Auditing, but this is available only in SQL server 2008. (you can see description here http://msdn.microsoft.com/en-us/library/cc280386.aspx
For SQL server 2005 or earlier I suggest write your own auditing. You can use triggers for the audits. Unfortunately, there are no select triggers, thus if you want to log also selects then the only way is to deny direct access to the tables and views and use stored procedures for all the operations. Inside the stored procedures you can implement event logging of the selects.
Other solution could be using the SQL Trace and setup audition of object access. See more on http://msdn.microsoft.com/en-us/library/ms191006.aspx
Thank you very much for the information.
Viewing 5 posts - 1 through 4 (of 4 total)