日期:2014-05-16  浏览次数:20424 次

RMAN 备份恢复

1:RMAN 基本命令

run{
allocate channel ch1 device type disk maxpiecesize 2G;
allocate channel ch2 device type disk maxpiecesize 2G;
allocate channel ch3 device type disk maxpiecesize 2G;
backup as compressed backupset incremental level 0 database format='E:\backup\inc0_%U' tag='Inc0'  skip inaccessible   include current controlfile  ; --差异增量备份
--backup as compressed backupset incremental level 0 cumulative  database format='E:\backup\inc0_%U' tag='Inc0'  skip inaccessible   include current controlfile  ;--累积增量备份
backup archivelog all   format 'E:\backup\arch_%D_%U' tag 'arch_full_070628'   delete input;    
}


Format &tag

The most common substitution variable is %U, which generates a unique name. Others include %d for the DB_NAME, %t for the backup set time stamp, %s for the backup set number, and %p for the backup piecenumber.

show all--显示oracleRMAN配置信息

RMAN> show all;

db_unique_name 为 ACE 的数据库的 RMAN 配置参数为:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:\ORACLE\11GR2\DATABASE\SNCFACE.ORA'; # default

list backup summary--展示备份内容

RMAN> list backup summary;


备份列表
===============
关键字     TY LV S 设备类型 完成时间   段数 副本数 压缩标记
------- -- -- - ----------- ---------- ------- ------- ---------- ---
7       B  0  A DISK        08-3月 -13 1       1       YES        INC0
9       B  A  A DISK        08-3月 -13 1       1       NO         ARCH_FULL_070628
10      B  A  A DISK        08-3月 -13 1       1       NO         ARCH_FULL_070628
11      B  A  A DISK        08-3月 -13 1       1       NO         ARCH_FULL_070628
12      B  A  A DISK        08-3月 -13 1       1       NO         ARCH_FULL_070628
13      B  0  A DISK        08-3月 -13 1       1       YES        INC0
14      B  0  A DISK        08-3月 -13 1       1       YES        INC0



VALIDATE &DBV

RMAN> VALIDATE  backupset 17;

启动 validate 于 08-3月 -13
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在开始验证数据文件备份集
通道 ORA_DISK_1: 正在读取备份片段 E:\BACKUP\INC0_0IO415QS_1_1
通道 ORA_DISK_1: 段句柄 = E:\BACKUP\INC0_0IO415QS_1_1 标记 = INC0
通道 ORA_DISK_1: 已还原备份片段 1
通道 ORA_DISK_1: 验证完成, 用时: 00:00:46
完成 validate 于 08-3月 -13

crosscheck backup--备份交叉检查