SQL Backup/Restore Scripting. SQL 2012 and Above


SQL Backup/Restore Scripting. SQL 2012 and Above

Author
Message
John-Michael Sugden
John-Michael Sugden
Forum Sage
Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)Forum Sage (4.9K reputation)

Group: Forum Members
Posts: 47, Visits: 500
Hello All,

Attached are two updated scripts for backing up and restoring databases in Microsoft SQL 2012 and above.
 
Files:
SQL_Backup.bat
SQL_Restore.bat

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,

John-Michael
Smile





Attachments
SQL_Scripts.zip (115 views, 1.00 KB)
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Select a Forum....


































Broadcast Radio Forums


Search