//
you're reading...
Microsoft SQL

Reset SQL SA account password

Don’t know the SA password for your SQL server instance? Here are a few ways that you can reset the SQL SA account password should you ever need to. Both methods focus on getting a command window running as the SYSTEM account, and then launching SQL Server Management Studio (SSMS) from this window. This will then allow you to log into the SQL instance as SYSTEM to reset the SA password. Note, anything in bold font is a command to be typed.

The first, and more straight forward method:

1. Download PsExec from here (part of the PsTools package) – http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
2. Extract the archive to a convenient location, I chose C:\PsTools
3. Open a command window (cmd) and navigate to the above directory, then type PsExec -i -s -d CMD and hit Enter
4. You should then get a second command window running under SYSTEM as per the below screenshot
Command window running as SYSTEM
5. Now launch SSMS, the default paths are “C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe” for SSMS 2008 or “C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\ssms.exe” for SSMS 2012. The above screenshot shows SSMS 2012 being launched
6. SSMS will launch and allow you to login to the local SQL instance under the SYSTEM account as below. From here you can reset the SA password as you would normally
Launching SSMS as the SYSTEM account

The next method works equally well and can be used if it is not possible to install PsExec. This method however only appears to work on Windows Server 2008 R2 and earlier (Server 2012 and R2 not working at time of writing). To use this method:

1. Open a command window and type sc create ResetSqlPassword binPath= “cmd.exe /k start” type= own type= interact (take note of the format of the command, spaces after the = signs are important)
2. Type sc start ResetSqlPassword
3. You will get an error message [SC] Start Service FAILED 1053, this error is expected. Notice in the task bar that an application icon is flashing to get your attention, click it
4. You will now see a dialog Interactive Services Detection as in the below screenshot, click View the message
Interactive session detection
5. You will now be taken to a windows session with no task bar or desktop icons, with a solitary command window running. You are now logged into a SYSTEM session shown below:
SYSTEM session
6. In the command window, launch SSMS and reset the SA password as per steps 5 and 6 from the previous method
7. Once you’ve finished, press the Return now button in the Interactive Services Detection dialog. Once back at your desktop, you can run sc delete ResetSqlPassword from a command window to delete the Windows service that was created in step 1

Hopefully you won’t need to use either of these methods any time soon, but if you have to I hope they get you back up and running quickly

Discussion

One thought on “Reset SQL SA account password

  1. The login credentials of the SA account is stored in the master.mdf file and you can reset the password offline with the SQL Server Password Changer utility.

    Posted by Larry | June 9, 2015, 1:30 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: