整理了一下rman的所有命令,方便以后来查,大家可以随意转载,记得标明我的链接就行
查看备份
list命令列出控制文件、RMAN恢复目录中备份信息,是我们对所有可见的数据库备份文件的一个最直观的了解的方法
list incarnation of database; --查看对应物
list backup summary;
B 表示backup
A 表示Archivelog、 F 表示full backup、 0,1,2 表示incremental level备份
A 表示可用AVALIABLE、 X 表示EXPIRED
list backup of database summary;
list backup of tablespace summary;
list backup of datafilen,n summary;
list archivelog allsummary;
list backup by file;
list backup;
list expired backup;
list backup datafilen,n,n;
list backup tablespace tablespace_name;
列出copy文件
list copy of database;
list copy of controlfile;
list copy of tablespaceusers;
list copy of datafilen,n,n;
list copy of archivelog all;
list copy of archivelog from scn 10000;
list copy of archivelog until sequence 12;
list recoverable backup of database ; --列车适合恢复的备份
List 相关文件的信息
list backup of{archivelog, controlfile, database, datafile, spfile, tablespace};
list backup of database;--full,incremental,tablespace,datafile
服务器参数文件:
list backup of spfile;
控制文件:
list backup of controlfile;
表空间:
list backup of tablespace tablespace_name;--表空间对应的backup
归档日志:
list backup of archivelog {all, from, high, like, logseq, low, scn, sequence, time, until};
list backup of archivelog all;
list backup of archivelog until time 'sysdate-1';
list backup of archivelog from sequence 10;
list backup of archivelog until sequence 10;
list backup of archivelog from scn 10000;
list backup of archivelog until scn 200000;
list archivelog from scn1000;
list archivelog until scn2000;
list archivelog from sequence 10;
list archivelog until sequence 12;
检查数据库备份
crosscheck backup 核对所有备份集;
crosscheck backup of database 核对所有数据文件的备份集;
crosscheck backup of tablespace users核对特定表空间的备份集;
crosscheck backup of datafile 4 核对特定数据文件的备份集;
crosscheck backup of controlfile 核对控制文件的备份集;
crosscheck backup of spfile 核对SPFILE的备份集;
crosscheck backup of archivelog sequence 3核对归档日志的备份集;
检查归档备份
crosscheck archivelog like 'ARC001.log';
crosscheck archivelog 'D:\ORACLE\ADMIN\RECOVER\ARCH\ARC00012.001';
crosscheck archivelog like '%ARC00012.001';
crosscheck archivelog from time "to_date('01-10-2006', 'mm-dd-yyyy')";
crosscheck archivelog until time "to_date('01-10-2006', 'mm-dd-yyyy')";
crosscheck archivelog from sequence 12;
crosscheck archivelog until sequence 522;
镜像 检测
crosscheck copy 核对所有映像副本;
crosscheck copy of database 核对所有数据文件的映像副本;
crosscheck copy of tablespace users核对特定表空间的映像副本;
crosscheck copy of datafile 6 核对特定数据文件的映像副本;
crosscheck copy of archivelog sequence 4核对归档日志的映像副本;
crosscheck copy of controlfile 核对控制文件的映像副本;
校验备份信息
crosscheck backup tag='SAT_BACKUP';crosscheck backup completed after 'sysdate -2'
crosscheck backup completed between 'sysdate -5' and 'sysdate -2 '
crosscheck backup device type sBT;
Validation of RMANBackups
检查验证备份集
RMAN>validate backupset 2;
We canalso validate all backups in the flash recovery area:
RMAN>validate recovery area;
报告
RMAN> report obsolete; 过期
report用于判断数据库当前可恢复状态、以及数据库已有备份的信息。
最常使用的是report obsolete; report schema;
report {device, need,obsolete, schema, unrecoverable}
report schema;
报告数据库模式
report obsolete;
报告已丢弃的备份集(配置了保留策略)。
report unrecoverable;
报告当前数据库中不可恢复的数据文件(即没有这个数据文件的备份、或者该数据文件的备份已经过期)
report need backup;
报告需要备份的数据文件(根据条件不同)
report need backupdays=3;
--最近三天没有备份的数据文件(如果出问题的话,这些数据文件将需要最近3天的归档日志才能恢复)
report need backupincremental=3;
--需要多少个增量备份文件才能恢复的数据文件。(如果出问题,这些数据文件将需要3个增量备份才能恢复)
report need backupredundancy=3;
--报告出冗余次数小于3的数据文件
--例如数据文件中包含2个数据文件system01.dbf和users01.dbf.
--在3次或都3次以上备份中都包含system01.dbf这个数据文件,而users01.dbf则小于3次
--那么,报告出来的数据文件就是users01.dbf
--即,报告出数据库中冗余次数小于 n 的数据文件
report need backuprecovery window of 2 days;
--报告出恢复需要2天归档日志的数据文件
删除
delete noprompt obsolete;不需要确认
delete obsolete; 删除陈旧备份;
delete expired backup; 删除EXPIRED备份
delete expired copy; 删除EXPIRED副本;
delete backupset 19; 删除特定备份集;
delete backuppiece ''d:\backup\DEMO_19.bak'' 删除特定备份片;
delete backup 删除所有备份集;
delete datafilecopy ''d:\backup\DEMO_19.bak'' 删除特定映像副本;
delete copy 删除所有映像副本;
delete archivelog all delete input;
delete backupset 22 format = ''d:\backup\%u.bak'' delete input
在备份后删除输入对象;
delete backupset id;