首页 > 数据库 > Oracle > 正文

Oracle学习之:Rman备份策略

2024-08-29 13:54:56
字体:
来源:转载
供稿:网友

1、 查看可设置参数

RMAN> show all;

 

RMAN configuration parameters for database with db_unique_name DRZ are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

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 CHANNEL DEVICE TYPE DISK FORMAT   '/u01/app/backup/db_%U.rmn';

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 TRU

E ; # defaultCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/Oracle/product/11.2.0/db_1/dbs/snapc

f_drz.f'; # default

 

2、 RETENTION POLICY(保存策略)

1) 保存最近30天的备份

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;

2) 保存2份冗余

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

3) 设置备份策略失效

RMAN> CONFIGURE RETENTION POLICY TO NONE;

4) 备份策略恢复默认设置

RMAN> CONFIGURE RETENTION POLICY CLEAR;

3、 备份优化

backup optimization:默认值为 off,启用优化后,会按照优化算法进行备份,比如只读表空间不备份等。

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;RMAN> CONFIGURE BACKUP OPTIMIZATION OFF;RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;

4、 默认备份设备

default device type:默认值为 disk,指定备份到磁盘或者是磁带

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO STB;

RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;

5、 控制文件

1)  开启自动备份及指定路径及名称,当控制文件变化时,控制文件自动备份

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/backup/control/cf_%F';

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP CLEAR;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

2)  是配置控制文件的快照文件的存放路径和文件名,这个快照文件是在备份期间产生的

RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/backup/contolfile/CF_%F';

RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME CLEAR;

6、 排除选项

1)  Exclude:排除'EXAMPLE'表空间

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE 'EXAMPLE';

2)  重置 排除选项

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE 'EXAMPLE' CLEAR;

7、 备份集大小

1)  设置备份集大小

RMAN> CONFIGURE MAXSETSIZE TO nG|nM|nK|UNLIMITED;

2)  重置备份集大小为默认值

RMAN> CONFIGURE MAXSETSIZE CLEAR;

8、 压缩备份

1) 默认压缩比

RMAN> show compression algorithm;RMAN configuration parameters for database with db_unique_name DRZ are:CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

2) 设置高压缩比

RMAN> CONFIGURE COMPRESSION ALGORITHM 'HIGH';

3) 其他几种压缩比

RMAN> CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';RMAN> CONFIGURE COMPRESSION ALGORITHM 'LOW';RMAN> CONFIGURE COMPRESSION ALGORITHM 'BASIC';

4) RUN 块中使用会话级压缩

run {SET COMPRESSION ALGORITHM 'HIGH/MEDIUM/LOW/BASIC';...}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表