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 redundancy 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限定备份集的大小。所以必须大于数据库总数据文件的大小,否则会报错。
RMAN-06183: datafile or datafile copy larger than MAXSETSIZE: file# 1 /data/oradata/system01.dbf
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 ship readonly skip offline ship inaccessible; 跳过脱机,不可存取或只读文件
backup database force; 强制备份
backup database not backed up; 只备没有备份的数据文件
backup database not backed up since time='sysdate-2'; 备份"在限定时间周期内"没有被备份的数据文件
backup check logical database;
backup validate check logical database; 备份操作期间检查逻辑错误
backup database copies=2; 生成备份副本
backup database device type disk includ current controlfile; 备份控制文件
BACKUP DATABASE FORMAT '/tmp/%U', '?/dbs/%U', '?/oradata/%U'; 指定备份文件镜像的不同格式,镜像数量由DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO决定
BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7 FORMAT '/disk1/%U','?/oradata/%U','?/%U'; 指定备份文件镜像的不同格式和镜像个数
configure命令
configure retention policy to recovery window of 7 days;
configure retention policy to redundancy 5;
configure retention policy clear;
CONFIGURE RETENTION POLICY TO NONE;
configure backup optimization on;
configure backup optimization off;
configure backup optimization clear; 默认值为关闭,如果打开,rman将对备份的数据文件及归档等文件进行一种优化的算法。
configure default device type to disk;
configure default device type to stb;
configure default device type clear; 是指定所有I/O操作的设备类型是硬盘或者磁带,默认值是硬盘
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '/cfs01/backup/conf/conf_%F';
configure controlfile autobackup clear;
configrue controlfile autobackup format for device type disk clear;
configrue snapshot controlfile name to '/cfs01/backup/snapcf/scontrofile.snp'; 是配置控制文件的快照文件的存放路径和文件名,这个快照文件是在备份期间产生的,用于控制文件的读一致性。
configrue snapshot controlfile name clear; 强制数据库在备份文件或者执行改变数据库结构的命令之后将控制文件自动备份,默认值为关闭。这样可以避免控制文件和catalog丢失后,控制文件仍然可以恢复。
configure device type disk|stb parallelism 2;
configure device type disk|stb clear;
configure channel device type disk format 'e/:rmanback_%U';
configure channel device type disk maxpiecesize 100m
configure channel device type disk rate 1200K
configure channel 1 device type disk format 'e/:rmanback_%U';
configure channel 2 device type disk format 'e/:rmanback_%U';
configure channel 1 device type disk maxpiecesize 100m
configure datafile backup copies for device type disk|stb to 3;
configure archivelog backup copies for device type disk|stb to 3; 是设置数据库的归档日志的存放设备类型
configure exclude for tablespace 'users';
configrue exclude clear;
configure maxsetsize to 1G|1000M|1000000K|unlimited;
configure maxsetsize clear;
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
Rman的format格式中的%
%c 备份片的拷贝数
%d 数据库名称
%D 位于该月中的第几天 (DD)
%M 位于该年中的第几月 (MM)
%F 一个基于DBID唯一的名称,这个格式的形式为c-IIIIIIIIII-YYYYMMDD-QQ,其中IIIIIIIIII为该数据库的DBID,YYYYMMDD为
日期,QQ是一个1-256的序列
%n 数据库名称,向右填补到最大八个字符
%u 一个八个字符的名称代表备份集与创建时间
%p 该备份集中的备份片号,从1开始到创建的文件数
%U 一个唯一的文件名,代表%u_%p_%c
%s 备份集的号
%t 备份集时间戳
%T 年月日格式(YYYYMMDD)
参考至:http://junfengwang060905.blog.163.com/blog/static/94223330200948345433/
如有错误,欢迎指正
邮箱:[email protected]