script out the red-gate backup and restore process
marrow
Posts: 6
Dear expert,
Any way to script out/automate the whole process of red-gate backup and restore using by only one mouse click? SQL server management studio can script that out but I can't see I can do it from red-gate.
Any idea?
This is assuming that all red-gate backup files always in the fixed folder, this can let red-gate restore read the file from the same place.
Any way to script out/automate the whole process of red-gate backup and restore using by only one mouse click? SQL server management studio can script that out but I can't see I can do it from red-gate.
Any idea?
This is assuming that all red-gate backup files always in the fixed folder, this can let red-gate restore read the file from the same place.
Comments
There is no single click solution to what you are seeking.
You can script out a backup and restore tasks using the Backup Wizard, Restore Wizard and Schedule Backup Job Wizard. When you reach the final step, before clicking the finish button, there is a summary of the actions to be taken. Behind the summary tab, you will find the 'Script' tab. If you select the script tab, you will find the job synatx for both the Extended Stored Procedure and Command Line Interface.
Alternatively, modify the example scripts below to suit your needs (The examples are for the Stored Procedure):
To automate a backup task, simply use the Schedule Backup Job which will create the job for you. Alternatively create a new SQL Server Agent Job and modify the example syntax to meet your needs.
If you are looking to automate SQL Server Express, you will need to use the Command Line Interface(CLI) and create batch files containing the CLI syntax. Then use the Windows scheduler to call at the batch file.
SQL Backup does not have a schedule restore job wizard or similar. To automate restore task you will need to create new SQL Server Agent Job and modify the example restore syntax to meet your needs.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com
To answer your question is yes. You can simply script out the commands and place into a SQL Agent job.
However, if your SQL Server Instance is Microsoft SQL Server Express Edition then you will need to use the SQL Backup Command Line Interface from the command prompt. Or create batch files and use the Windows Scheduler to create scheduled tasks. The reason is that Microsoft have removed the SQL Server Agent from this edition of SQL Server.
An example SQL Backup Command Line batch file maybe as follows:
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com
basicallly I found the SQL backup, before clicking finish, has a "script" column that contain all the script out the whole thing.
I do it in this way and then let the SQL server agent start that.
As you have found, using the script tab on the last step of the Backup, Restore and Scheduled Backup Job wizards is another way of obtaining the scripts required.
Please note, when you use the Scheduled Backup Job wizard, a job is created in the SQL Server Agent. SQL Backup uses the SQL Agent as the trigger to call the SQL Backup Extended Stored Procedure.
However if you need to schedule a restore job, you still need to script it and then create a SQL Agent job.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com