SQL server automatically back up and regularly clean up backup files


In our existing system, the importance of database is self-evident. In order to avoid data loss caused by data downtime or misoperation, it is necessary to backup the database regularly. The following will introduce the database backup method of SQL server, hoping to help you solve the problem of daily backup.

Step 1: login Database > Management > maintenance plan > Maintenance Plan Wizard

Step 2: enter the “name” and “description” of the maintenance plan and click the “change” button

Step 3: make relevant settings in the “new job plan” interface

          Plan type: repeated execution;

          Frequency of execution: weekly, daily, monthly (here I choose daily backup)

          Daily frequency: choose the time by yourself; (here I choose to back up once a day)

          Duration: the start time defaults to the current time(It is suggested to change to early morning or a time period with relatively low data overhead), the end time may not be filled in;

Click “OK” after the above settings are completed

Step 4: click next, “select maintenance task“, here I choose “backup database integrity” and “clear maintenance task”, regularly clear the backup data, to avoid disk space occupied by backup data, resulting in data downtime.


Step 5: “select the order of maintenance tasks”, here is to backup before deleting

Step 6: select the database to be backed up. You can choose according to the database to be backed up, and you can choose which location to back up. , it’s better to put it in a drive letter with sufficient disk space, and the extension is bak by default.

Step 7: set “define clear maintenance task”, select the folder, file extension Bak and file retention time set during backup, and select the backup retention time according to your own needs


Step 8: select the saving address of the report options, and choose it according to your needs.

Step 9: click “finish” to set. Here you can see the previous setting.


Step 10: set successfully


Step 11: after setting, you can see that a job plan will be generated in “maintenance plan” and “job”.

Step 12: maintenance plan right click Modify to view the planned tasks, and right click to set related parameters again.

Step 13: right click “job start step” to directly execute the job and verify whether the job is effective

Recommended Today

Review of SQL Sever basic command

catalogue preface Installation of virtual machine Commands and operations Basic command syntax Case sensitive SQL keyword and function name Column and Index Names alias Too long to see? Space Database connection Connection of SSMS Connection of command line Database operation establish delete constraint integrity constraint Common constraints NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY DEFAULT […]