SQL Server - is Locking a SQL Login account same as Disabling it?

techresearch7777777 1,921 Reputation points
2023-01-26T20:11:11.88+00:00

Hello, SQL Server - I realize there's an option in SSMS to Disable a Login account...but is Disabling it different than Locking it?

(Locking a SQL Login account from what I understand is number of failed login attempts then gets automatically locked.)

If yes they are different can I as a DBA manually Lock a SQL Login account (instead of disabling it) and how to do it ?

Thanks in advance.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,466 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 116.7K Reputation points MVP
    2023-01-26T22:45:45.2533333+00:00

    Yes, locking and disabling are different things. You disable an account with ALTER LOGIN DISABLE and re-enable it with ALTER LOGIN ENABLE.

    There does not seem to be any syntax to lock an account, but that can only happens because of a policy, for instance too many occurrences of the wrong password. It seems from the syntax graph that you can only unlock an account when you set the password.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,571 Reputation points
    2023-01-27T07:13:10.0366667+00:00

    Hi techresearch7777777,

    SQL Server keeps track of the number of unsuccessful login attempts. If the number reaches the lockout threshold set in the Lockout Policy, the user is locked out in SQL Server. The lockout status can be viewed and unlocked on the Login Properties page in SQL Server Management Studio. This is a password protection mechanism. For disable a login account, see what Erland post.

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  2. techresearch7777777 1,921 Reputation points
    2023-01-27T22:46:19.8233333+00:00

    Thanks all for the helpful replies, much appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.