Sunday, May 20, 2012

Reset 'sa' password even if you don't have access to SQL Server

Prerequisites: Make sure you have Admin access on the server hosting SQL Server

1. Firstly, we need to shutdown the SQL instance and set the system into SingleUser mode.
This is done as follows:
a. Run the SQL Configuration Manager.
b. Right click on the relevant instance and select "properties".
c. Select the advanced tab.
d. Select the start up option and append ";-m" (no spaces and no ") to the end of the line.
e. Say ok.
f. Stop and start the instance.

2. Now go to the command prompt and reset the password:
a. Start > run > cmd
b. At the command prompt, run "osql -S Servername\SQLInstanceName E".
c. This will open a prompt window with a "1.>" in it.
d. 1> sp_password NULL,<new_password,sa
e. 2> go
f. 3> quit

3. Now go back to the SQL Configuration Manager and undo the above change (stop the service, remove the ;-m and restart the service).
4. SQL ‘sa’ password is changed, even without the local admin group being SA enabled.

No comments:

Post a Comment