ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rac开启block change tracking

rac开启block change tracking

原创 Linux操作系统 作者:myownstars 时间:2011-08-10 18:34:58 0 删除 编辑

rac上开启block change tracking功能
首先在测试库测试一下开启block change tracking增量备份的速度
这个server配置很低,做一次全备份要很长时间,总共有60G数据

先做一个level 0的全备份
RMAN> backup incremental level 0 as compressed backupset database format '/data/oracle/backup/justin/justin_%U.bak';

Starting backup at 08-AUG-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1077 devtype=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
******
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/backup/justin/justin_01mjfu2v_1_1.bak tag=TAG20110808T140622 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:59:06
channel ORA_DISK_1: starting compressed incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/backup/justin/justin_02mjg1hq_1_1.bak tag=TAG20110808T140622 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-11
此次level 0备份消耗将近1个小时,
在数据库中新建一个表空间
SQL> create tablespace test datafile '/data/oracle/oradata/justin/test.dbf' size 8g;

Tablespace created.

SQL>  create table test tablespace test as select * from dba_objects;

Table created.

运行增量备份
RMAN> backup incremental level 1 as compressed backupset database;
Starting backup at 08-AUG-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
********
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/product/10.2/db1/dbs/03mjg62v_1_1 tag=TAG20110808T162255 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:17:06
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/product/10.2/db1/dbs/04mjg731_1_1 tag=TAG20110808T162255 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-11

新建的表只有2M,但是增量备份仍要17分钟
此时再创建一个表,然后开启block change tracking
SQL> create table test2 tablespace test as select * from dba_objects;

Table created.

SQL> alter database enable block change tracking using file '/data/oracle/backup/justin/block_track.log';

Database altered.
此时再来一个增量备份
RMAN> backup incremental level 1 as compressed backupset database;

Starting backup at 08-AUG-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
********
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/product/10.2/db1/dbs/05mjg7i1_1_1 tag=TAG20110808T164800 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 08-AUG-11
channel ORA_DISK_1: finished piece 1 at 08-AUG-11
piece handle=/data/oracle/product/10.2/db1/dbs/06mjg7i4_1_1 tag=TAG20110808T164800 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-11
这次相当之快,只需要3秒

RAC库开启block change tracking,需要把文件放到共享目录下,否则会创建不成功
SQL> alter database enable block change tracking using file '+DATA/JUSTIN/block_change_tracking.log';

Database altered.

接下来部署脚本,每周3做全备,其余时间做增量差异备份
0 03 * * 3 sh /home/oracle/justinscript/rman_level0.sh >> /home/oracle/justinscript/rman_level0.log
0 03 * * 0,1,2,4,5,6 sh /home/oracle/justinscript/rman_level1.sh >> /home/oracle/justinscript/rman_level1.log
具体脚本如下
[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level0.sh
. /home/oracle/.bash_profile
rman target / @/home/oracle/monitor/script/rman_level0
[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level0
crosscheck backup;
delete obsolete;
run
{allocate channel d1 type disk maxpiecesize=3g;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
backup incremental level=0 as compressed backupset database format '/data/oracle/backup/rman/Lv0_%d_%T_%U.bak';
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
[oracle@justin ~]$ more  /home/oracle/monitor/script/rman_level1.sh
. /home/oracle/.bash_profile
rman target / @/home/oracle/monitor/script/rman_level1
[oracle@justin ~]$ more /home/oracle/monitor/script/rman_level1
run
{allocate channel d1 type disk maxpiecesize=3g;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
backup incremental level=1 as compressed backupset database format '/data/oracle/backup/rman/Lv1_%d_%T_%U.bak';
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15480802/viewspace-704624/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-18

  • 博文量
    375
  • 访问量
    3112037