sql server back restore - 登录失败 [英] sql server back restore - login failed

查看:97
本文介绍了sql server back restore - 登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 sql server 2008 R2 上有一个本地数据库并且工作正常,

我的主机安装了 sql server 2012.在托管服务器上创建新数据库后,我可以使用给定的托管凭据轻松连接到空白数据库

我已经创建了 Sql Server 2008 备份并将其恢复到托管,并且每次都停止工作.

无法打开登录请求的数据库dbName".登录失败.

在创建备份之前,我确实创建了一个新用户,其凭据与托管提供的凭据相同,以连接他们的数据库.

建议运行孤立用户查询但无法连接到数据库的解决方案很少


(来源:
(来源:
(来源:pinaldave.com)

I have a local database on sql server 2008 R2 and working fine,

My hosting have sql server 2012 installed. After creating a fresh database on hosting server, I can connect easily to the blank database with given hosting credentials

I have created Sql Server 2008 backup and restored it to the hosting and every stops working.

Cannot open database "dbName" requested by the login. The login failed.

Before Creating a backup I did created a new user with the same credetianls as provided by hosting to connect their database.

There are few solutions suggesting to run the orphaned users query but am unable to connect to the database

http://sqlblog.com/blogs/eric_johnson/archive/2008/10/17/fixing-orphaned-users.aspx

解决方案

Its created as the result of orphan user while doing backup and restore

First, make sure that this is the problem. This will lists the orphaned users:

EXEC sp_change_users_login 'Report'

If you already have a login id and password for this user, fix it by doing:

EXEC sp_change_users_login 'Auto_Fix', 'user'

If you want to create a new login id and password for this user, fix it by doing:

EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

Another method worked for me


(source: pinaldave.com)


(source: pinaldave.com)

Make sure to replace [test] with your username and master with yourdatabase name


(source: pinaldave.com)

这篇关于sql server back restore - 登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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