简体   繁体   English

角色用户 BD Geo Azure 无访问错误 916

[英]Roles user BD Geo Azure without access error 916

In SQL Azure, The roles of the users created in the main database are not replicated or copied to the geo database and generate error 916在 SQL Azure 中,在主数据库中创建的用户的角色未复制或复制到地理数据库并生成错误 916

enter image description here在此处输入图像描述

Can you help me?你能帮助我吗?

Could you please help me with a solution to this error, so that the user hosted in the GEO database can access his database with his role assigned in the main database.你能帮我解决这个错误吗,这样托管在 GEO 数据库中的用户就可以访问他在主数据库中分配的角色的数据库。

The roles of the users created in the main database are not replicated or copied to the geo database.在主数据库中创建的用户角色不会复制或复制到地理数据库。

To create and access users from primary data base to replicated database follow below steps.要创建和访问从主数据库到复制数据库的用户,请按照以下步骤操作。

First follow below steps on the master database of the Primary server:首先在主服务器的master数据库上执行以下步骤:

  • Create a new login with login name and password and also create a corresponding user and assign it to the dbmanager role (or any other role as per your requirement).使用登录名和密码创建一个新登录名,并创建一个相应的用户并将其分配给 dbmanager 角色(或根据您的要求的任何其他角色)。
CREATE LOGIN [Login_name] WITH PASSWORD = 'secure-password' 

CREATE USER [User_name] FOR LOGIN [Login_name]
ALTER ROLE dbmanager ADD MEMBER [User_name] 
  • Obtain the login's SID so that it may be recreated.获取登录的 SID,以便可以重新创建它。 only applies to logins using SQL Server authentication.仅适用于使用 SQL Server 身份验证的登录。 note it down for later use using the command below:使用以下命令记下它以备后用:
SELECT sid FROM sys.sql_logins WHERE name = '[User_name]'

Now follow below steps on the source database of the Primary server:现在在主服务器的source数据库上执行以下步骤:

  • Create user for the same login as master database and add the user to the db_datareader role:为与 master 数据库相同的登录名创建用户,并将该用户添加到 db_datareader 角色:
CREATE USER [User_name] FOR LOGIN [Login_name]
ALTER ROLE db_datareader add MEMBER [User_name]

Now, create login on the master database of the Secondary server:现在,在辅助服务器的master数据库上创建登录名:

  • Using the same username, password, and SID from the user in the primary master database, create the same login as on the primary server:使用主 master 数据库中用户的相同用户名、密码和 SID,创建与主服务器上相同的登录名:
CREATE LOGIN [Login_Name] with password = 'secure-password', sid=0x010600000000006400000000000000003C5857161B989940886580923D14E710

Output输出

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM