In this post we are going to mirror (create backups of the same database on different locations) with LiteSpeed.To do that let's use the Backup Wizard:
In the Backup Destination section we will see the Add Mirror button:
Note that the "Add Mirror" option is only available with the "Overwrite existing media" option, so if we do not select that one we will get an error as shown below:
So let's select the "Overwrite existing media" option and continue:
After clicking the button once, you will see that a new "Mirror 1" tab is displayed.
Click the Add button to display the Select mirror destination window. Enter the mirror destination. Choices are file name and backup device. For file names, click the ellipsis button to display backup locations. You can browse the network, add files, delete files, and rename files. For backup device, click the New Device button. The New Backup Device window is displayed. Enter device name and the physical location choices of file or tape drive.
You can create multiple mirrors by clicking this button more than once. By doing this, additional tabs appear:
For this example we will just add one mirror in the folder C:\Mirror. Then we will add a new one by modifying the script instead of using the GUI so we can see a different way to do it.
Let's fast-forward some of the next options as they are not relevant to see how mirror works
As always let's see the script that LiteSpeed has generated for us by clicking the "Preview Script" hyperlink in the Execute Script section:
Follow the wizard and then let's see our backups.And there they are! Two identical backups of the same database on different locations.
As promised before, let's add now a new location but this time we will do it by modifying the script instead of using the LiteSpeed GUI.Once the script is ready we can just go and run it with SSMS, Toad for SQL Server or our favorite tool.
The new location in this example is C:\Mirror2 and all we have to do is to add a new line in the script as shown below:exec master.dbo.xp_backup_database@database = N'2AdventureWorks2012Dev', @backupname = N'2AdventureWorks2012Dev - Full Database Backup', @desc = N'Full Backup of 2AdventureWorks2012Dev on %Y-%m-%d %I:%M:%S %p', @compressionlevel = 2,@filename = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\2AdventureWorks2012Dev_201709051225.bak',@init = 1,@mirror = N'C:\Mirror\2AdventureWorks2012Dev_201709051230.bak',@mirror = N'C:\Mirror2\2AdventureWorks2012Dev_201709051230.bak', @OLRMAP = 1 , @with = N'STATS = 10'GO
And here is the new backup (note that the mirror argument will create the folder Mirror2 if it is not already there)
Hold on! We have a question!
Cersei: Can Litespeed backup to Cloud and local storage at the same time?
Me: Not currently, as backup mirroring only supports mirrors of the same target type BUT ...can you keep a secret for me? CAUTION! Spoiler alert! This functionality will be included in the next version of LiteSpeed (8.6). See below, in world exclusive, some screenshots of that new version!
So get ready to backup to local drive / Azure Blob / Amazon S3 at the same time in any combinations soon!
Thanks for reading!
PS:For more spoilers have a look at the next post!