『ORACLE』rman简单配置(11g)
登录rman,以控制文件为资料库
[oracle@Riven ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 4 11:21:55 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: JUAN (DBID=2055590317)
显示rman默认设置
RMAN>show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name JUAN are:
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 CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/ANNI/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 TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_Riven.f'; # default
1、更改rman磁盘备份默认目录
RMAN> configure channel device type disk format '/home/oracle/RMAN';
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/ANNI/db_%U.rmn';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/RMAN';
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name JUAN are:
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 CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/RMAN';
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 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_Riven.f'; # default
2、更改保存策略
(1)所有的备份保留时间为7天
RMAN>configure retention policy to recovery window of 7 days;
(2)最新的5份备份标记为redundancy
RMAN>configure retention policy to redundanct = 5;
(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、控制文件
开启自动备份及指定路径及名称,当控制文件变化时,控制文件自动备份
RMAN>configure controlfile autobackup on;
RMAN>configure controlfile autobackup format for device type '/home/oracle/backup/control/conf_%F';
RMAN>configure controlfile autobackup clear;
RMAN>configure controlfile autobackup format for device type disk clear;
6、配置控制文件的快照文件的存放路径和文件名,这个快照文件是在备份期间产生的
RMAN>configure snapshot controlfile name to '/u01/backup/control/CF_%F';
RMAN>configure snapshot controlfile name clear;
7、排除选项
(1)exclude:排除‘EXAMPLE’表空间
RMAN>configure exclude for tablespace 'EXAMPLE';
(2)重置排除选项为默认值
RMAN>configure exclude for tablespace 'EXAMPL' clear;
8、备份集大小
(1)设置备份集大小
RMAN>configure maxsetsize to nG|nM|nK|unlimited
(2)重置备份集大小为默认值
RMAN>configure maxsetsize clear
9、压缩备份
(1)默认值压缩
RMAN> show compression algorithm;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name JUAN are:
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
(2)设置为高压缩比
RMAN> configure compression algorithm 'HIGH';
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM 'HIGH' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
new RMAN configuration parameters are successfully stored
(3)设置为其他压缩比
RMAN> configure compression algorithm 'MEDIUM';
RMAN> configure compression algorithm 'LOW';
RMAN> configure compression algorithm 'BASIC';