RMAN命令大全
#######################################################################################################
list命令
可以用于查看对应文件的信息,backup,copy,archivelog等
===================================================
list incarnation
===========================
list incarnation;
list incarnation of database;
list incarnation of database 'ORA9I';
===================================================
list backup
===========================
list backup;
list backup of database;
list backup of tablespace 'SYSTEM','USERS';
list backup of datafile 1,3,7;
list backup of datafile 'e:oracleoradataora9isystem01.dbf','e:oracleoradataora9iusers01.dbf';
list backup of controlfile;
list backup of spfile;
list backup of archivelog all;
list backup of archivelog like '%.log';
list backup of archivelog like '%.log';
list backup of archivelog from time 'sysdate-14';
list backup of archivelog until time 'sysdate-7';
list backup of archivelog from time 'sysdate-14' until time 'sysdate-7';
list backup of archivelog from scn 10000;
list backup of archivelog until scn 11000;
list backup of archivelog from scn 10000 until scn 11000;
list backup of archivelog from logseq 135;
list backup of archivelog until logseq 139;
list backup of archivelog from logseq 135 until logseq 139;
list backup completed after 'sysdate -14';
list backup completed before 'sysdate -7';
list backup completed between 'sysdate -14' and 'sysdate-7';
list backup of archivelog time between "to_date('2009-06-24 08:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2009-06-24 13:00','yyyy-mm-dd hh24:mi:ss')";
list backup tag=WHOLE_COLDBACK;
list backup recoverable;
list backup device type disk;
list backup completed after 'sysdate-14' tag=WHOLE_COLDBACK device type disk recoverable;
===================================================
list copy example
===========================
list copy;
list copy of database;
list copy of tablespace 'SYSTEM','USERS';
list copy of datafile 1,3,7;
list copy of datafile 'e:oracleoradataora9isystem01.dbf','e:oracleoradataora9iusers01.dbf';
list copy of controlfile;
list copy of spfile;
list copy of archivelog all;
list copy of archivelog like '%.log';
list copy of archivelog from time 'sysdate-14';
list copy of archivelog from time "to_date('07-11-2004','mm-dd-yyyy')";
list copy of archivelog until time 'sysdate-7';
list copy of archivelog from time 'sysdate-14' until time 'sysdate-7';
list copy of archivelog from scn 10000;
list copy of archivelog until scn 11000;
list copy of archivelog from scn 10000 until scn 11000;
list copy of archivelog from logseq 135;
list copy of archivelog until logseq 139;
list copy of archivelog from logseq 135 until logseq 139;
list copy completed after 'sysdate -14';
list copy completed before 'sysdate -7';
list copy completed between 'sysdate -14' and 'sysdate-7';
list copy tag=WHOLE_COLDBACK;
list copy recoverable;
list copy device type disk;
list copy completed after 'sysdate-14' tag=WHOLE_COLDBACK device type disk recoverable;
================================================
list backup summary
===========================
list backup summary;
list backup of database summary;
list backup of tablespace users summary;
list backup of datafile 9 summary;
list backup of archivelog all summary;
list backup of controlfile summary;
list backup of spfile summary;
B表示backupF表示FULL
A表示archive log
0 1表示incremental backup
S说明备份状态(A AVAILABLE X EXPIRED )
=======================================================
list others
===========================
list expired backup;
list expired backup of archivelog all summary;
list backup by file;
list archivelog all;
list backupset;
#######################################################################################################
report命令
==================================================
report schema 报告目标数据库的物理结构;
report need backup days=3; 报告最近3天没有被备份的数据文件;
report need backup incremental 3; 报告恢复数据文件需要的增量备份个数超过3次的数据文件;
report need backup redundancy 2 database; 报告备份文件低于2份的所有数据文件;
report unrecoverable; 报告数据库所有不可恢复的数据文件,即没有这个数据文件的备份、或者该数据文件的备份已经过期;
report obsolete redunndancy 2; 报告备份次数超过2次的陈旧备份;
report obsolete; 报告多余的备份;
report need backup days 3 tablespace users; 在USERS表空间上3天未备份的数据文件;
report need backup recovery window of 6 days; 报告文件报表的恢复需要超过6天的归档日志的数据文件;
#######################################################################################################
crosscheck命令
==================================================
crosscheck backup
crosscheck backup of database
crosscheck backup of tablespace users
crosscheck backup of datafile 4
crosscheck backup of controlfile
crosscheck backup of spfile
crosscheck backup of archivelog sequence 3
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;
crosscheck archivelog all;
crosscheck archivelog like '%ARC00012.001'
crosscheck archivelog from sequence 12;
crosscheck archivelog until sequence 522;
#######################################################################################################
delete 命令
==================================================
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 backupset 22 format = ''d:\backup\%u.bak'' delete input 在备份后删除输入对象
delete backupset id;
delete archivelog all delete input;
#######################################################################################################
backup命令
==================================================
backup database tag='full_bak1'; 设置备份标记。 注:每个标记必须唯一,相同的标记可以用于多个备份只还原最新的备份。
backup database maxsetsize=100m tag='datafile1'; 设置备份集大小。一次备份的所有结果为一个备份集,要注意备份集大小。 注:maxsetsize限定备份集的大小。所以必须大于数据库总数据文件的大小,否则会报错。
run {
allocate channel c1 type disk maxpicecsize 100m format '/data/backup/full_0_%U_%T';
backup database tag='full_0';
release channel c1;
}
设置备份片大小(磁带或文件系统限制), 可以在allocate子句中设定每个备份片的大小,以达到磁带或系统限制。也可以在configure中设置备份片大小。
backup database keep forever; 永久保留备份文件
backup database keep until time='sysdate+30'; 保存备份30天
backup databas noexclude keep forever tag='test backup'; 重写configure exclude命令
backup validate database; 使用RMAN来扫描数据库的物理/逻辑错误,并不执行实际备份。
backup database skip readonly; 跳过只读文件
backup database skip offline; 跳过脱机文件
backup database skip inaccessible; 跳过不可存取文件
backup database skip readonly skip offline skip inaccessible; 跳过脱机,�