知识要点
- 显示环境变量
- 保留策略
- 并行设置
- 冗余备份
- 优化
- 压缩
- RUN语句使用
显示环境变量
RMAN> show all;
RMAN configuration parameters for database with db_unique_name SKY2 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;
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
roduct/11.2.0/dbhome_1/dbs/snapcf_
基础配置
保留策略
–备份文件保留10天
configure retention policy to recovery window of 10 days;
–冗余度是2
CONFIGURE RETENTION POLICY TO redundancy 2;
自动备份控制文件
-控制文件在数据库结构发生变化的时候会改变
–可以在RMAN中定义控制文件自动备份
configure controlfile autobackup on;
create tablespace u02 datafile ‘/u01/app/oracle/oradata/sky2/u02’ size 50m;
drop tablespace u2 including contents and datafiles;
list backup of controlfile;
并行设置
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
基于冗余的备份
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2; # default
–定义通道
configure channel 1 device type disk format ‘/u01/%U’,’/u01/app/%U’;
–把OMF定义的db_recovery_file_dest置为空
alter system set db_recovery_file_dest=”;
优化
CONFIGURE BACKUP OPTIMIZATION ON;
压缩
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
加密备份
CONFIGURE ENCRYPTION FOR DATABASE ON;
RUN语句的使用
定义两个通道
run
{
allocate channel a1 type disk;
allocate channel a2 type disk;
backup database;
release channel a1;
release channel a2;
}
可以放在文件中,如a.bak
rman target / @a.bak
定义单个备份片的最大大小
run
{
allocate channel a1 type disk maxpiecesize 1g;
allocate channel a2 type disk maxpiecesize 1g;
backup database;
release channel a1;
release channel a2;
}
定义一个备份集包含的文件数
run
{
allocate channel a1 type;
allocate channel a2 type;
backup database filesperset 3;
release channel a1;
release channel a2;
}
检查备份
crosscheck backup;
删除到期
delete expired backup;
delete noprompt expired backup;
删除无效和retention有关
delete obsolete;