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
Author
Message
Posted Wednesday, September 8, 2010 11:23 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

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....
GLNP
Post #982813
Posted Thursday, September 9, 2010 12:50 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 7:19 AM
Points: 2,112, Visits: 5,477
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.

Adi


--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #982849
Posted Thursday, September 9, 2010 3:57 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:53 PM
Points: 12,896, Visits: 32,095
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 database...so 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.


Lowell

--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