SQL Server in single user mode

Starting SQL 2005 in single user mode and getting admin console

In the startup parameters at the end add ";-m", you could get that in

the SQL Server Configuration then restart the service.

The service gets started in single user mode,

Make sure anybody or any service is not accessing the sql server.

At command prompt execute :

CMD>sqlcmd

After which you would get prompt like this

1>

If you want to add a login to "Sysadmin role" execute this.

1>EXEC sp_addsrvrolemember '<username>', 'sysadmin';

2>go


========

NET START MSSQLSERVER /m"SQLCMD" //Instance Name.


C:\Windows\system32>NET START MSSQLSERVER /m"SQLCMD"

The SQL Server (MSSQLSERVER) service is starting.

The SQL Server (MSSQLSERVER) service was started successfully.

C:\Windows\system32>SQLCMD -S. -E

1> EXEC sp_addsrvrolemember ' <user to be added>','sysadmin'; //By this we add user to sysadmin role.

2> go