SQL Server database timed automatic backup

Source: Internet
Author: User
Tags modify sql backup
server| Backup | timing | data | Database backup to server data is a hassle, if daily or often manual backup is a painful thing. Here I introduce a way to set up automated backups via SQL Server job scheduling:
1, into Enterprise Manager-> Management->sql Server Agent-> operations;
2, the new job, the name of the job to take, for example: Data backup, the owner Select SA, of course, you can also choose other users, provided that the user has the right to execute the job;
3, click the Step tab, enter the step panel. To create a new step, the step name can be filled out casually, such as Step 1, type and database defaults, and no modification is required. The following statement is written to the command:
Backup DB [database name] to DISK = N ' F:\data\ database backups ' with Noinit, nounload, NAME = n ' database backup ', noskip, STATS = ten, n OFORMAT
Note: You need to modify the place, database name, disk= (here need to fill in the path and the name of your database backup) name= can be easily filled in.
4, click the schedule tag, into the dispatch panel, new scheduling, name casually fill in, select Recurring, point change can choose you want to perform the task of arbitrary scheduling. such as every day, every 2 days, every week, monthly, etc. Set yourself up according to your needs;
5, make sure, do not forget one thing, in the work you have just established the right button to start work, if your work is no problem, will be prompted to perform successfully, and have a corresponding backup file on your disk appear;
6, another important problem is that your SQL Server Agent server has been started.

If we need to generate a new backup based on the daily date, so that we can distinguish between backup files. At this point, we need to modify the SQL statement just now. Reference example: Declare @filename nvarchar set @filename = ' F:\AddIn\ backup \data ' +convert (char (), GETDATE (), 112) Print @ FileName backup DATABASE [addin] to DISK = @filename with Noinit, nounload, NAME = N ' addin backup ', noskip, STATS = ten, NOF ORMAT If you have any questions, I hope you will leave a message to communicate with me.


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.