Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    10

    Unanswered: 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?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    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.

  3. #3
    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?

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    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.

  5. #5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •