Oracle delete input与delete all input

时间:2021-01-16 15:43:06

oracle官方文档提示:
If you had specified DELETE INPUT rather than DELETE ALL INPUT, then RMAN would have only deleted the specific archived redo log files that it backed up. For example, RMAN would delete the logs in /arc_dest1 if these files were used as the source of the backup, but leave the contents of the /arc_dest2 intact
如果指定delete input ,则rman将仅删除已备份的归档日志,例如对于有两个归档目录 /arc_dest1 和 /arc_dest2 如果把/arc_dest1做为backup的源,delete input将删除 /arc_dest1 中的内容,保留dest2中的归档日志,通过实验可以看出,就算有两个归档位置,rman备份的时候貌似是以日志文件为源,备份过的日志删除。
------------------------------------------------------------
If you had specified DELETE ALL INPUT RMAN backs up only one copy of each log sequence number in these archiving locations.it deletes all copies of any log that it backed up from the other archiving destinations
如果指定delete all input RMAN对于所有归档目录中的日志序列号只备份一次,同时rman会删除dest1 和dest2 中所有归档日志。
结论:对于仅有一个归档目录 delete input 和delet all input 没啥区别。

==================
观察如下两条备份语句
1)backup as compressed backupset filesperset 4 incremental level=1 cumulative database plus archivelog delete input;
2)backup as compressed backupset filesperset 4 incremental level 1 database;
backup as compressed backupset archivelog all delete all input;
语句1是一个累积备份,语句2是一个差异1备份。备份结束后都希望备份归档日志同时在删除已备份的归档日志。区别在于语句1使用delete input,语句2使用delete all input
举一列子,如周1、2、4使用语句2,进行差异备份。 周3使用语句1进行累积备份。则这样周1、2只会备份当天生成的归档日志,周3同样只会备份当天生成的归档日志,而周4会备份周3、4两天生成的归档日志。
究其原因是,本身对归档日志实现了多路复用,即不知在FRA中生成归档日志,在其他路径中同样生成归档日志。而delete input 只会删除默认路径即FRA中的归档日志,其他路径中的归档日志会保留。所以当周4再备份归档日志时,会将在其他路径中保留的昨日的归档日志与今日生成的归档日志同时备份。此种情况会导致归档日志被重复备份,浪费存储资源。
所以当针对归档日志实现了多路复用时,应使用delete all input 进行归档日志的清理