Server A use master; create master key encryption by password = 'some_password'; GO use master; create certificate ServerA_Cert with subject = 'ServerA certificate for Mirroring', Start_date = '03/01/2009', expiry_date = '12/31/2019'; GO create endpoint Endpoint_Mirroring state = started as TCP(Listener_Port=7024, Listener_IP = ALL) For database_Mirroring( Authentication=Certificate ServerA_Cert, Encryption = Required Algorithm AES, Role = ALL); GO Backup Certificate ServerA_Cert to file = 'C:\ServerA_Cert.Cer'; GO use master; create login Server2_Login with password = 'some_password'; go use master; create user Server2_User for login Server2_Login; go
Server b use master; create master key encryption by password = 'some_password'; GO use master; create certificate ServerB_Cert with subject = 'ServerB certificate for Mirroring', Start_date = '03/01/2009', expiry_date = '12/31/2019'; GO create endpoint Endpoint_Mirroring state = started as TCP(Listener_Port=7024, Listener_IP = ALL) For database_Mirroring( Authentication=Certificate ServerB_Cert, Encryption = Required Algorithm AES, Role = ALL); GO Backup Certificate ServerB_Cert to file = 'C:\ServerB_Cert.Cer'; GO use master; create login Server1_Login with password = 'some_password'; go use master; create user Server1_User for login Server1_Login; go
1. copy c:\ServerB_Cert.cer from Server B to Server A c:\ 2. copy c:\ServerA_Cert.cer from Server A to Server B c:\
Server A use master; create certificate Server_2_Cert authorization Server2_User from file = 'c:\ServerB_Cert.cer' GO use master; Grant Connect on Endpoint::Endpoint_Mirroring to Server2_Login; GO Server B use master; create certificate Server_1_Cert authorization Server1_User from file = 'c:\ServerA_Cert.cer' GO use master; Grant Connect on Endpoint::Endpoint_Mirroring to Server1_Login; GO 1.Backup required DB from server A 2.copy Bakupfile from Server A to Server B 3.Restore Bakupfile in No Recovery mode in Server B Server B ALTER DATABASE config SET PARTNER = 'TCP://:7024'; GO Server A ALTER DATABASE config SET PARTNER = 'TCP:// :7024'; GO
Manual Failover ALTER DATABASE SET SAFETY FULL go ALTER DATABASE SET PARTNER FAILOVER go