RMAN常用命令:
连接到目标数据库(不使用恢复目录数据库)
$rman target / nocatalog
显示rman配置
RMAN> show all;
报告目标数据库的物理结构
RMAN> report schema;
报告陈旧备份
RMAN> report obsolete;
报告不可恢复的数据文件
RMAN> report unrecoverable;
列出备份信息
RMAN> list backup;
RMAN> list backup of database;
RMAN> list backup of tablespace table_name;
RMAN> list backup of controlfile;
RMAN> list backup of spfile;
RMAN> list backupset id;
校验备份
RMAN> crosscheck backup;
RMAN> crosscheck backup of database;
RMAN> crosscheck backup of tablespace system;
RMAN> crosscheck backup of controlfile;
RMAN> crosscheck backup of spfile;
RMAN> crosscheck backup of archivelog all;
校验没有备份过的归档日志
RMAN>crosscheck archivelog all;
RMAN>delete noprompt expired archivelog all;
刪除所有的Archivelog files
RMAN> delete archivelog all;
強制刪除前一天以前的archivelog files
RMAN> delete force archivelog until time 'sysdate -1';
RMAN> delete noprompt force archivelog until time 'sysdate -2';
刪除所有过期的Archivelog files
RMAN> delete expired archivelog all;
删除备份
RMAN> delete obsolete; -- 删除陈旧备份
RMAN> delete noprompt obsolete;
RMAN> delete expired backup;
--删除所有expired的备份(包括归档日志、控制文件、备份聚)
RMAN> delete expired ;
RMAN> delete backupset id;
RMAN> delete backup; -- 删除所有备份
改变备份集的状态
RMAN> change backupset id unavailable;
改为长期备份
RMAN> change backupset id keep forever logs;
RMAN> change backupset id keep until time 'sysdate+30' logs;
RMAN> change backupset id nokeep;
基于时间:
RMAN>configure retention policy to recovery window of 30 days;
基于冗余数量:
CONFIGURE RETENTION POLICY TO REDUNDANCY n ;
取消备份保留策略:
CONFIGURE RETENTION POLICY TO NONE;
设置归档日志存放在其它位置
set archivelog destination to 'e:temp';