Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;Initial Catalog=myDataBase;Integrated Security=True;
/*Create the master key for generating certificates */ create master key encryption by password= 'goodPass' /*Create a certificate, this certificate is used for the end point connection */ create certificate host_kyle with subject = 'kyle certificate for database mirroring' START_DATE='09/08/2011', --make sure this is a day prior to the current date EXPIRY_DATE='07/12/2020'; /*Back up the certificate, this certificate is copied to disrupter and imported on this machine */ BACKUP CERTIFICATE host_kyle TO FILE = 'E:\Share\host_kyle.cer'; /*Create the endpoint on port 5022, then endpoint uses kyle_host certificate for authentication. */ CREATE ENDPOINT Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5023 , LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE host_kyle , ENCRYPTION = REQUIRED ALGORITHM AES , ROLE = PARTNER ); GO /*Create the login that will connect to disrupter */ CREATE LOGIN disrupter_mirrorservice WITH PASSWORD = 'somepass' /*Create the user that will connect to disrupter */ CREATE USER disrupter_mirrorservice FOR LOGIN disrupter_mirrorservice /*Import disrupter's certifcate and allow it to be used to authorize the disrupter_mirrorservice user*/ CREATE CERTIFICATE host_disrutper AUTHORIZATION disrupter_mirrorservice FROM FILE = 'H:\certs\host_disrupter.cer' /*Allow the disrupter_mirrorservice to connect to the endpoint*/ GRANT CONNECT ON ENDPOINT::Mirroring TO disrupter_mirrorservice
1. On the mirror server(disrupter) ALTER DATABASE testmirror3 SET PARTNER = 'TCP://kyle.ucsd.edu:5023' 2. On the primary server(kyle) ALTER DATABASE testmirror3 SET PARTNER = 'TCP://disrupter.sdsc.edu:5023' To stop mirroring ALTER DATABASE testmirror3 SET PARTNER OFF
ALTER DATABASE <database_name> SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS
alter user hisCentralUser2 with login=hisCentralUser2
ALTER DATABASE testmirror3 SET PARTNER OFF RESTORE DATABASE testmirror3 WITH RECOVERY
--alter endpoint mirroring_5023 state=stopped; --alter endpoint mirroring_5023 state=started; ALTER DATABASE hiscentral_sandbox SET PARTNER RESUME
some command to set to full ALTER DATABASE USGSApr2010 SET PARTNER FAILOVER some command to set to ansync
alter user webservice with login=webservice