How to change the SA password


How to change the SA password without having Sysadmin rights

Log on interactively to the physical server (RDP is fine) that hosts the SQL ServerInstance. It is important that we are logged on as Local Admin or eqvivalent.

In a DOS window, navigate to the directory that keeps OSQL.EXE

Issue the following command at the DOS prompt:
OSQL -E

If everything is ok, the SQL prompt will appear. This means we are now connected to the SQL Server through Trusted Connection. At the SQL prompt, issue the following command:

EXEC sp_password NULL,’newpassword’,’SA’ GO

If everything is ok, this command now have changed the password for SA to the new password, and you exit the SQL prompt and close the DOS window. If you connect to a certain instance, the initial command line would be:

OSQL -E -S ServerInstance

If you aren’t sure of the name of the server, you can list all servers:
OSQL -L

Khan – SQL DBA – SPA  MCTS

Advertisements