压缩备份文件并删除较旧的文件 [英] compress backup files and delete older ones
问题描述
你好,我的朋友们,
我有个问题.我每天都有一份备份数据库的工作.
为了限制硬盘上的分区驱动器,我想写另一个工作来做这些活动:
1.压缩我的每日备份文件
2.删除我15年前的文件
我的sql服务器是以下计算机之一:2000和2005
我的备份工作是:
< pre>
< pre lang ="sql">
声明@path nvarchar(1000)
设置@ path =' D:\ MySolution \ data \ Backup \ Auto \ mainserver _' + convert(nvarchar(10),getdate(),112)+' .bak' ;
备份数据库[mainserver]到磁盘= @ path with INIT
</pre>
</pre>
请帮助我
Hello my friends,
I have a problem. I have a job that back''s up my database everyday.
For limitiation of my partition drive on harddisk, I want to write another job to do these activities:
1.compress my daily backup file
2.delete my files that are older than 15 years ago
my sql server is one of : 2000 and 2005
my job for backup is :
<pre>
<pre lang="sql">
declare @path nvarchar(1000)
set @path='D:\MySolution\data\BackUp\Auto\mainserver_'+convert(nvarchar(10),getdate(),112)+'.bak'
BACKUP DATABASE [mainserver] TO DISK =@path WITH INIT
</pre>
</pre>
Please help me
推荐答案
取决于您使用的SQL Server版本,您也许可以使用维护计划.尽管我不确定压缩情况,但它肯定会删除较旧的备份.
Depending on which version of SQL Server you have, you might be able to use a Maintenance Plan. It will certainly do the deletion of older backups although I''m not sure about the compression.
这篇关于压缩备份文件并删除较旧的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!