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/backupsets/controlfile.copy
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/backupsets/controlfile.copy 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 KEEP 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;
RMAN命令DELETE操作总结的更多相关文章
- RMAN命令LIST操作总结
在使用RMAN备份.还原的过程中,我们经常需要查看备份的一些详细信息,例如,RMAN提供了LIST命令.关于LIST命令的详细信息 可以参考Oracle Database Backup and Rec ...
- RMAN命令
一.启动.关闭数据库 在RMAN中执行关闭和启动数据库的命令与SQL环境下一模一样.当然,在执行之前,你需要先连接到目标数据库,如例: C:\Documents and Settings\Admini ...
- RMAN命令总结
一,RMANR 连接到库 1),连接本地数据库 a,如果本地有多少实例,则需要设置环境变量ORACLE_SID, windows 平台: set ORACLE_SID= INSTANACE NAME ...
- RMAN命令详解和常用汇总
RMAN命令详解和常用汇总转摘汇集,日后使用本文链接:https://blog.csdn.net/EVISWANG/article/details/50448370http://blog.itpub. ...
- 【Oracle】 RMAN命令汇总
RMAN命令汇总 2013年写了关于RMAN命令的汇总,先转换为MD文档,温故而知新. 1.进入RMAN 进入本地数据库 [oracle@oracle-n1 ~]$ rman target / 进入远 ...
- Oracle手边常用命令及操作语句
Oracle手边常用命令及操作语句 作者:白宁超 时间:2016年3月4日11:24:08 摘要:日常使用oracle数据库过程中,常用脚本命令莫不是用户和密码.表空间.多表联合.执行语句等常规操作. ...
- mysql 命令行操作入门(详细讲解版)
之前分享过多次Mysql主题,今天继续分享mysql命令行入门 1. 那么多mysql客户端工具,为何要分享命令行操作? -快捷.简单.方便 -在没有客户端的情况下怎么办 -如果是mysql未开启 ...
- 表上的DELETE操作
在今天的文章里,我想给你快速展示下当我们从表里删除记录时,在SQL Server里发生了什么.首先我们来创建一个简单的表,在8KB的页上刚好能插入4条记录. -- Create a simple ta ...
- Ant命令行操作
Ant命令行操作 Ant构建文件可以将项目编译,打包,測试,它是Apache软件基金会jakarta文件夹中的一个子项目,具有跨平台性,操作简单,并且非常easy上手. 关于Ant执行,能够在项目中找 ...
随机推荐
- Android中设置控件的背景颜色的方式整理
版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 在Android开发中,经常需要设置控件的背景颜色或者图片的src颜色. 效果图 代码分析 根据使用的方法不同,划分为 setBackgro ...
- border-image属性把边框的背景设置为图片
一.浏览器对它的支持Firefox3.5-Firefox15 需要加-moz-前缀Firefox15以上 同样支持-moz-前缀的css代码,但是必须在css代码中加 ...
- [NewLife.XCode]事务处理(算准你的每一分钱)
NewLife.XCode是一个有10多年历史的开源数据中间件,支持nfx/netstandard,由新生命团队(2002~2019)开发完成并维护至今,以下简称XCode. 整个系列教程会大量结合示 ...
- 痞子衡嵌入式:恩智浦LPC系列MCU开发那些事 - 索引
大家好,我是痞子衡,是正经搞技术的痞子.本系列痞子衡给大家介绍的是恩智浦LPC系列微控制器相关知识. 恩智浦半导体最早于2003年便开始推出LPC系列MCU,但早期的产品LPC2000/3000系列属 ...
- spring学习(一) ———— IOC讲解
spring基本就两个核心内容,IOC和AOP.把这两个学会了基本上就会用了. --WH 一.什么是IOC? IOC:控制反转,通俗点讲,将对象的创建权交给spring,我们需要new对象,则由spr ...
- 从2PC到Paxos
在分布式系统中,一个事务可能涉及到集群中的多个节点.单个节点很容易知道自己执行的事务成功还是失败,但因为网络不可靠难以了解其它节点的执行状态(可能事务执行成功但网络访问超时). 若部分节点事务执行失败 ...
- Perl分片技术
分片(slice) 在perl中,如果想要取得一部分变量.一部分列表内容.一部分hash内容,可以采用分片(切片)的方式. 注意,perl并未提供字符串的切片方式,但可以使用内置函数substr()来 ...
- Linux常用命令汇总(一)
线程操作 1.ps ps -ef 查看当前活动进程 ps -ef | grep [线程关键信息] ps -ef | grep java 查看java相关进程 2.kill killall -9 jav ...
- “笨方法”学习Python笔记(1)-Windows下的准备
Python入门书籍 来自于开源中国微信公众号推荐的一篇文章 全民Python时代,豆瓣高级工程师告诉你 Python 怎么学 问:请问你目前最好的入门书是那本?有没有和PHP或者其他语言对比讲Pyt ...
- [心得]如何快速利用SqlMap做安全檢測
SqlMap的介紹我就不詳提啦!SqlMap是用來尋找與做Sql-injection的一款工具 在使用前你需要安裝python唷!安裝的過程我們就不介紹了. 直接來看如何快速使用SqlMap吧! 這裡 ...