SQL Server automatically backs up databases at timed intervals

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.