connect to SQL Server if administrator user is deleted and sa is disabled

connect to SQL Server if administrator user is deleted and sa 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 cmd 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 priviliges :

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
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.