SQL SERVER – Unlocking User Without Changing Password

While I mainly focus on SQL Server Performance Tuning during my  Comprehensive Database Performance Health Check. I often receive a question from users which are not related to performance tuning. If know the answer, I like to answer them. Today we are going to discuss Unlocking User Without Changing Password.

A client of mine recently locked himself out of SQL Server. The user was not admin so one of the easiest options was to recreate the user. However, before we do that I suggested that they should try out the policy turning off and on and if that works they can easily unlock the user without changing the password. Let us see how we can do that.

ALTER LOGIN YourUserName WITH CHECK_POLICY = OFF;
ALTER LOGIN YourUserNameWITH CHECK_POLICY = ON;
GO

Now the script above will only work if a user is not set to change the password during the next loging. If that happens, just recreate the user.

If you liked this video, please do not forget to subscribe to my YouTube Channel – SQL in Sixty Seconds.

Here are my few recent videos and I would like to know what is your feedback about them.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Menu
Exit mobile version