SQL Agent Jobs: Creating a Scheduled Database Backup Plan
Prerequisites
Microsoft SQL Server (Any edition but Express)
Procedure
1. RDP onto the server
2. Connect to the SQL server using SQL Server Management Studio. You need administrative access so use Windows credentials or the SA account
3. Expand the Management section
4. Right-click on Maintenance Plans and choose New Maintenance Plan
5. Choose a name, E.G. Daily Backup
6. Double click on Subplan_1
Name: A simple name for the section of the plan (e.g. Backup)
Description: Provide some more detail explanation (e.g. Takes a daily backup and deletes the one created the previous day)
Click on the calendar icon next to the Schedule field. Change the frequency according to customers specifications
On the left-hand side there will be a toolbox containing call the available tasks
7. Add a Back Up Database Task. You can either double click it, or drag and drop it into the beige filed
A new item will appear in the design area
8. Double click on the Icon to set up the backup specifications
9. Specify the databases to back up. You can click on All user databases, or select specific ones using the These Databases option
10. Click OK
11. Select the Create a backup file for every database option
12. Check the box that says Create a sub-directory for each database
13. Select a location for the backup files (Usually something along the lines of C:\SQL Backups)
14. Hit OK
You are done setting the backup part of the plan, now we need to make it remove the old files
15. Add a Maintenance Cleanup Task from the toolbox. Make sure to connect it by dragging the arrow from the backup task onto it
Ensure the first task and second task are linked
16. Double-click on the Icon for the new task
17. On the folder section, select the folder where you are backing up the files
For file extension, select *.*
Check the Include first-level sub-folders box
Choose the time frame for file deletion. If its a daily backup task, set the time to 20 hours, not 1 day, so we ensure the prior days backup is
removed
18. Save the plan by clicking on the Save icon or hitting Ctrl + S and youre done!