Connect to SQL Server when administrator user is deleted and SA user is disabled

Connect to SQL Server when administrator user is deleted and SA user is disabled

1. Stop the SQL Server and SQL Server Agent services in Services.msc.

Go to Start –> Run –> services.msc

Stop the SQL Server and SQL Server Agent Service.

2. Open a command prompt window.

Go to Start –> Run –> cmd and press the ‘OK’ button
change directory to SQL Server’s Binn directory as shown below.

C:\MSSQL2008\MSSQLSERVER\MSSQL\Binn>

3. Start the SQL Server in single user mode (sqlservr -m)

C:\MSSQL2008\MSSQLSERVER\MSSQL\Binn> sqlservr -m

wait for 5 minutes

4. Connected with window system administrator.

START –> RUN –> cmd

C:\> sqlcmd -E

-E option is used as trusted connection

5. Create login with sysadmin privileges :

create logins mssql with password=’mssql’;
go
exec sp_addsrvrolemember [mssql],[sysadmin]
go

6. Start SQL Server Management Studio and connect with new created logins.

7. Test permission with following command:
sp_helpsrvrolemember sysadmin

Leave a Reply