Skip to content

SQL server database mirroring

Stefan Mortensen edited this page Nov 19, 2013 · 1 revision

Set up database mirroring

Take a backup of the database and the transaction log you are going to mirror

BACKUP DATABASE AtomiaProvisioning2 TO DISK = 'C:\AtomiaProvisioning2Backup.bak';
BACKUP LOG AtomiaProvisioning2 TO DISK = 'C:\AtomiaProvisioning2Backup.trn'; 

Copy these files to the mirror and restore them

RESTORE DATABASE AtomiaProvisioning2 FROM DISK = N'C:\AtomiaProvisioning2Backup.bak' 
WITH FILE = 1, MOVE N'AtomiaProvisioning2_log' TO 
N'E:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\AtomiaProvisioning2.ldf', 
NORECOVERY, NOUNLOAD, STATS = 10;

RESTORE LOG AtomiaProvisioning2 FROM DISK = N'C:\AtomiaProvisioning2Backup.trn' 
WITH  FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10;

Go back to the master server and click on "task -> mirror" for the database you are going to mirror.

Click "Configure Security" Select "No" when it asks to include a witness server Select the mirror server you are going to use and click connect Click Finish Answer yes when it asks to start mirroring.

Clone this wiki locally