OracleRMAN备份与恢复

rman 的架构:

1:可连接三类数据库:target database(备份的目标库) ,auxiliary database(复制数 据库), catalog database(目录数据库)。

2:存储设备:disk 、tape 、sbt 磁带机)存放备份文件的设备

3:channel :目标库和存储设备之间备份恢复通道(服务进程)默认最少启动一个 channel,可同时启动多个 channel 并发操作。

4:server process:用于备份和恢复的进程

5:rman 的元数据:记录备份的信息(放在目标库的 controlfile 里)

6:catalog database :集中管理、存放备份的元数据,还可以存储备份脚本

7:MML:media manage layer 介质管理层:用于管理磁带机的库文件或驱动

rman 备份 datafile分三个层次:database、tablespace、datafile)、 controlfile、spfile、archivelog,联机日志文件不会备份

rman 的默认配置:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/U01/MYRMAN/%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 'BZIP2'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/dbs/snapcf_timran11g.f'; # default

 

例:建立一个rman备份

1.开启归档

startup mount

alter database noarchivelog;

archive log list;

alter database archivelog;

alter database open;

2.创建备份

rman target / 

run{
crosscheck backup;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level 0 database format 'C:\app\Administrator\backup\full_%n_%T_%t_%s_%p.bak';
sql 'alter system archive log current'; 
backup archivelog all format  
'C:\app\Administrator\backup\arch_%d_%T_%s_%p.bak';
Backup current controlfile format     
'C:\app\Administrator\backup\control_%d_%T_%U.bak';
report obsolete device type disk;
delete noprompt obsolete device type disk;
delete noprompt expired backup device type disk;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

3.生成脚本,任务计划每天执行

posted @ 2019-11-21 10:23  明a  阅读(229)  评论(0编辑  收藏  举报