Tuesday, October 16, 2007

Mirroring SQL Server 2005 Steps

When doing the mirroring certain thing you have to check if not you will get so many error message. This is what I've done in mine. Tyr to backup and restore from the sql studio and alwasy failed. The error message that show when we try to set the connection is leading us to no where.

  1. You are using same account for the service, if you on one domain then no problem.
  2. In mirror, put the restore database and log on the same folder, dont try to seperate it, it will make the connecting to mirror server fail said server not found use fully qualified domain.
use this script for backup and restore.

PRIMARY SERVER---------------

backup full database pada primary

TSQLnya :

alter database DB1 set recovery full
backup database DB1 to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1' with format
backup log DB1 to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1_log' with format

- copy both file backup to SERVER MIRROR exp to folder : C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\

MIRROR SERVER--------------
delete database in_server_mirror, if exist delete data(mdf) dan log(ldf) if you could not delete from the SQL Studio.

TSQLnya :
RESTORE FILELISTONLY
from disk ='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1'

restore database DB1
from disk ='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1'
WITH REPLACE,NORECOVERY,
move 'DB1' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DB1.mdf',
move 'DB1_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DB1.ldf';

restore log DB1 from disk ='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1_log' with norecovery

After This try to set you mirror server.

For witness server you could try use the virtual server that you put on your backup server.

Thx

No comments: