数据库用户的登录交换 [英] Exchange of login for database user

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

问题描述

我有一个包含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

推荐答案

Peter CCH(pe************@gmail.com)写道:
Peter CCH (pe************@gmail.com) writes:
我有一个包含2个用户的数据库 - ''dbo''和''user1''。

目前:
=> ''dbo''与登录相关联 - ''login1''
=> ''user1''与任何登录无关。

我想将与数据库用户绑定的登录名更改为:
=> dbo与无法登录相关
=> ''user1''与''login1''相关联
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''




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

,就可以将user1连接到login1。


-

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


SQL Server联机丛书SP3 at
http:// www。 microsoft.com/sql/techinf...2000/books.asp



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


我试过这个顺序:

1. sp_changedbowner''user1''

2. sp_change_users_login''Update_One'',''user1'',''login1''


但是2是指2。仍然给我同样的错误:

-----------------------------

服务器:消息15063,级别16,状态1,过程sp_change_users_login,

第104行

登录已经有一个不同用户名的帐户。

-----------------------------


这是视图企业管理器中的数据库树,当我点击

用户部分(数据库> dataBaseName>用户)时,

列表中有2个用户。


名称登录名数据库访问

---------------------------- ----------------------------------------------

user1 Permit

dbo login1 Permit


以前,我多次恢复从

获得的备份数据库客户站点到我的服务器,它有这个视图


名称登录名称数据库访问

--------------- ----- -------------------------------------------------- ----

user1 login1 Permit

dbo许可证


但是昨天一旦我恢复它,login1就不依赖于user1

了,相反,它与dbo联系在一起。


Peter CCH

I tried in this sequence:
1. sp_changedbowner ''user1''
2. sp_change_users_login ''Update_One'', ''user1'', ''login1''

But "2" still give me the same error:
-----------------------------
Server: Msg 15063, Level 16, State 1, Procedure sp_change_users_login,
Line 104
The login already has an account under a different user name.
-----------------------------

This is the view in database tree in Enterprise Manager when I click on
the user section (Databases > dataBaseName > Users), there''s 2 users in
list.

Name Login Name Database Access
--------------------------------------------------------------------------
user1 Permit
dbo login1 Permit

Previously, for so many times I restore the backup DB obtained from
customer site to my server, it have this view

Name Login Name Database Access
--------------------------------------------------------------------------
user1 login1 Permit
dbo Permit

But yesterday once I restore it, the login1 is not tied to user1
anymore, instead, it tied to dbo.

Peter CCH


Peter CCH(pe************@gmail.com)写道:
Peter CCH (pe************@gmail.com) writes:
我按以下顺序尝试:
1. sp_changedbowner''user1''
2. sp_change_users_login''Update_One'',''user1'',''login1''

但是2仍然给我同样的错误:
-----------------------------
服务器:Msg 15063,等级16,状态1,程序sp_change_users_login,
第104行
登录已经有一个不同用户名的帐户。
---------------- -------------
I tried in this sequence:
1. sp_changedbowner ''user1''
2. sp_change_users_login ''Update_One'', ''user1'', ''login1''

But "2" still give me the same error:
-----------------------------
Server: Msg 15063, Level 16, State 1, Procedure sp_change_users_login,
Line 104
The login already has an account under a different user name.
-----------------------------




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

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

所有者,例如sa。

-

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


SQL Server SP3联机丛书
http://www.microsoft.com/sql/ techinf ... 2000 / books.asp



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


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

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