Windows身份验证的sql数据库问题

发布于 2024-09-03 18:49:28 字数 294 浏览 4 评论 0原文

有一个 SQL Server 2008 数据库,我连接到 Windows 身份验证.. 已经工作了 7-8 个月.. 但现在当我今天上班时,它不再可以连接,如果没有的话,我已经做了一些事情 错误消息是:

无法打开用户默认数据库。登录失败。 用户“Jimmy-PC \ Jimmy”登录失败。

其中第一个是计算机名称,第二个是用户。问题似乎是它尝试连接到默认数据库。尝试更改它但没有成功..我没有sql 2008的sql server管理工具,但只有2005,有人有类似的经验吗?谁没有碰过周末说过的任何话,上周五就可以正常工作,没有任何问题。

Have a SQL Server 2008 db which I connect to the Windows Authentication .. has worked good for 7-8 months .. but now when I come to work today it no longer worked to connect, without that I had done something
Error message was:

Can not open user default database. Login failed.
Login failed for user 'Jimmy-PC \ Jimmy'.

where the first is the computer name and the second is the user. The problem seems to be that it tries to connect to the default database. Have tried to change it without success .. I do not have sql server management tools for sql 2008 but only to 2005, someone who has similar experience? who have not touched anything said over the weekend and it worked last Friday without any problems.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

李不 2024-09-10 18:49:28

用户的默认数据库处于脱机状态。自昨天以来发生的变化是您的数据库因某种原因发生了故障。

您需要使用不同的帐户(没有默认数据库的帐户)登录,然后检查数据库的状态。如果您没有这样的帐户,则可以使用管理员帐户。如果未授予管理员组登录 SQL Server 的权限,请参阅本文故障排除:连接当系统管理员被锁定时访问 SQL Server

登录后,您需要的唯一工具是 sqlcmd.exe,它已安装在您的计算机上。查看 sys.databases, state_desc 列将告知数据库是否离线。您可以尝试ALTER DATABASE ... SET ONLINE并查看它是否恢复,但这不太可能。您最好的选择是应用灾难恢复计划并从您保留的备份中恢复数据库。

The user's default database is offline. the thing that changed since yesterday is that your database had failed, for whatever reason.

You need to log in with a different account, one that does not have a default database, and inspect the state of the database. If you do not have such an account, then you can use an administrator account. If the administrators group is not granted login into SQL Server then see this article Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out.

Once you can log in, the only tool you need is sqlcmd.exe, which is installed on your machine. Look into sys.databases, the state_desc column will tell if a database is offline. You can try a to ALTER DATABASE ... SET ONLINE and see if it recovers, but that would be unlikely. Your best choice will be to apply your disaster recovery plan and restore the database from the backups you keep for it.

[浮城] 2024-09-10 18:49:28

奇怪的是它就停止工作了。您检查过用户默认数据库的状态吗?确保数据库存在并且在线。

要查找用户的默认数据库,请使用 sqlcmd.exe 运行以下命令,

select dbname from syslogins where name = 'Jimmy-PC \ Jimmy'

我在恢复系统时看到此错误,并且用户的默认数据库尚未恢复,还有一次当数据库处于“恢复”模式时。

我还要确保 Windows 帐户没有被禁用。

如果您发现需要更改用户的默认数据库,可以使用 T-SQL 命令,请参阅以下问题:

如何通过代码设置 Sql Server 中的默认数据库?

It is strange that it just stopped working. Have you checked the status of the user's default database? Make sure the database exists and is online.

To find the user's default database run the following command using sqlcmd.exe

select dbname from syslogins where name = 'Jimmy-PC \ Jimmy'

I have seen this error when recovering a system and the user's default database hadn't been restored yet and another time when a database was in "Recovery" mode.

I would also make sure that the windows account is not disabled.

If you find that you need to change the user's default database you can use a T-SQL command, see the following question:

How do I set the default database in Sql Server from code?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文