This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script for unlocking the database user without changing a password in SQL Server.
We can do using CHECK_POLICY ON/OFF option.
If password policy is ON, the user entered a wrong password multiple times, that user may lock in SQL Server.
Using below script, you can unlock the user.
1 2 3 |
ALTER LOGIN user_name WITH CHECK_POLICY = OFF; ALTER LOGIN user_name WITH CHECK_POLICY = ON; GO |
If you get a below error, then you selected “User must change password at next login” option for that user.
If very first-time user lock due to multiple wrong passwords, drop and recreate that user.
1 2 |
Msg 15128, Level 16, State 1, Line 6 The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON. |
Leave a Reply