RMAN命令DELETE操作总结

RMAN命令DELETE操作总结
本篇总结⼀下RMAN命令中的DELETE操作,DELETE命令⽤于删除RMAN备份记录以及相应的物理⽂件。
To delete physical backups and copies as well as do the following:
1: Update their repository records in the target control file to status DELETED
2: Remove their repository records from the recovery catalog (if you use a catalog)
When running RMAN interactively, DELETE displays a list of the files and prompts
you for confirmation before deleting any file in the list. When reading commands from
a command file, RMAN will not prompt for confirmation.
DELETE removes the physical files from the backup media, deletes the record of
the backup from the recovery catalog (if RMAN is connected to a recovery catalog),
and updates the records of these backups in the control file to status DELETED
删除归档⽇志
删除某个Sequence之前(包含该Sequence)的归档⽇志
RMAN>delete archivelog until sequence xxx;
RMAN>delete archivelog from sequence xxx until  sequence xxx;
删除系统时间1天以前的归档⽇志,不会删除闪回区有效的归档⽇志(可以指定删除多久⽇志)
RMAN>delete archivelog all completed before 'sysdate-1';
force参数表⽰会删除有效归档⽇志
RMAN>delete force archivelog all completed before 'sysdate-1';
删除某个时间段的归档⽇志,例如删除20天前到2天前的归档⽇志。
RMAN>delete archivelog from time 'sysdate-20' until time 'sysdate-2';
RMAN>delete archivelog from time 'sysdate-1';
注意:此命令会删除闪回区的有效归档⽇志。
删除所有的归档⽇志。
RMAN>delete noprompt archivelog all;
RMAN>delete noprompt archivelog all completed before 'sysdate';
RMAN> delete expired archivelog all;
注意:delete expired archivelog all  实际上此命令不会真正删除归档⽇志,它删除的是那些本来RMAN以为存在但是实际上在磁盘或者磁带上已经被删除了⽂件的信息,实际删除的只是RMAN资料库或控制⽂件中的记录;
RMAN> delete obsolete;
RMAN> delete noprompt obsolete;
注意:delete obsolete这个是清理过期备份,它也会删除过期的归档⽇志。但是特殊情况下,除闪回区有效的归档⽇志不会删除。
上⾯都是使⽤RMAN命令删除归档⽇志,最后⼀种⽅式,也是最不推荐的⼀种⽅式就是使⽤命令从系统系统删除归档⽇志,使⽤rm删除了备份⽂件后,需要执⾏crosscheck archivelog all命令校检归档⽇志是否失效。
删除备份
删除过期备份
删除过期备份,RMAN会根据备份冗余策略确定备份是否过期。然后删除过期的备份。
RMAN> report obsolete;
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                Key Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set          1      18-MAY-17
Backup Piece      1      18-MAY-17          /u03/backup/backupsets/ora_df944345823_s1_s1
Control File Copy    1      18-MAY-17          /u03/backup/py
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u03/backup/backupsets/ora_df944345823_s1_s1 recid=1 stamp=944345824
deleted control file copy
control file copy filename=/u03/backup/py recid=1 stamp=944347366
Deleted 2 objects
删除⽆效备份
RMAN> delete expired backup;
关于delete obsolete 与delete expired backup的区别:
备份集有两种状态A(Available,RMAN认为该项存在于备份介质上), X(Expired,备份存在于控制⽂件或恢复⽬录中,但是并没有物理存在于备份介质上),⼀般要运⾏CROSSCHECK才能检查,关于delete expired与delete obsolete的区别
delete obsolete 会删除旧于备份保留策略定义的备份数据同时也更新RMAN资料库以及控制⽂件。
delete expired 删除的是那些本来RMAN以为存在但是实际上在磁盘或者磁带上已经被删除了的信息,删除的只是RMAN资料库中的记录信息,也就是说delete expired是不会删除备份集⽂件的。
英⽂相关资料资料如下:
RMAN> delete obsolete;
Removes only files whose status in the repository is EXPIRED. RMAN marks backups and copies as
expired when you run a CROSSCHECK command and the files are absent or inaccessible. To determine which files are expired, run a LIST EXPIRED command. RMAN> delete obsolete;
Deletes data file backups and copies recorded in the RMAN repository that are obsolete, that is, no longer needed (see Example 2-66). RMAN also deletes obsolete archived redo log files and log backups.
RMAN determines which backups and copies of data files are no longer needed, which in turn determines when logs (and backups of logs) are no longer needed. RMAN considers the creation of a data file as a backup when deciding which logs to keep.
RMAN first uses the options specified with obsOperandList to determine which files are obsolete. If you do not specify options in obsOperandList, then RMAN uses the options specified in CONFIGURE RETENTION POLICY.
Note: DELETE OBSOLETE considers only the backup retention policy and does not use the configured archived log deletion policy to determine which logs are obsolete. In contrast, DELETE ARCHIVELOG ALL considers only the configured archived log deletion policy. Note: If you make a backup with the KEEP UNTIL TIME clause, then this backup becomes obsolete after the specified K
EEP time passes
and is removed by DELETE OBSOLETE. RMAN does not consider the backup retention policy for archival backups whose KEEP time has expired.
删除EXPIRED副本
RMAN> delete expired copy;
删除特定印象副本
RMAN> delete datafile copy 'xxxxxxxxxxx';
删除特定备份集
RMAN> delete backupset 24;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
24      24      1  1  AVAILABLE  DISK        /u01/app/oracle/flash_recovery_area/GSP/backupset/kerryfull_GSP_20170520_25
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/GSP/backupset/kerryfull_GSP_20170520_25 RECID=24 STAMP=944472557
Deleted 1 objects
删除特定备份⽚
RMAN> delete backuppiece '/u01/app/oracle/flash_recovery_area/GSP/backupset/kerryfull_GSP_20170520_26';
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
25      25      1  1  AVAILABLE  DISK        /u01/app/oracle/flash_recovery_area/GSP/backupset/kerryfull_GSP_20170520_26
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/GSP/backupset/kerryfull_GSP_20170520_26 RECID=25 STAMP=944472653
Deleted 1 objects
删除所有备份集
RMAN> delete backup;
RMAN> delete noprompt backup;
删除所有备份⽂件副本
RMAN> delete datafilecopy all;
删除某个备份⽂件副本
RMAN> delete datafilecopy xxx;

本文发布于:2024-09-25 22:26:36,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/3/95461.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:删除   备份   归档
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议