rman备份的优化 - 使用section size

rdbms 19.0.0.0下测试

在11g之前,rman通过并行分配多个通道进行并行备份,每个通道成为一个rman会话,但是每个通道一次最多只能备份一个数据文件,意味着即使有多个通道,每个数据文件也只能通过一个通道进行备份。在11gr2的rman中,分配的通道可以把一个数据文件分成块,也叫做片段(section),可以指定每个片段的大小。


以下测试一个例子,数据文件不到400M,分配两个通道,也就是开了两个并行进行备份。指定section size和不指定section size的区别。
经过测试,不启用section size的时候,多个通道备份一个文件,仅仅有一个通道生效(也就是没有用并行),当开启了section size的时候,多个通道备份一个文件,多个通道会同时进行备份(也就是使用了并行),从而节约了时间。下面的测试,使用section size是1秒。未使用是3秒。
 

run
{
allocate channel c1 type disk format '/home/oracle/%U';
allocate channel c2 type disk format '/home/oracle/%U';
backup section size 200M datafile 2;
}

-- 两个通道,并行为2,section size200M,对一个文件进行备份,生成了两个备份集/home/oracle/0duf6nlr_1_1和/home/oracle/0duf6nlr_2_1。备份时间是1秒。

RMAN> run
{
allocate channel c1 type disk format '/home/oracle/%U';
allocate channel c2 type disk format '/home/oracle/%U';
backup section size 200M datafile 2;
}2> 3> 4> 5> 6>

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=269 device type=DISK

allocated channel: c2
channel c2: SID=395 device type=DISK

Starting backup at 25-OCT-19
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
backing up blocks 1 through 25600
channel c1: starting piece 1 at 25-OCT-19
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
backing up blocks 25601 through 51200
channel c2: starting piece 2 at 25-OCT-19
channel c1: finished piece 1 at 25-OCT-19
piece handle=/home/oracle/0duf6nlr_1_1 tag=TAG20191025T104059 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:00
channel c2: finished piece 2 at 25-OCT-19
piece handle=/home/oracle/0duf6nlr_2_1 tag=TAG20191025T104059 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 25-OCT-19

Starting Control File and SPFILE Autobackup at 25-OCT-19
piece handle=/u01/archivelog/TEST/autobackup/2019_10_25/o1_mf_s_1022582461_gv4r5xff_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-OCT-19
released channel: c1
released channel: c2

RMAN>

--虽然开了两个通道,但是是对同一个文件进行备份,没有设置section size,其实起作用的还是一个通道(并行没有用)。生成了一个备份集/home/oracle/nosection0guf6nqh_1_1。 备份时间是3秒,相比开了section size 多了1秒。

run
{
allocate channel c1 type disk format '/home/oracle/nosection%U';
allocate channel c2 type disk format '/home/oracle/nosection%U';
backup datafile 2;
}

RMAN> run
{
allocate channel c1 type disk format '/home/oracle/nosection%U';
allocate channel c2 type disk format '/home/oracle/nosection%U';
backup datafile 2;
}2> 3> 4> 5> 6>

allocated channel: c1
channel c1: SID=269 device type=DISK

allocated channel: c2
channel c2: SID=395 device type=DISK

Starting backup at 25-OCT-19
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
channel c1: starting piece 1 at 25-OCT-19
channel c1: finished piece 1 at 25-OCT-19
piece handle=/home/oracle/nosection0guf6nqh_1_1 tag=TAG20191025T104329 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-OCT-19

Starting Control File and SPFILE Autobackup at 25-OCT-19
piece handle=/u01/archivelog/TEST/autobackup/2019_10_25/o1_mf_s_1022582613_gv4rboqn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-OCT-19
released channel: c1
released channel: c2

RMAN>

END

发布了754 篇原创文章 · 获赞 31 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/xxzhaobb/article/details/102738950