Wednesday, September 13, 2017

Recover a SQL Database that you dont have access to


If you don't have SQL access, but have local server Administrator access, do the following:

Open SQL Server Configuration Manager
  • Stop the SQL Server Instance you need to recover the SA password
  • Open the properties on the SQL Server Instance and click on the Advanced tab
  • Change the Startup parameter by adding -m; at the begging of the line and click OK
  • Start the SQL Service Instance
NOTE: exactly like this "-m;"

Open the command prompt
Run sqlcmd
Run the following command to add an existing account to the sysadmin server role.

EXEC sp_addsrvrolemember 'YourDomainName\YourUserName', 'sysadmin';
GO

Make sure: SQL Browser service is running. Remove -m; after you have done and restart SQL

Works a charm !

https://community.spiceworks.com/how_to/22044-recover-sa-password-on-microsoft-sql-server

No comments:

Blog Archive