One to Many Log shipping -- doable?

Compresses, encrypts, secures and monitors SQL Server backups.

Moderators: JonathanWatts, Chris Auckland, eddie davis, Colin Millerchip, Brian Harris, james.billings, RBA, petey

One to Many Log shipping -- doable?

Postby samjones11 » Tue Dec 25, 2012 8:20 pm

Hello!

I use SQL Backup 6.5, and need to set up one to many log shipping (to on site spare SQL server, to off site, to development...)

I have it set up now to the on site warm standby.

Any tips or pointers on doing one to many?

Thanks!
samjones11
 
Posts: 10
Joined: Fri Mar 06, 2009 1:21 am

Postby eddie davis » Thu Dec 27, 2012 4:36 pm

Hi samjones11

What you are seeking cannot be achieved using the Log Shipping Wizard. However you can modify your existing setup to perform a one to many. The instructions below if you wish to log ship to two destination servers is as follows:

1. Configure a network share for the second target server to use.

2. Take a full backup of the source database.

3. Restore the full backup created in step 2, to the second target database using the WITH NORECOVERY argument.

4. On the source server, Open SSMS or Enterprise Manager ->SQL Server Agent ->Jobs ->Locate the existing Transaction Log Backup job.

5. Right Click the job and select Properties.

6. Select Steps and click on the Edit button. The syntax of the Transaction Log Backup job may look similar to the following:

DECLARE @errorcode INT
DECLARE @sqlerrorcode INT
EXECUTE master..sqlbackup N'-SQL "BACKUP LOG [<database_name>] TO DISK=''D:\\Backup\\<database_name>\\LogShipping\\<TYPE>_<DATABASE>_<DATETIME YYYYmmddhhnnss>.sqb'' WITH COMPRESSION = 2, COPYTO = ''\\\\server1\\Share1\\<database_name>''"', @errorcode OUT, @sqlerrorcode OUT;
IF (@errorcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @errorcode, @sqlerrorcode)
END

7. Modify the job and add a second COPYTO parameter whose path is to the network share configured in Step 1, so the job becomes:

DECLARE @errorcode INT
DECLARE @sqlerrorcode INT
EXECUTE master..sqlbackup N'-SQL "BACKUP LOG [<database_name>] TO DISK=''D:\\Backup\\<database_name>\\LogShipping\\<TYPE>_<DATABASE>_<DATETIME YYYYmmddhhnnss>.sqb'' WITH COMPRESSION = 2, COPYTO = ''\\\\server1\\Share1\\<database_name>'', COPYTO = ''\\\\server2\\share2\\<database_name>''"', @errorcode OUT, @sqlerrorcode OUT;
IF (@errorcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @errorcode, @sqlerrorcode)
END

8. On the second target server, create a new job to restore the Transaction Log Backup file to second database. Open SSMS ->SQL Server Agent ->Jobs ->Right Click Jobs and select new job. On the General Tab give the job a name and if required enter information into the Description field. On the schedules tab, set a new schedule on how often the restore job needs to run. On the Steps Tab modify the restore script below as required:

DECLARE @errorcode INT
DECLARE @sqlerrorcode INT
EXECUTE master..sqlbackup N'-SQL "RESTORE LOG [<database_name>] FROM DISK = ''<path to network share>_*.sqb'' WITH NORECOVERY, MOVETO = ''<path to completed log shipping folder>''"', @errorcode OUT, @sqlerrorcode OUT;
IF (@errorcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @errorcode, @sqlerrorcode)
END

9. Check that everything is configured correctly; ensure that source server copies backup files to the second network share location and that the second target server restores the backup files from the network share.

I hope the above helps.

Many Thanks
Eddie
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
eddie davis
 
Posts: 942
Joined: Wed Jun 14, 2006 3:47 pm
Location: Red Gate Software


Return to SQL Backup 7

Who is online

Users browsing this forum: No registered users and 0 guests

cron