Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

I need script related to databases Expand / Collapse
Posted Wednesday, September 8, 2010 11:23 PM


Group: General Forum Members
Last Login: Wednesday, August 6, 2014 10:46 PM
Points: 12, Visits: 84
Can any one help me here....

I need a script to find out the users and last usage of the database.
Here i know the query to get the details after restart of sqlserver.But i dont want this.
I need the last usage date and list of users on all databases in a instance before the restart of sqlserver?
Please help me...

Thanks in Advance....
Post #982813
Posted Thursday, September 9, 2010 12:50 AM


Group: General Forum Members
Last Login: Yesterday @ 7:24 AM
Points: 2,156, Visits: 5,779
As far as I know the serve doesn't store this information. You could have a trigger on LOGON, that will writes the login name, date and database name each time that someone logs on.


To know how to ask questions and increase the chances of getting asnwers:

For better answers on performance questions, click on the following...
Post #982849
Posted Thursday, September 9, 2010 3:57 AM



Group: General Forum Members
Last Login: Yesterday @ 3:16 PM
Points: 13,896, Visits: 35,839
i love logon traces, but for tracking/ accessing specific databases, i don't think it would work;, a logon trigger occurs before a user connects to a in the trigger you wouldn't find a database reference;
you'd want to use a server side trace for DML i htink instead, so you can track/roll up info from the trace results.


help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #982937
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse