SQLSERVER2005 automatically backing up the database with jobs

Source: Internet
Author: User
Tags microsoft sql server management studio

1. Open the Microsoft SQL Server Management Studio Console root directory, SQL Server Agent, jobs.

2. Right button "new job".

3, select the "General" page on the left, enter the job "name" on the right, select "owner", "category" Select "Database Maintenance", "description" Custom.

4, select the "Steps" page on the left, click on the "New" button on the right, enter "step name", select "category" as "Transact-SQL script (T-SQL)", select the database you want to create the job, in "command" enter the following statement (incremental, differential and full backup three select one.) Remember to replace your backup save path and database name, I'm here for the ' d:/bak/' folder; The database is Yadongwuliu):

Incremental backup :

Backup DATABASE [Yadongwuliu] to disk = ' D:/bak/yadongwuliu.bak ';

Differential backup :

DECLARE @strPath NVARCHAR Set @strPath = ' d:/bak/' + ' yadongwuliu ' + '. Bak ' BACKUP DATABASE [Yadongwuliu] to DISK = @str Path with differential, Nounload, Noskip, Stats=10,noformat

Full backup :

DECLARE @strPath NVARCHAR Set @strPath = Convert (NVARCHAR), GETDATE (), Set @strPath = REPLACE (@strPath, ': ', '. ') Set @strPath = ' d:/bak/' + ' databasename ' [email protected] + '. Bak ' BACKUP DATABASE [Yadongwuliu] to DISK = @strPath with Noinit, Nounload, noskip, STATS = 10,noformat

5. Select the "Plan" page on the left, click on the "New" button on the right, enter "name", select "Scheduling type" and so on, which is configured according to your business needs.


SQLSERVER2005 automatically backing up the database with jobs

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.