What happens if you delete default database for a user in sql server?
--You will get an error msg as : Cannot open user default database
--Easy solution:
1- Click options in login window
Login Screen in SQL Server Management Studio
2-Set database to master or model
Change database for connection
3-This will fix your login problem. Next step is to find your default database and change that. It is normally located in security> logins> your loginname
Find your Login settings in security tab
4-Change your default database if it is not changed.
Now, you can fix the problem with your default database. Here is the cause of the problem from Mic:
The user default database is unavailable at the time of connection. It is possible that the database:
- Is in suspect mode.
- No longer exists.
- Is in single user mode and the only available connection is already being used by someone else or by something else.
- Has been detached.
- Has been set to the RESTRICTED_USER state.
- Is offline.
- Is set to emergency status.
- Does not have the login account mapped to a user or the user has been denied access.
- Is part of a database mirror.
No comments:
Post a Comment
Hey!
Let me know what you think?