EXAMPLE SQL SERVER BACKUP AUTOMATION

1.       Create the SQL Server Backup Script

InquestBackup.sql

The following variables need to be set within the script based upon your database and retention requirements:

a.       backup_dir

b.      db_name

c.       retain_days

 

2.       Windows Command File to execute SQL Server Backup Script

InquestBackup.cmd

The following will need to be set within the command file:

a.       Set the instance name of the SQL Server (default is SQLExpress)

b.      Set the correct path to the SQL Server Backup Script from Step 1

 

3.       Schedule the Windows Command File to run on a daily basis

a.       Open the Windows Task Scheduler

                                                               i.      Click “Start”

                                                             ii.      Select “Control Panel”

                                                            iii.      Select “Administrative Tools”

                                                           iv.      Double-click “Task Scheduler”

b.      Click the “Action” menu, and then click “Create Basic Task”

c.       Type a name for the task and an optional description, click “Next”

d.      Click “Daily” to create a daily backup, click “Next”

e.      Click “Start a program”, click “Next”

f.        Click “Browse” and find the “InquestBackup.cmd” file from step 2

g.       Click “Next”

h.      Click “Finish”