Alan Moseley IT Consultancy

Blog Entry

5/16/2008 - Accessing an SQL 2005 database if the database sa password has been reset

I came across the need to access some data within an SQL 2005 database (in order to back it up), where the sa password had been reset. This is how I did it:-

Logged to the server as a member of the local windows admin group

Stopped the SQL 2005 service.

at a command line, from the SQL\Binn directory ran: sqlservr -m -sABC1234 (ABC1234 is the database instance name)

Ran the SQL Server Comnfiguarion Manager.

Added my account as sa.

Typed Ctrl-C in the DOS screen.

Restarted the SQL 2005 service.

I now had access to the database! The above process is very risky. Please don't contact me if you wreck your database in the process! You have been warned!