标签:sql server backup management studio
首先我们可以参考:
http://blog.sina.com.cn/s/blog_816780b40101m4jb.html
再次, 其中有些错误 需要更正,具体的命令请参考:
其中的全部的步骤是:
首先要编辑backup_YESHARE:
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ‘:‘ , ‘-‘)
set @strPath = ‘D:\DB_BACKUP_AUTO\YESHARE\‘ +‘DB_Bak‘ +@strPath + ‘.bak‘
BACKUP DATABASE YESHARE TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
删除旧有备份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
在advanced标签中,设置为:
Go to the next step
另外一个为:
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ‘:‘ , ‘-‘)
set @strPath = ‘D:\DB_BACKUP_AUTO\IndustryTradeSystem\‘ +‘DB_Bak‘ +@strPath + ‘.bak‘
BACKUP DATABASE IndustryTradeSystem TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
最后一个执行完毕后选择:
quit the job reporting success
-----
以上命令搞定后u,需要设置什么时间执行这些命令:
在schedules标签中,
本文出自 “苏兰网络” 博客,请务必保留此出处http://zhangfang526.blog.51cto.com/8588740/1708336
标签:sql server backup management studio
原文地址:http://zhangfang526.blog.51cto.com/8588740/1708336