Last Logon

  • Hello All,

    I was wondering if there is a way to find out when the last time was that a person logged on to SQL Server.

    Basically, I am taking over DBA duties and there are quite a few users on the system that I believe have left the company. I would like to get find all of the users that haven't logged on for a certain amount of time.

    Thank you for your time,

    Chuck Maracle

  • Not that I know of. I think if you want to know this, you will need to build something to track it.

    Steve Jones

    steve@dkranch.net

  • I looked at all the sys tables. There is no last login that I can find. I would suggest an outside app, or trigger or so kind of internal job to monitor.

  • Are the user accounts SQL Server based on Windows based? If they are Windows based, there are some things that can be done to find out the last time a user logged into the domain.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • Yes they are from NT.

    I guess the major question is: aside from the admin (read developer) accounts, could I cause any problems with just dropping these accounts. We now have everyone in a groups on NT, and they get access though those. No one else should have created anything, but even if they did what would happen if I dropped the account.

    Again thank you for your time,

    Chuck

  • no problems. if these users own objects, sql will let you know.

    Steve Jones

    steve@dkranch.net

  • I don't think that is the case if you drop an account in NT. Also I believe if these are NT accounts you can turn auditing on to see when they login.

  • Auditing can be turned on for both SQL Server 7 and 2000 for NT users. Results will show up in the Security Log on the system. However, if you suspect certain users haven't logged in for a while, period (for instance, the domain), you can take advantage of the net user command from the command prompt. For instance, I have a user jsmith, who I want to know how long it's been since he's logged on. From a command prompt I can enter:

    net user jsmith /domain

    In the user profile that will be returned, I'll be able to see when the last time the user logged into the domain.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • That's usefull, I'll give that to my bud who gets stuck with all the account resposibilities.

  • Thanks for all of the help. The netuser should work out fine.

    Thanks again.

    Chuck

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply