Saturday, February 16, 2013

RECOVERING SQLSERVER "SA" LOGIN PASSWORD


The time may occur that you may forget or lost your sql serversa” or “sysadmin” login’s password.  This process will give you an opportunity for retaining forgot or lost password of your sqlserver’ssa” login.

  1. Select “SQL SERVER CONFIGURATION MANAGER” from start menu. 




2. Select SQLSERVER from the left panel and right click on “SQL SERVER (MSSQLSERVER)” from the right panel.  Select stop from the context menu appeared for stopping the sqlserver service.


3. After stopping the service again right click on the SQLSERVER service and select properties.  In properties window select advanced tab.  Now for the startup parameter add “-m;” at the starting position of the string as show in the below diagram.


4. After changing the startup parameter again start the sqlserver service.

5. Now open the command prompt and from here we will create a user with the sysadmin role and by using this users login we are going to change the sa login’s password.

6.Open the command prompt and type “SQLCMD”, So that you will change to the sql prompt.

7.By the following command create new user with name “recovery”
CREATE LOGIN recovery WITH PASSWORD=’dileep1234’
GO
You have finished creating a user now you should assign a role to this user as SYSADMIN by the following command.
Sp_addsrvrolemember ‘recovery’,’sysadmin’
GO



8. Now again stop the SQLSERVER service and go to its properties and remove “-m;” in the startup parameter and againg start the service.

9.Now login to the newly created recovery account and change the password of the “SA” login’s password.

That’s it you have now successfully use this account with your new password.