If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > How do i log the SQL server sessions?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-12, 23:01
rickoy rickoy is offline
Registered User
 
Join Date: Jul 2011
Posts: 10
How do i log the SQL server sessions?

I would wish to keep track of every users that logs into our database.

The reason why I'm doing this Is because we would wish to prevent the users, that we've granted access into our dataset, from sharing their credentials to other users without our permission. We are not always in front of our servers to monitor the users that are logged in so we wished to do this automatically every time a user session starts.

I know the statements to be used to get the username, computer name, etc. But I dont know how to automate this task. Manipulation of data in our server is purely via management studio so we are limited to what exists in SQL Server.

Is this possible? How?
Reply With Quote
  #2 (permalink)  
Old 02-06-12, 23:35
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
There are many choices for recording this kind of information, all with their own advantages and disadvantages.

The quick and easy answer is to setup a SQL Profiler trace.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 02-07-12, 00:47
rickoy rickoy is offline
Registered User
 
Join Date: Jul 2011
Posts: 10
Quote:
Originally Posted by Pat Phelan View Post
There are many choices for recording this kind of information, all with their own advantages and disadvantages.

The quick and easy answer is to setup a SQL Profiler trace.

-PatP
thanks, the profiler can get me the information that i need but i need this to run automatically. i can run a job to create a trace automatically on startup but the script only allows to output the trace into a file. what I want is for it to be in a table.

what other ways can you suggest?
Reply With Quote
  #4 (permalink)  
Old 02-07-12, 13:32
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Create a trace using the SQL Profiler GUI, and send its output to a table. Run the trace and check the output to ensure that it is what you want. Save the trace on the SQL Server, and set it to start with the SQL Server.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #5 (permalink)  
Old 02-07-12, 22:14
rickoy rickoy is offline
Registered User
 
Join Date: Jul 2011
Posts: 10
Quote:
Originally Posted by Pat Phelan View Post
Save the trace on the SQL Server, and set it to start with the SQL Server.
Sorry, im not really sure how to do this part? I've tried saving its script trace definition, but when I open the script trace def, it only allows me to save the output into a file.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On