August 27, 2008 at 12:40 am
Hi All,
can we find what user has accessed the database, at what time and how much time he has accessed the database ?
Raghavender Chavva
Thank You.
Regards,
Raghavender Chavva
August 27, 2008 at 12:53 am
Hi,
1.Create a function that returns a list of values that represent the login times for the given user.
2.Create a function that returns a numeric value that represents the number of hours that a user has logged for the current month.
Shree
August 27, 2008 at 1:06 am
There are 2 ways that I can think about:
The first way is simply to use profiler and catch only the login and logout events. Then you can insert the data into a table an analyze it.
The second way is to query sys.dm_exec_sessions in a job that runs every minute. You can check the login time for each loginID. From sys.dm_exec_sessions you’ll be able to know which login just logged in and which login continued working. Of course you’ll have to store in a table the previous results of your query, so you’ll know which login logged out.
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/
August 27, 2008 at 5:39 am
It is possible using trace as well in 2000.but in 2005 default trace is already running.by using below command you can find our SELECT *
FROM fn_trace_gettable
('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc', default)
GO
(Refernce BOL)
September 21, 2008 at 5:20 pm
Thank you,
It worked for me.
Raghavender Chavva
Thank You.
Regards,
Raghavender Chavva
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply