Because of the data security considerations in SQL Server, you need to back up the database regularly, and this article describes using jobs in the SQL Server database agent to automatically back up the database.
1. Start the SQL Server Agent service, such as:
The Green Corner label description is started.
2. Right button "job", select "New Job", pop Up the new Job dialog box, as follows:
3, enter the name, the owner, the category is not modified by default, click on the left "steps", in the steps panel to create a new step, such as:
Enter the step name (custom) and the command.
Command code:
Declare @name varchar( -)Set @name='C:\MyBackup\MyDB_'+Convert(varchar( -),getdate(), the)+'. bak' BACKUP DATABASE [MyDB] to DISK = @name withNoformat, Noinit, NAME=N'mydb-full Database backup', SKIP, Norewind, Nounload
The first three lines of code mean to back up the database mydb to the C-drive MyBackup folder with the file name Mydb_ current time. Bak.
4, click OK, go back to the new job panel, select "Plan", go to the planning panel, new plan, such as:
The planned time set here is: In the daily 1:00:00 execution. Plans will be used from 2015/10/29 onwards.
Click OK so the database will be automatically backed up at one o'clock in the morning every day.
SQL Server automatically backs up databases at timed intervals