Sql Server between the master copy and a secondary copy of the account synchronization and synchronization rights

Problem Description

SqlServer if configured AlwaysOn, their account information database synchronization problems.

I encountered was in the master copy of the account information is added, and the addition of access to a database, this account will be synchronized to the secondary replica, but the database role information is not synchronized, the database is not synchronized right information to the secondary replica .

This is a troublesome issue, because not directly in the secondary copy permission information or add information database role, because the read-only secondary replica.

Solutions

The following is a workaround I used for primary and secondary node synchronization account and permission information:

1. First Establishment login account in the primary copy and giving Database Roles and Privileges

2. If you have an account but no roles and permissions information in the secondary node, then delete the copy directly to the login account nodes (login name of security), would have been if only the master copy of the account directly to step 3

3. query word master copy account information sid

SELECT * FROM [dbName]..Sysusers

4. set up an account in the secondary replica (then will sync right information)

CREATE LOGIN [ogg_wkc] WITH PASSWORD='?',SID=?,
DEFAULT_DATABASE=[dbNames],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=OFF

 

Guess you like

Origin www.cnblogs.com/yezongjie/p/sqlserver_loginaccountsync_20190701.html