Here i just want to inform you the power of SQL Server Dedicated Administrator Connection (DAC).
SQL Server provides a special type of connection only for administrators when standard connections to your sql server instance are not possible. This DAC connection can be made through sqlcmd utility as well as SQL Server management studio.
There are many restrictions also with DAC. Some of them are listed below:
1-The connection is only allowed from a client running on the server.
2-Only one DAC connection is allowed at a time.
3-You can’t execute Backup and Restore commands.
Now I am just sharing a problem for which DAC works as a solution.
I installed a SQL Server named instance on a developer system WIN-MT83DWDEO82\SQLSTAND2008R2B with mixed mode authentication (along with windows user account and SA login). But after the installation developer delete the windows user account from sql server, and also set the default database TEST1 for user SA. After some days he deleted that database TEST1 from SSMS. Next time when he wants to open SSMS with SA login but he failed, error comes again and again “default database can’t access”. Now there is only one administrator account in sql server which is SA.
To solve the above problem I used DAC- Dedicated Administer Connection
Step 1: Go to Start -> Run then Type
sqlcmd -SADMIN:WIN-MT83DWDEO82\SQLSTAND2008R2B -dmaster -Usa -Psql2008
then press Enter, this will open up sqlcmd utility connected with given SQL Server Instance.
Step 2: In sqlcmd change the default database for that user
ALTER LOGIN [SA] WITH DEFAULT_DATABASE=[master] GO EXIT
Now the problem is solved , user can open SSMS with SA login because now the default database for that user is master.