show all;
----显示目标数据库的备份配置信息用策略。
report用于判断数据库当前可恢复状态、以及数据库已有备份的信息。
RMAN> report schema; --表空间
Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 710 SYSTEM *** +DATA/orcl/datafile/system.260.834214595
2 600 SYSAUX *** +DATA/orcl/datafile/sysaux.261.834214997
3 345 UNDOTBS1 *** +DATA/orcl/datafile/undotbs1.262.834215347
4 5 USERS *** +DATA/orcl/datafile/users.264.834215541
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 64 TEMP 32767 +DATA/orcl/tempfile/temp.263.834215483
RMAN> report obsolete; -- 过期备份
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found
RMAN> report unrecoverable; --报告不可恢复的
Report of files that need backup due to unrecoverable operations
File Type of Backup Required Name
---- ----------------------- -----------------------------------
RMAN> report need backup; --报告需要备份的
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 +DATA/orcl/datafile/system.260.834214595
2 0 +DATA/orcl/datafile/sysaux.261.834214997
3 0 +DATA/orcl/datafile/undotbs1.262.834215347
4 0 +DATA/orcl/datafile/users.264.834215541
RMAN> report need backup days=3; --报告最近三天没有备份的
Report of files whose recovery needs more than 3 days of archived logs
File Days Name
---- ----- -----------------------------------------------------
1 146 +DATA/orcl/datafile/system.260.834214595
2 146 +DATA/orcl/datafile/sysaux.261.834214997
3 146 +DATA/orcl/datafile/undotbs1.262.834215347
4 146 +DATA/orcl/datafile/users.264.834215541
RMAN> report need backup incremental=3; --如果出了问题 需要多少个增量备份文件才能恢复的数据文件 。(如果出问题,这些数据文件将需要3个增量备份才能恢复)
Report of files that need more than 3 incrementals during recovery
File Incrementals Name
---- ------------ ----------------------------------------------
backup常用命令
backup database tag='20140510_bak_all'; ----备份整个库 并且打上tag tag需要唯一
backup database keep forever; --永久保留备份文件
backup database keep until time='sysdate+7'; --保存备份7天
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup database format 'bak/full_%u_%T.bak';
backup spfile format 'bak/spfile_%u_%T.bak';
backup current controlfile format 'bak/ctl_%u_%T.bak';
sql 'alter system archive log current';
backup archivelog all delete input format 'bak/arc_%u_%T.bak';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}