本文介绍了数据库用户的登录交换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含2个用户的数据库 - ''dbo''和''user1''。


目前:

=> ''dbo''与登录相关联 - ''login1''

=> ''user1''与任何登录无关。


我想将与数据库用户相关联的登录名更改为:

=> dbo与无法登录相关

=> ''user1''与''login1'相关联'


我尝试使用:

sp_change_users_login''Update_One'',''user1'', ''login1''

但是它给了我一个错误,说''login1''已经绑定了一个用户。


然后我尝试删除登录绑定到''dbo''用这个:

sp_change_users_login''Update_One'',''dbo'',''''

然后我得到另一个错误说''dbo''是

登录名参数的禁用值。


------


之前,所有'dbo'都没有与任何登录相关联,''user1''与$'b $ b绑定在''login1'',但昨天我恢复了数据库备份文件

从客户端带回来,然后我看到登录改为上面提到的那个

,我不确定是否是来自客户的DBA

改变它或什么,但有什么办法可以我要改回登录

到我想要的状态吗?


谢谢。


Peter CCH

I have a database with 2 users - ''dbo'' and ''user1''.

Currently:
=> ''dbo'' is tied to login - ''login1''
=> ''user1'' is not tied to any login.

I want to change the login tied to the database users to:
=> ''dbo'' tied to no login
=> ''user1'' tied to ''login1''

I try to use:
sp_change_users_login ''Update_One'', ''user1'', ''login1''
But it give me an error said ''login1'' is already tied to a user.

Then I try to remove the login tied to ''dbo'' with this:
sp_change_users_login ''Update_One'', ''dbo'', ''''
Then I get another error said that ''dbo'' is a forbidden value for the
login name parameter.

------

Previously, all the while ''dbo'' is not tied to any login and ''user1'' is
tied to ''login1'', but yesterday I restore the DB from the backup file
bring back from customer side, then I saw the login changed to the one
I mention above, I''m not sure whether is the DBA from customer side
change it or what, but is there any way for me to change the login back
to the state I want?

Thanks.

Peter CCH

推荐答案




你可以用sp_changedbowner更改数据库所有者。一旦你完成了

,就可以将user1连接到login1。


-

Erland Sommarskog,SQL Server MVP,


SQL Server联机丛书SP3 at




dbo is always tied to a login, since dbo is the database owner. But
you can change database owner with sp_changedbowner. Once you''ve done
that, you can connect user1 to login1.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp






当然。由于login1拥有数据库,因此login1映射到用户

dbo,并且无法映射到用户user1。您需要更改为另一个

所有者,例如sa。

-

Erland Sommarskog,SQL Server MVP,


SQL Server SP3联机丛书




Of course. Since login1 owns the database, login1 maps to the user
dbo, and cannot map to the user user1. You need to change to a different
owner, for instance sa.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


这篇关于数据库用户的登录交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 00:08