Broadcast Radio Forums

SQL Backup/Restore Scripting. SQL 2012 and Above

By John-Michael Sugden - Tuesday, January 30, 2018 2:32:45 PM

Hello All,

Attached are two updated scripts for backing up and restoring databases in Microsoft SQL 2012 and above.

Usage Notes:
* The Windows user running the script will need to be an SQL server administrator, if not the process will fail.
* Default Backup/Restore location is the folder containing the script. The script will create a 'Backups' sub-folder which will then contain dated folders for the backups and a 'Current' folder with the most recent backup which is used as the restore from location.
* The Backup process can be carried out while Myriad is running however the Restore process is destructive so will close all open connections to the database during the restore effectively stopping all software running from the restored databases - This will cause Myriad to lock-up or exit. 
* These scripts have been tested on SQL Server 2016 and 2012 on Windows 10 Professional. 
* Scripts can be run manually or by scheduled task if the restore script is run by scheduled task the flag 'Auto' must be passed to skip user confirmation of the task will not start, this is intentional to avoid an accidental restore halting a live system.

If you have any questions or problems using these scripts please let me know,