1.如何连接rman环境

 --本地连接
 [oracle@db253 orcl11g]$ echo $ORACLE_SID
 orcl11g
 [oracle@db253 orcl11g]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jun 24 14:57:14 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL11G (DBID=923506654)

 RMAN> 

 --通过本地服务名连接
 [oracle@db253 admin]$ tnsping orcl109

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 24-JUN-2013 15:01:24

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.109)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl11g.uplook.com)))
OK (0 msec)

 [oracle@db253 admin]$ rman target sys/Oracle123@orcl109

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jun 24 15:00:55 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL11G (DBID=923525678)

 RMAN> 

2.RMAN的配置

 RMAN> show all;  -- 显示rman所有的环境参数设置

 --RETENTION POLICY: -- 备份文件的保留策略(根据业务需求,管理员自己制定的)

 the backup retention policy
 specifies which backups must be retained to meet your data recovery requirements.
 This policy can be based on a recovery window or redundancy.
 只能指定一种备份保留策略

 *REDUNDANCY  冗余度
 The REDUNDANCY parameter of the CONFIGURE RETENTION POLICY command
 specifies how many full or level 0 backups of each data file and control file that RMAN
 should keep.
 *表明rman应该保留多少个full或者是level 0增量备份的数量;

 如何配置:
  RMAN> configure retention policy to redundancy 2;

 new RMAN configuration parameters:
 CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
 new RMAN configuration parameters are successfully stored

 *Recovery window 恢复窗口
 The RECOVERY WINDOW parameter of the CONFIGURE command specifies the number
 of days between the current time and the earliest point of recoverability.
 就是说,恢复窗口,指定了当前时间,到你的数据库能够恢复到最早的时间间隔;
 比如,恢复窗口为7天;那意味着,数据库应该能够不完全恢复到从现在开始,七天以内的任意时间点;

 如何配置:
  RMAN> configure retention policy to recovery window of 7 days;

 old RMAN configuration parameters:
 CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
 new RMAN configuration parameters:
 CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
 new RMAN configuration parameters are successfully stored

 如何恢复配置参数的默认值:
  RMAN> configure retention policy clear;

 old RMAN configuration parameters:
 CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
 RMAN configuration parameters are successfully reset to default value

 --BACKUP OPTIMIZATION 备份优化
 *If you enable backup optimization, then the BACKUP command skips backing up files
 when the identical file has already been backed up to the specified device type.
 *如果开启了备份优化,那么,backup命令,就会忽略已经备份到指定设备的同样的文件;

 如何配置:
  RMAN> CONFIGURE BACKUP OPTIMIZATION on;

 new RMAN configuration parameters:
 CONFIGURE BACKUP OPTIMIZATION ON;
 new RMAN configuration parameters are successfully stored

 //不建议开启备份优化功能

 --DEFAULT DEVICE TYPE 默认的备份设备类型
 * 两种类型:disk & sbt
 * disk 备份的目标地址是磁盘设备
 * sbt 备份的目标地址是磁带设备

 如何配置:
  RMAN>CONFIGURE DEFAULT DEVICE TYPE TO DISK;

 --CONTROLFILE AUTOBACKUP 控制文件自动备份
 *当数据库启动任何备份行为的时候,都会自动备份一份当前的控制文件和spfile参数文件;

 如何配置:
  RMAN> configure controlfile autobackup on;

 new RMAN configuration parameters:
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 new RMAN configuration parameters are successfully stored

 --CONTROLFILE AUTOBACKUP FORMAT 控制文件自动备份的备份文件格式
 * 自动备份的控制文件的命名格式
 * 默认格式:%F
 * 含义:
  c-IIIIIIIIII-YYYYMMDD-QQ, with the placeholders defined as follows:
  ■ IIIIIIIIII stands for the DBID.
  ■ YYYYMMDD is a time stamp of the day the backup is generated.
  ■ QQ is the hexadecimal sequence that starts with 00 and has a maximum of FF.

 如何配置:
  RMAN> configure controlfile autobackup format for device type disk to '/u01/app/backup/%F';

 new RMAN configuration parameters:
 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/backup/%F';
 new RMAN configuration parameters are successfully stored
 //如果不更改存放路径,默认在闪回恢复区

 -- DEVICE TYPE DISK PARALLELISM 设备的并行度
 * 并行意味着可以开启多个channel,实现同时备份,提高效率
 * 如果备份的目标设备只有一个,那么开启并行无效

 如何配置:
  RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 backup type to backupset;

 new RMAN configuration parameters:
 CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
 new RMAN configuration parameters are successfully stored

 --DATAFILE BACKUP COPIES 数据文件备份拷贝
 *You can use the CONFIGURE ... BACKUP COPIES command to specify how many
 copies of each backup piece should be created on the specified device type for the
 specified type of file.

 如何配置:
  CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

 -- MAXSETSIZE 最大备份集大小
 * 指定每个备份集的大小

 --ENCRYPTION FOR DATABASE 备份加密
 * 开启备份加密

 --ENCRYPTION ALGORITHM 配置加密算法
 *可以指定不同的加密算法

 --COMPRESSION ALGORITHM 压缩算法
 * 将备份文件进行压缩
 * high medium low

 RMAN> configure compression algorithm 'high';

 --ARCHIVELOG DELETION POLICY 归档日志删除策略
 * 归档日志备份两次之后,归档日志删除

 如何配置:
  RMAN> configure archivelog deletion policy to backed up 2 times to disk;

 new RMAN configuration parameters:
 CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
 new RMAN configuration parameters are successfully stored

 -- SNAPSHOT CONTROLFILE NAME 控制文件快照
 * 控制文件快照的位置,默认$ORACLE_HOME/dbs