SQL Server Backup

Source: Internet
Author: User
Tags getdate

First we can refer to:


Http://blog.sina.com.cn/s/blog_816780b40101m4jb.html

Again, some of these errors need to be corrected, please refer to the specific commands:

All of these steps are:

650) this.width=650; "title=" SQL Server 1.png "src=" http://s3.51cto.com/wyfs02/M01/75/44/wKioL1Y0XOqxF3tKAAKxq_ 8nyti926.jpg "alt=" Wkiol1y0xoqxf3tkaakxq_8nyti926.jpg "/>

The first thing to edit is Backup_yeshare:

DECLARE @strPath NVARCHAR (200)
Set @strPath = Convert (NVARCHAR (+), GETDATE (), 120)
Set @strPath = REPLACE (@strPath, ': ', '-')
Set @strPath = ' D:\DB_BACKUP_AUTO\YESHARE\ ' + ' db_bak ' [email protected] + '. Bak '
BACKUP DATABASE yeshare to DISK = @strPath with Noinit, Nounload, noskip, STATS = ten, Noformat

Delete old backup 5day ago:

DECLARE @OLDDATE DATETIME
SELECT @OLDDATE = GETDATE ()-5
EXECUTE master.dbo.xp_delete_file 0,n ' D:\DB_BACKUP_AUTO\YESHARE\ ', N ' BAK ', @OLDDATE

In the Advanced tab, set to:

Go to the next step

The other one is:

DECLARE @strPath NVARCHAR (200)
Set @strPath = Convert (NVARCHAR (+), GETDATE (), 120)
Set @strPath = REPLACE (@strPath, ': ', '-')
Set @strPath = ' D:\DB_BACKUP_AUTO\IndustryTradeSystem\ ' + ' db_bak ' [email protected] + '. Bak '
BACKUP DATABASE industrytradesystem to DISK = @strPath with Noinit, Nounload, noskip, STATS = ten, Noformat

When the last execution is complete, select:

Quit the job reporting success

-----

After the above command is done, you need to set what time to execute these commands:

In the Schedules tab,

650) this.width=650; "title=" SQL Server 2.png "src=" http://s3.51cto.com/wyfs02/M02/75/44/wKioL1Y0X6DxQFjuAAOxS_ Wejxo984.jpg "alt=" Wkiol1y0x6dxqfjuaaoxs_wejxo984.jpg "/>

This article is from the "Sulan Network" blog, so be sure to keep this source http://zhangfang526.blog.51cto.com/8588740/1708336

SQL Server Backup

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.