日期:2014-05-18 浏览次数:20539 次
--删除过期的备份文件,每天两次 declare @str varchar(100),@dir varchar(100),@fileName varchar(30) set @dir='del D:\DBtext\jgj\DBABak\' set @filename=left(replace(replace(replace(convert(varchar,getdate()-15,20),'-',''),' ',''),':',''),8) set @str=@dir+'fullbak'+@filename+'*.bak' exec xp_cmdshell @str set @filename=left(replace(replace(replace(convert(varchar,getdate()-8,20),'-',''),' ',''),':',''),8) set @str=@dir+'diffbak'+@filename+'*.diff' exec xp_cmdshell @str set @filename=left(replace(replace(replace(convert(varchar,getdate()-8,20),'-',''),' ',''),':',''),8) set @str=@dir+'logbak'+@filename+'*.trn' exec xp_cmdshell @str