将rman备份文件过期_管理过期备份文件的自动化策略

将rman备份文件过期

将rman备份文件过期

Backups are something which, usually, run on a very frequent schedule. If left unmanaged, a direct result of this is a large number files eating up a potentially large amount of hard drive space. Remembering to manually go in and remove backup files certainly is one method of management but shouldn’t be a long term strategy, especially when there are easy to implement automated procedures available.

备份通常需要非常频繁地执行。 如果不加以管理,直接的结果就是大量文件吞噬了潜在的大量硬盘空间。 记住,手动进入并删除备份文件无疑是一种管理方法,但不应作为长期策略,尤其是当存在易于实施的自动化程序时。

There is no ‘one size fits all’ solution for automating the process of deleting expired backup files. Depending on the backup procedure (do you do weekly full and daily incrementals or daily full?) and file naming convention (does your backup file have the date as part of the file name or use the same file name every time?) of your resulting backup files, the applicable method differs.

没有“一刀切”的解决方案来自动删除过期的备份文件。 根据备份过程(您是每周执行一次完整备份还是每天增量执行还是每天执行一次?)和文件命名约定(备份文件是否将日期作为文件名的一部分或每次都使用相同的文件名?)备份文件,适用的方法有所不同。

We are going to point out several simple solutions which fit the most common backup scenarios, so odds are one will be right for you.

我们将指出几种适用于最常见备份方案的简单解决方案,因此很可能是您的最佳选择。

按文件年龄或日期删除 (Deleting by File Age or Date)

When to use: Daily full backups.

使用时间:每日完整备份。

Perhaps the simplest and most logical way to purge expired backups is to base the deletion process on the date of the backup file. We have previously covered this topic using log files as our target files, however it works just as well with backup files.

清除过期备份的最简单,最合乎逻辑的方法也许是将删除过程基于备份文件的日期。 之前我们已经使用日志文件作为目标文件介绍了此主题 ,但是它与备份文件一样工作。

For example, to delete any files in the specified folder not modified within the past week, run this command:

例如,要删除过去一周内未修改的指定文件夹中的任何文件,请运行以下命令:

FORFILES /P “C:Backups” /S /D -7 /C “CMD /C DEL /F /Q @PATH”

文件/ P“ C:备份” / S / D -7 / C“ CMD / C DEL / F / Q @PATH”

Note the keyword above: modified. The ForFiles command is only capable of evaluating the modified file date as opposed to the created date which would be more applicable. Typically, however, you are probably not modifying a backup file after it is created so this will most likely not be an issue.

注意上面的关键字:已修改。 ForFiles命令只能评估修改后的文件日期,而不是创建日期。 但是,通常,创建备份文件后可能不会修改它,因此这很可能不会成为问题。

Alternately, if your backup file has some sort of numeric date pattern specified in the file name (i.e. Backup_2010-01-13.zip, BackupSet_100113_Full.zip, etc.), you can use the DeleteByDatePattern script we provided in the linked article to remove expired backups.

或者,如果您的备份文件在文件名中指定了某种数字日期格式(即Backup_2010-01-13.zip,BackupSet_100113_Full.zip等),则可以使用链接文章中提供的DeleteByDatePattern脚本删除过期的备份。

For example, to delete files older than 2 weeks matching a file name pattern like the following: “Backup_YYYY-MM-DD_(Full | Incremental).zip”, you would use the command:

例如,要删除与文件名模式匹配的超过2周的文件,如下所示:“ Backup_YYYY-MM-DD_(Full | Incremental).zip”,则可以使用以下命令:

DeleteByDatePattern /D 15 “C:Backups” *-????-??- _*.zip /DEL

DeleteByDatePattern / D 15“ C:备份” *-????-????-_ *。zip / DEL

Or if your file naming pattern is: “BackupSet_YYMMDD.zip”, you would use:

或者,如果您的文件命名模式为:“ BackupSet_YYMMDD.zip”,则可以使用:

DeleteByDatePattern /D 15 “C:Backups” *-???? .zip /DEL

DeleteByDatePattern / D 15“ C:备份” *-???? .zip / DEL

Of course, adjust as needed but either of the methods above could easily be added to the start or end of your backup process to keep the number of backups stored manageable.

当然,可以根据需要进行调整,但是可以将上述两种方法轻松地添加到备份过程的开始或结束,以使存储的备份数量易于管理。

文件夹滚动 (Folder Rolling)

When to use: Periodic full backups (weekly, bi-weekly, etc.) with daily incremental backups in between.

什么时候使用:定期完整备份(每周,每两周等),中间有每日增量备份。

The idea behind “folder rolling” is that you store all of your current backup set (full backup + respective incrementals) in a single folder and then have several archive folders where your old backup sets are kept. Prior to a new backup set being created, you delete the folder contents containing oldest backup set and “roll” the contents of each folder down one.

“文件夹滚动”背后的想法是,您将所有当前备份集(完整备份+相应的增量)存储在一个文件夹中,然后有几个归档文件夹,这些文件夹用于保存旧的备份集。 在创建新备份集之前,请删除包含最旧备份集的文件夹内容,然后将每个文件夹的内容“向下滚动”。

For example, suppose we have a current backup folder with two archive folders. The batch script commands to perform the folder roll for this would be:

例如,假设我们有一个带有两个存档文件夹的当前备份文件夹。 用于执行此文件夹滚动的批处理脚本命令为:

DEL /F /Q “C:Backups2archive”MOVE /Y “C:Backups1archive*” “C:Backups2archive”MOVE /Y “C:Backupscurrent*” “C:Backups1archive”

DEL / F / Q“ C:Backups2archive” MOVE / Y“ C:Backups1archive *”“ C:Backups2archive” MOVE / Y“ C:Backupscurrent *”“ C:Backups1archive”

You can add as many archive folders as needed. Just delete the contents of the lowest archive folder add a move command for each of the other archive folders.

您可以根据需要添加任意数量的存档文件夹。 只需删除最低归档文件夹的内容,即可为其他每个归档文件夹添加移动命令。

Again, this works best for situations where you create a periodic full backup and the a number of incremental backups up until your next full backup. Simply drop all your related backup files into a single folder and the run the folder roll script right before you create a new backup set.

同样,这最适合以下情况:创建定期的完全备份,并创建多个增量备份,直到您下一次完全备份为止。 只需将所有相关的备份文件拖放到一个文件夹中,然后在创建新的备份集之前运行文件夹滚动脚本。

备份9 (Backup9)

When to use: Daily full backups or individual file backups.

使用时间:每日完整备份或单个文件备份。

Backup9 is a free command line utility developed by Gammadyne. Similar to the folder rolling process above, the idea behind this utility is simple in that when it is run, a copy of the target file is created with a number appended to the end. Additionally, you specify a cut-off of the number of copies to keep with the default being 9 (hence the name).

Backup9是Gammadyne开发的免费命令行实用程序。 与上面的文件夹滚动过程类似,此实用程序的想法很简单,因为在运行该实用程序时,将创建目标文件的副本,并在其末尾附加一个数字。 此外,您还指定了保留份数的截止值,默认值为9(因此为名称)。

An example will best explain this process. Using the following command would produce the output below:

一个例子将最好地解释这个过程。 使用以下命令将产生以下输出:

BACKUP9 /A /L7 “C:BackupsBackupFile.zip”

BACKUP9 / A / L7“ C:BackupsBackupFile.zip”

image
image

If this command were run again, the following would happen:

如果再次运行此命令,则会发生以下情况:

  1. The number of files to keep (7 in our example) is evaluated and if there are currently that many copies, the last one is dropped.

    评估要保留的文件数(在我们的示例中为7),如果当前有那么多副本,则删除最后一个副本。
  2. BackupFile.zip.bk7 is deleted.

    BackupFile.zip.bk7被删除。
  3. BackupFile.zip.bk6 is renamed to BackupFile.zip.bk7

    BackupFile.zip.bk6重命名为BackupFile.zip.bk7
  4. BackupFile.zip.bk[#] is renamed to BackupFile.zip.bk[#+1]

    BackupFile.zip.bk [#]重命名为BackupFile.zip.bk [#+ 1]
  5. BackupFile.zip.bk1 is renamed to BackupFile.zip.bk2

    BackupFile.zip.bk1重命名为BackupFile.zip.bk2
  6. BackupFile.zip is copied and named BackupFile.zip.bk1

    复制BackupFile.zip并将其命名为BackupFile.zip.bk1

With the ability to keep up to 999 copies, this utility works very well if you have a file with a static name. You simply add the Backup9 command to the beginning or end of your backup process it takes care of keeping up with the appropriate number of archive copies.

最多可以保留999个副本,如果您的文件带有静态名称,则该实用程序可以很好地工作。 您只需将Backup9命令添加到备份过程的开始或结束,即可确保跟上适当数量的归档副本。

Belvedere自动文件管理器 (Belvedere Automated File Manager)

When to use: Daily full backups.

使用时间:每日完整备份。

Belvedere automated file manager is a utility which runs in the background monitoring file system active and performs configured actions when specified conditions are met. Among its many uses are cleaning up expired backup files.

Belvedere自动化文件管理器是一个实用程序,可在活动的后台监视文件系统中运行,并在满足指定条件时执行配置的操作。 它的许多用途是清理过期的备份文件。

The configuration of the rules are pretty straightforward. For example, to create a rule to delete backup files using a file name pattern such as “BackupSet_Jan13.zip” which are older than 2 weeks, you could use the following:

规则的配置非常简单。 例如,要创建规则以使用文件名模式(例如“ BackupSet_Jan13.zip”)删除文件的时间超过2周,则可以删除以下文件:

image

While the basic function we are performing can easily be done with command line tools described above, the obvious difference is that Belvedere provides an easy to use graphical interface for those more comfortable with pointing and clicking.

尽管我们正在执行的基本功能可以通过上述命令行工具轻松完成,但是明显的区别是Belvedere为那些更喜欢指向和单击的用户提供了易于使用的图形界面。

Belvedere is designed as a desktop user application which runs from the system tray, however you can run Belvedere as a service and use it on servers to perform this and other file monitoring operations.

Belvedere被设计为从系统托盘运行的桌面用户应用程序,但是您可以将Belvedere作为服务运行,并在服务器上使用它来执行此和其他文件监视操作。

结论 (Conclusion)

While there are a myriad number of ways you can manage your backup expiration process, the methods we have described above are both flexible and easy to implement. With a bit of experimentation, find what works for you and go with it so you can just set it and forget it.

尽管有许多方法可以管理备份过期过程,但是我们上面描述的方法既灵活又易于实现。 经过一些试验,找到适合您的方法并进行选择,这样您就可以设置它而忘了它。

链接 (Links)

Download Backup9 from Gammadyne.com

从Gammadyne.com下载Backup9

Download Belvedere from Lifehacker.com

从Lifehacker.com下载Belvedere

翻译自: https://www.howtogeek.com/50933/automated-strategies-for-managing-outdated-backup-files/

将rman备份文件过期

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值