User access log to SQL Server
-
08-06-2019 - |
Question
I need to get a log of user access to our SQL Server
so I can track average and peak concurrency usage. Is there a hidden table or something I'm missing that has this information for me? To my knowledge the application I'm looking at does not track this at the application level.
I'm currently working on SQL Server 2000
, but will moving to SQL Server 2005
shortly, so solutions for both are greatly appreciated.
Solution
In SQL Server 2005, go to tree view on the left and select Server (name of the actual server) > Management > Activity Monitor. Hope this helps.
OTHER TIPS
- on
2000
you can usesp_who2
or thedbo.sysprocesses
system table - on
2005
take a look at thesys.dm_exec_sessions
DMV
Below is an example
SELECT COUNT(*) AS StatusCount,CASE status
WHEN 'Running' THEN 'Running - Currently running one or more requests'
WHEN 'Sleeping ' THEN 'Sleeping - Currently running no requests'
ELSE 'Dormant – Session is in prelogin state' END status
FROM sys.dm_exec_sessions
GROUP BY status
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow