Recover SQL Server sa password

Response on StackOverflow.com

You may have forgotten “sa” password, you never got it, the provider didn’t give it to you, whatever.

But, You have Administrator privileges on Windows.

The steps are the following:

  1. Go to SQL Server Configuration Manager.
  2. Select SQL Server and STOP the service.
  3. Right click on it, go to Properties.
  4. On “Startup parameters”, add the following at the beginning “-m;”
  5. Start SQL Server service.
  6. Now, you’re on Single User Mode.
  7. Open a Command window (on Win7 make sure to Run as Administrator)
  8. Type “SQLCMD” and hi ENTER.
  9. Now you’re logged on SQL Server in Single User Mode, without any password.
  10. Type: “CREATE LOGIN mynewuser WITH PASSWORD = ‘mynewpassword′;”
  11. Type: “GO;”
  12. Type: “sp_addsrvrolemember ‘mynewuser’, ‘sysadmin’;”
  13. Type: “GO;”
  14. Stop SQL Server service.
  15. Right click it, go to Properties.
  16. On “Startup parameters”, remove the following from the beginning “-m;”
  17. Start SQL Server service.
  18. Open SQL Server Management Studio, login as “mynewuser” user.
  19. Go to Security, Logins, and change “sa” user password.

References:

How to recover SA password on Microsoft SQL Server 2008 R2
Disaster Recovery: How to regain your lost sysadmin access
Starting SQL Server in Single-User Mode
Tips & Tricks: YOU HAVE LOST ACCESS TO SQL SERVER. NOW WHAT?
sqlcmd Utility

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: