无法打开登录所请求的数据库。登录失败。用户登录失败 [英] Cannot open database requested by the login. The login failed. Login failed for user

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

问题描述

我抄从一个我的电脑一个数据库,并在这里使用它。在试图打开这需要从数据库的抓取内容的页面上con.open我得到这个异​​常:

I have copied a DB from one my computers and using it here. On trying to open the page which requires the fetching content from DB, on con.open I am getting this exception:

无法打开物理文件E:\\ Program Files文件\\微软SQL
  服务器\\ MSSQL10.SQLEX $ P $干燥综合征\\ MSSQL \\ DATA \\ cakephp.mdf操作系统错误32:32(
  进程无法访问该文件,因为
  它被另一个
  处理。)。
      无法打开物理文件E:\\ Program Files文件\\微软SQL
  服务器\\ MSSQL10.SQLEX $ P $干燥综合征\\ MSSQL \\ DATA \\ cakephp_log.LDF。
  操作系统错误32:32(
  进程无法访问该文件,因为
  它被另一个
  处理。)。
      无法打开数据库CakePHP的由登录请求。登录
  失败。
      用户登录失败沙林-PC \\沙林。

Unable to open the physical file "E:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\cakephp.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". Unable to open the physical file "E:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\cakephp_log.LDF". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". Cannot open database "cakephp" requested by the login. The login failed. Login failed for user 'Sarin-PC\Sarin'.

我重视从Management Studio中前preSS 2008数据库,我也checcked的连接字符串。在这里,它是:

I have attached the database from Management Studio Express 2008 and I have also checcked the connection string. Here it is:

<connectionStrings>
        <add name="cn" connectionString="server=.\sqlexpress;database=cakephp;integrated security=true;uid=sarin;pwd=******"/>
    </connectionStrings>

在Visual Studio中,当我测试的连接,它说:测试连接成功。然而,有一个接一个奇怪的事情。当我登录到Management Studio中,没有+与新附加的数据库签名,如图所示。

In Visual Studio, when I test the connection, it says "Test connection succeeded". However, there is one strange thing going on. When I login to the Management Studio, there is no + sign with the newly attached database, as shown.

如果全部WebConfig被reqiured待观察,我在这里贴吧: http://pastebin.com/sVAuN0Ug

If the full WebConfig is reqiured to be seen, I have pasted it here: http://pastebin.com/sVAuN0Ug

推荐答案

有该数据库的用户,但,也有服务器的用户。一个用户必须具有登录权限到SqlServer的,才可以使用该数据库。

There are users of the database, but, there are also users of the server. One user has to have login rights to SqlServer before it can use the database.

在你的情况,你复制的数据库和它的用户,但这些用户不必在新服务器上登录权限。解决办法是增加对SqlServer的一个新帐号登录(进入SQLSERVER,而不是数据库的安全节点的安全节点),并添加它。当您添加用户,将其分配到数据库,以及,应该工作。

In your case you copied the database and it's users, but those users don't have login permissions on the new server. Solution would be to add a new Login account on SqlServer (go to the Security node of the SqlServer, not the Security node of the database), and add it there. When you add that user, assign it to the database as well, and that should work.

编辑:在进一步阅读您的问题后,是否有可能有两个SQL服务器针对同一个mdf文件?因为无法正常工作。此外,复制数据库文件时,你有没有复制前分离他们?如果这一切都很好,然后尝试进行备份,然后还原。

After reading your issue further, is it possible that there are two sql servers targeting the same mdf file? Because that cannot work. Also, when copying database files, have you detached them before copying? If that's all fine, then try making backup and then restore.

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

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