A method for creating automatic backup through SQL Server Job Scheduling + storage process

Source: Internet
Author: User

1. Create the following stored procedure on the data to be backed up:

Create procedure [DBO]. [process name]
Declare
@ Filename nvarchar (100), -- file name
@ Nowday int -- set the time
Set @ filename = 'f: \ jxxdata '+ Cast (Day (getdate () as varchar (2) +'. dat '-- file path and file name
Set @ nowday = Day (getdate ())
If (@ nowday> = 20) or (@ nowday <= 10) -- back up the data from 20 to 10 of the next month.
Begin
Print @ filename backup database [Database Name () You can also set the parameter] to disk = @ filename with init, nounload, name = n'xx data backup ', noskip, stats = 10, noformat

End

The stored procedure must be debugged correctly.

2. Choose Enterprise Manager> Manage> SQL Server proxy> job, create a job, and take the job name as needed. For example, data backup, select SA as the owner, you can also select another user, provided that the user has the permission to execute the job;

3. Name in step-select the database to be backed up-enter exec ('process name') in the command ')

4. Choose "change"> "Daily"> "time" in the scheduling system.

5. After testing, import the script to the server.

6. Enable the sqlserver service manager for the sqlserver agent service

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.