无法打开用户默认数据库 [英] Cannot open user default database

查看:575
本文介绍了无法打开用户默认数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们......

i在我的网站上有一个数据库,它在本地使用默认用户,一切都很好,直到用我的visualstudio打开数据库并在数据库上做我的工作然后我关闭连接因为网站需要使用它...但它会显示我的错误:

无法打开用户默认数据库。登录失败。< br /> 
登录用户'alir-PC\alir'失败。



如果我重新启动sqlserver我的问题将解决但我不知道为什么如果我用visual studio打开数据库然后它我的网站没有打开它....但直到我没有用visual studio打开数据库我的网站工作得很好...

什么问题?

解决方案

数据库是否作为您的网站,它可能没有读取它,另一件需要考虑的事情是SQL Server可能不接受远程连接,您可能需要更改您的设置才能使它接受来自您网站的连接

基本上 此错误的主要原因 不可用  默认 用户 数据库位于时间  连接。它可能 
可疑模式下。
•不再存在
用户 mode 唯一可用的连接 已被使用 by 某人其他 其他
•已分离。
•已经设置 到RESTRICTED_USER状态。
离线。
设置 紧急状态。
是否将登录帐户映射到 用户 用户已被拒绝访问。
部分 数据库镜子。

解决此类错误,您必须指定有效的,可用的数据库 连接字符串中的class =code-keyword>。 避免错误 用户 < span class =code-string>' s默认数据库不可用,以可以修改登录的用户身份登录。然后,更改用户' s 默认 数据库 数据库 目前可用用于连接。


hey guys ...
i have a database in my website and its using default user in local ,everything is good until i open database with my visualstudio and do my works on database then i close connection because website needs to use it ... but it will show me this error :

Cannot open user default database.Login failed.<br />
Login failed for user 'alir-PC\alir'.


if i restart sqlserver my problem will be solve but i dnt know why if i open database with visual studio then after it my website do not open it .... but until i didnt open database with visual studio my website work very well ...
whats problem?

解决方案

Is the database on the place as your website, it might not be reading it, another thing to consider is that the SQL Server may not accept remote connections, you may have to change your settings in order for it to accept connections from your website


Basically the main reason of this error is the unavailability of default user database 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.

To resolve such error you must specify a valid, available database in the connection string. To avoid the error when the user's default database is unavailable, log on as a user who can modify logins. Then, change the user's default database to a database that is currently available for a connection.


这篇关于无法打开用户默认数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆