Oracle RMAN 映像备份(Image copies)基本原理与方案
映像级别备份(image copies)相当于数据文件和归档日志的拷贝复制品,与原文件在存储空间上完全一致,如果需要做一个部分恢复(比如某一数据文件)采用映像备份情况下只需要检索相应的映像即可,恢复速度非常快,在某些非常情况下,可以直接switch到映像数据文件以保证生产环境尽可能短时间的停机,事后再做一个copy到原路径,选择空闲时段再次swich回去。
鉴于映像备份需要占用和生产数据文件相同的空间,所以在数据量较大的情况下是不建议采用的,因为这种方案需要客户为花费双份存储的钱,但是如果说在某库创建之初,数据文件不是很大,或者说某库数据量始终较小,那么选择影响备份是一种极好的方案,可以在数据文件出现物理损坏时,以最短的时间完成介质恢复。
下面介绍一些最简单的RMAN映像备份方案
1、开启rman块追踪技术
SQL> alter database enable block change tracking using file '/u01/app/oralce/oradata/orcl/block_change_track_file.f';
Database altered.
2、进行映像级别的level 0备份
run {
ALLOCATE CHANNEL "ch1" DEVICE TYPE DISK FORMAT "/u04/%U";
BACKUP AS COPY TAG 'BASE01'
INCREMENTAL LEVEL 0
DATABASE;
}
3、进行映像级别的level 1备份
$ rman target /
run {
ALLOCATE CHANNEL "ch1" DEVICE TYPE DISK FORMAT "/u04/%U";
BACKUP TAG 'incr_update'
INCREMENTAL LEVEL 1
DATABASE;
}
4、用level 1的备份update level 0 中的映像
run {
ALLOCATE CHANNEL "ch1" DEVICE TYPE DISK FORMAT "/u04/%U";
RECOVER COPY OF DATABASE WITH TAG 'BASE01';
}
实验纪录
1、level 0
RMAN> run {
ALLOCATE CHANNEL "ch1" DEVICE TYPE DISK FORMAT "/u04/%U";
BACKUP AS COPY TAG 'BASE01'
INCREMENTAL LEVEL 0
DATABASE;
}
2> 3> 4> 5> 6>
released channel: ORA_DISK_1
allocated channel: ch1
channel ch1: SID=32 device type=DISK
Starting backup at 05-SEP-13
channel ch1: starting datafile copy
input datafile file number=00001 name=/u01/app/oralce/oradata/orcl/system01.dbf
output file name=/u04/data_D-ORCL_I-1349053318_TS-SYSTEM_FNO-1_0coj3jug tag=BASE01 RECID=18 STAMP=825348067
channel ch1: datafile copy complete, elapsed time: 00:00:25
channel ch1: starting datafile copy
input datafile file number=00002 name=/u01/app/oralce/oradata/orcl/sysaux01.dbf
output file name=/u04/data_D-ORCL_I-1349053318_TS-SYSAUX_FNO-2_0doj3jv9 tag=BASE01 RECID=19 STAMP=825348091
channel ch1: datafile copy complete, elapsed time: 00:00:25
channel ch1: starting datafile copy
input datafile file number=00005 name=/u01/app/oralce/oradata/orcl/example01.dbf
output file name=/u04/data_D-ORCL_I-1349053318_TS-EXAMPLE_FNO-5_0eoj3k02 tag=BASE01 RECID=20 STAMP=825348107
channel ch1: datafile copy complete, elapsed time: 00:00:15
channel ch1: starting datafile copy
input datafile file number=00004 name=/u01/app/oralce/oradata/orcl/users01.dbf
output file name=/u04/data_D-ORCL_I-1349053318_TS-USERS_FNO-4_0foj3k0h tag=BASE01 RECID=21 STAMP=825348116
channel ch1: datafile copy complete, elapsed time: 00:00:03
channel ch1: starting datafile copy
input datafile file number=00003 name=/u01/app/oralce/oradata/orcl/undotbs01.dbf
output file name=/u04/data_D-ORCL_I-1349053318_TS-UNDOTBS1_FNO-3_0goj3k0l tag=BASE01 RECID=22 STAMP=825348120
channel ch1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 05-SEP-13
Starting Control File and SPFILE Autobackup at 05-SEP-13
piece handle=/u01/app/Oracle/product/11.2.0/dbhome_1/dbs/c-1349053318-20130905-00 comment=NONE
Finished Control File and SPFILE Autobackup at 05-SEP-13
released channel: ch1
RMAN>
推荐阅读: