First create SQL Login in Primary replica
Example : Login : TESTLOGIN, Password : test, Database : DBA, db_datareader
Find SID of SQL Login in Primary replica
Run the following query in primary SELECT SUSER_SID ('TESTLOGIN') to find SID of the SQL login in Primary replica
Copy the query result which is SID, Example : 0x4063F34B8AF7A041B66CF243AAC79ECC
Create the same SQL Login in Secondary node using the script below. Paste the SID from primary node in SID area, password in passsword.
In the script below, update the areas LOGIN, PASSWORD, SID, DEFAULT_DATABASE
USE [master]
GO
CREATE LOGIN [TESTLOGIN] WITH PASSWORD=N'test'
,SID=0x4063F34B8AF7A041B66CF243AAC79ECC, DEFAULT_DATABASE=DBA,
DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
After updating the query, Run the query in Secondary node
We use the same SID for SQL login in order to work after failover happens.
We use the same SID for SQL login in order to work after failover happens.
Thank you for reading.
No comments:
Post a Comment