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

<h2>Connect to SQL Server when administrator user is deleted and SA user is disabled</h2>

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.