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: Wednesday, September 9, 2015 1:35 AM
Points: 2,153, Visits: 5,745
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: Today @ 2:07 PM
Points: 13,784, Visits: 35,423
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.


--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #982937
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse