#############################################################################
RMAN 增量备份优化 for ORACLE 10G
#############################################################################
1.未打开块改变记录,进行差异增量备份,测试如下:
SQL> select status from v$block_change_tracking;
STATUS
----------
DISABLED
$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Dec 23 14:23:06 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ASRSLC (DBID=422538457)
RMAN> backup incremental level 0 format='/oradata/bak/bk_%s_%p_%t'
2> database;
Starting backup at 23-DEC-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oradata/ASRS/smperp_mv.dbf
input datafile fno=00004 name=/oradata/ASRS/users01.dbf
input datafile fno=00005 name=/oradata/ASRS/smpasrs.dbf
input datafile fno=00001 name=/oradata/ASRS/system01.dbf
input datafile fno=00003 name=/oradata/ASRS/sysaux01.dbf
input datafile fno=00002 name=/oradata/ASRS/undotbs01.dbf
input datafile fno=00007 name=/oradata/ASRS/smperp_mv_idx.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_19_1_738512743 tag=TAG20101223T142543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_20_1_738512858 tag=TAG20101223T142543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 23-DEC-10
RMAN> backup incremental level 1 format='/oradata/bak/bk_%s_%p_%t' database;
[@more@]Starting backup at 23-DEC-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oradata/ASRS/smperp_mv.dbf
input datafile fno=00004 name=/oradata/ASRS/users01.dbf
input datafile fno=00005 name=/oradata/ASRS/smpasrs.dbf
input datafile fno=00001 name=/oradata/ASRS/system01.dbf
input datafile fno=00003 name=/oradata/ASRS/sysaux01.dbf
input datafile fno=00002 name=/oradata/ASRS/undotbs01.dbf
input datafile fno=00007 name=/oradata/ASRS/smperp_mv_idx.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_21_1_738513017 tag=TAG20101223T143016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_22_1_738513024 tag=TAG20101223T143016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-DEC-10
###########################
删除备份
##########################
RMAN> delete backupset 11;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
11 11 1 1 AVAILABLE DISK /oradata/bak/bk_19_1_738512743
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oradata/bak/bk_19_1_738512743 recid=11 stamp=738512744
Deleted 1 objects
RMAN> delete backupset 12;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
12 12 1 1 AVAILABLE DISK /oradata/bak/bk_20_1_738512858
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oradata/bak/bk_20_1_738512858 recid=12 stamp=738512860
Deleted 1 objects
RMAN> delete backupset 13;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
13 13 1 1 AVAILABLE DISK /oradata/bak/bk_21_1_738513017
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oradata/bak/bk_21_1_738513017 recid=13 stamp=738513018
Deleted 1 objects
RMAN> delete backupset 14;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
14 14 1 1 AVAILABLE DISK /oradata/bak/bk_22_1_738513024
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oradata/bak/bk_22_1_738513024 recid=14 stamp=738513024
Deleted 1 objects
RMAN> list backup;
2.打开块改变记录,备份测试如下:
SQL> alter database enable block change tracking using file '/oradata/ASRS/rman_change_track.f' reuse;
Database altered.
SQL> select status from v$block_change_tracking;
STATUS
----------
ENABLED
$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Dec 23 14:44:11 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ASRSLC (DBID=422538457)
RMAN> list backup;
using target database control file instead of recovery catalog
RMAN> backup incremental level 0 format='/oradata/bak/bk_%s_%p_%t' database;
Starting backup at 23-DEC-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oradata/ASRS/smperp_mv.dbf
input datafile fno=00004 name=/oradata/ASRS/users01.dbf
input datafile fno=00005 name=/oradata/ASRS/smpasrs.dbf
input datafile fno=00001 name=/oradata/ASRS/system01.dbf
input datafile fno=00003 name=/oradata/ASRS/sysaux01.dbf
input datafile fno=00002 name=/oradata/ASRS/undotbs01.dbf
input datafile fno=00007 name=/oradata/ASRS/smperp_mv_idx.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_23_1_738513931 tag=TAG20101223T144531 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_24_1_738514047 tag=TAG20101223T144531 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-DEC-10
RMAN> backup incremental level 1 format='/oradata/bak/bk_%s_%p_%t' database;
Starting backup at 23-DEC-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oradata/ASRS/smperp_mv.dbf
input datafile fno=00004 name=/oradata/ASRS/users01.dbf
input datafile fno=00005 name=/oradata/ASRS/smpasrs.dbf
input datafile fno=00001 name=/oradata/ASRS/system01.dbf
input datafile fno=00003 name=/oradata/ASRS/sysaux01.dbf
input datafile fno=00002 name=/oradata/ASRS/undotbs01.dbf
input datafile fno=00007 name=/oradata/ASRS/smperp_mv_idx.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_25_1_738514110 tag=TAG20101223T144829 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-DEC-10
channel ORA_DISK_1: finished piece 1 at 23-DEC-10
piece handle=/oradata/bak/bk_26_1_738514113 tag=TAG20101223T144829 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-DEC-10
-------------
SQL> select * from v$block_change_tracking;
STATUS
----------
FILENAME
--------------------------------------------------------------------------------
BYTES
----------
ENABLED
/oradata/ASRS/rman_change_track.f
11599872
$ du -hs *
3.3G bk_23_1_738513931
7.0M bk_24_1_738514047
444K bk_25_1_738514110
7.0M bk_26_1_738514113
$ du -hs *
6.9M control01.ctl
6.8M control01.ctl.bak
6.9M control02.ctl
6.8M control02.ctl.bak
6.9M control03.ctl
6.8M control03.ctl.bak
51M redo01.log
51M redo02.log
51M redo03.log
12M rman_change_track.f
1.1G smpasrs.dbf
2.0G smperp_mv.dbf
101M smperp_mv_idx.dbf
52M standbyrd01.log
52M standbyrd02.log
52M standbyrd03.log
52M standbyrd04.log
301M sysaux01.dbf
301M system01.dbf
118M temp01.dbf
201M undotbs01.dbf
1.1G users01.dbf
以上测试结果,可以得出alter database enable block change tracking之后,增量备份速度有明显的提高。
参考:
http://www.oracle-base.com/articles/10g/RMANEnhancements10g.php
http://hi.baidu.com/hzbxt/blog/item/3fe183cb338fdcf452664ffc.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/789833/viewspace-1043530/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/789833/viewspace-1043530/