Tuesday, February 04, 2014

Cannot open user default database. Login failed. Login failed for user 'xx'

I have been very busy for last couple of months so i could not get chance to post earlier. I hope and continue to post more technical stuff on this blog this year 2014.

If you are sysadmin, Your default database set to one of the user database. If you decide to take offline for your default database before you set default to another database.

You will get the following error.
Cannot open user default database. Login failed. Login failed for user 'xx'

There are the steps below login to server to access master database and then you can set your default database.

Issue:
1. Connected as a sysadmin (windows authentication domain\username)
2. Connect to database server
3. Take offline  your database DB_WH_Report
-- I connected
4. Disconnect to Server
When you try to connect back
Error :
Cannot open user default database. Login failed. Login failed for user 'xx'

Solution:
1. Connect to Server
2. Click Option to expand  Connection Propertise
3. Connect to Database Type master
4. Click Connect button