ITPub博客

首页 > 数据库 > Oracle > 一个RMAN备份集所包含的数据文件个数是由哪些因素来决定的?

一个RMAN备份集所包含的数据文件个数是由哪些因素来决定的?

原创 Oracle 作者:oliseh 时间:2015-08-05 19:45:33 0 删除 编辑

前不久在处理一个RMAN备份问题时,想到过这样一个问题:一个RMAN backupset里会包含多少个数据文件?经过之后的一系列测试得到的结论是:
一个Backupset里包含多少个datafile,与备份使用的通道数量、filesperset的设置,所备份的数据文件总数都有关系,与maxopenfiles的值是无关的以下是我对这个问题的详细测试验证过程,划分了多个不同场景,每一个测试步骤后都附有量化的测试结论(绿色字体的部分)

(1)使用一根通道进行备份的情况


******************** one channel、maxopenfiles 1、filesperset 4
RMAN> run
2> {
3> allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 1;
4> backup filesperset 4 database;
5> }


allocated channel: d1
channel d1: SID=992 device type=DISK


Starting backup at 20150605 13:15:56
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
channel d1: starting piece 1 at 20150605 13:15:57
channel d1: finished piece 1 at 20150605 13:16:32
piece handle=/oradata06/vlib/0mq8nsod_1_1 tag=TAG20150605T131556 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:35
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
channel d1: starting piece 1 at 20150605 13:16:32
channel d1: finished piece 1 at 20150605 13:16:47
piece handle=/oradata06/vlib/0nq8nspg_1_1 tag=TAG20150605T131556 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d1: starting piece 1 at 20150605 13:16:47
channel d1: finished piece 1 at 20150605 13:16:54
piece handle=/oradata06/vlib/0oq8nspv_1_1 tag=TAG20150605T131556 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:07
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 20150605 13:16:55
channel d1: finished piece 1 at 20150605 13:16:56
piece handle=/oradata06/vlib/0pq8nsq6_1_1 tag=TAG20150605T131556 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:16:56
released channel: d1


******************** one channel、maxopenfiles 2、filesperset 4
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 2;
backup filesperset 4 database;
}
allocated channel: d1
channel d1: SID=992 device type=DISK


Starting backup at 20150605 13:23:19
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
channel d1: starting piece 1 at 20150605 13:23:19
channel d1: finished piece 1 at 20150605 13:23:44
piece handle=/oradata06/vlib/0rq8nt67_1_1 tag=TAG20150605T132319 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:25
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
channel d1: starting piece 1 at 20150605 13:23:45
channel d1: finished piece 1 at 20150605 13:24:00
piece handle=/oradata06/vlib/0sq8nt71_1_1 tag=TAG20150605T132319 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d1: starting piece 1 at 20150605 13:24:00
channel d1: finished piece 1 at 20150605 13:24:07
piece handle=/oradata06/vlib/0tq8nt7g_1_1 tag=TAG20150605T132319 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:07
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 20150605 13:24:08
channel d1: finished piece 1 at 20150605 13:24:09
piece handle=/oradata06/vlib/0uq8nt7n_1_1 tag=TAG20150605T132319 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:24:09
released channel: d1


******************** one channel、maxopenfiles 8、filesperset 4
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
backup filesperset 4 database;
}


allocated channel: d1
channel d1: SID=992 device type=DISK


Starting backup at 20150605 13:25:41
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
channel d1: starting piece 1 at 20150605 13:25:41
channel d1: finished piece 1 at 20150605 13:26:06
piece handle=/oradata06/vlib/0vq8ntal_1_1 tag=TAG20150605T132541 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:25
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
channel d1: starting piece 1 at 20150605 13:26:06
channel d1: finished piece 1 at 20150605 13:26:21
piece handle=/oradata06/vlib/10q8ntbe_1_1 tag=TAG20150605T132541 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d1: starting piece 1 at 20150605 13:26:22
channel d1: finished piece 1 at 20150605 13:26:29
piece handle=/oradata06/vlib/11q8ntbu_1_1 tag=TAG20150605T132541 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:07
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 20150605 13:26:30
channel d1: finished piece 1 at 20150605 13:26:31
piece handle=/oradata06/vlib/12q8ntc5_1_1 tag=TAG20150605T132541 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:26:31
released channel: d1


******************** one channel、maxopenfiles 8、filesperset 12
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
backup filesperset 12 database;
}


allocated channel: d1
channel d1: SID=992 device type=DISK


Starting backup at 20150605 13:28:16
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d1: starting piece 1 at 20150605 13:28:16
channel d1: finished piece 1 at 20150605 13:29:01
piece handle=/oradata06/vlib/13q8ntfg_1_1 tag=TAG20150605T132816 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:45
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 20150605 13:29:02
channel d1: finished piece 1 at 20150605 13:29:03
piece handle=/oradata06/vlib/14q8ntgt_1_1 tag=TAG20150605T132816 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:29:03
released channel: d1


******************** one channel、maxopenfiles 4、filesperset 12
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 4;
backup filesperset 12 database;
}


allocated channel: d1
channel d1: SID=992 device type=DISK


Starting backup at 20150605 13:30:25
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d1: starting piece 1 at 20150605 13:30:26
channel d1: finished piece 1 at 20150605 13:31:01
piece handle=/oradata06/vlib/15q8ntji_1_1 tag=TAG20150605T133026 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:35
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 20150605 13:31:02
channel d1: finished piece 1 at 20150605 13:31:03
piece handle=/oradata06/vlib/16q8ntkl_1_1 tag=TAG20150605T133026 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:31:03
released channel: d1


以上所有one channel情况下生成的backupset,backupset里的datafile数量由min[filesperset,这根通道读取的Datafile数量]决定,因为只有一根通道所以这根通道读取的datafile数量等价于backup命令里所包含的datafile数量

 (2)使用两根通道进行备份
******************** two channel、maxopenfiles 1、filesperset 4
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 1;
allocate channel d2 device type disk format '/oradata06/vlib/%U' maxopenfiles 1;
backup filesperset 4 database;
}


allocated channel: d1
channel d1: SID=992 device type=DISK


allocated channel: d2
channel d2: SID=3 device type=DISK


Starting backup at 20150605 13:35:45
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
channel d1: starting piece 1 at 20150605 13:35:46
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
channel d2: starting piece 1 at 20150605 13:35:46
channel d2: finished piece 1 at 20150605 13:36:11
piece handle=/oradata06/vlib/18q8ntti_1_1 tag=TAG20150605T133546 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d2: starting piece 1 at 20150605 13:36:11
channel d1: finished piece 1 at 20150605 13:36:26
piece handle=/oradata06/vlib/17q8ntti_1_1 tag=TAG20150605T133546 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:40
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
channel d2: finished piece 1 at 20150605 13:36:26
piece handle=/oradata06/vlib/19q8ntub_1_1 tag=TAG20150605T133546 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:15
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel d2: starting piece 1 at 20150605 13:36:27
including current control file in backup set
channel d1: starting piece 1 at 20150605 13:36:28
channel d2: finished piece 1 at 20150605 13:36:28
piece handle=/oradata06/vlib/1bq8ntur_1_1 tag=TAG20150605T133546 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:01
channel d1: finished piece 1 at 20150605 13:36:29
piece handle=/oradata06/vlib/1aq8ntuq_1_1 tag=TAG20150605T133546 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150605 13:36:29
released channel: d1
released channel: d2


RMAN> list backup summary tag TAG20150605T133546;


List of Backups
===============
Key     TY LV S Device Type Completion Time   #Pieces #Copies Compressed Tag
------- -- -- - ----------- ----------------- ------- ------- ---------- ---
38      B  F  A DISK        20150605 13:36:03 1       1       NO         TAG20150605T133546
39      B  F  A DISK        20150605 13:36:20 1       1       NO         TAG20150605T133546
40      B  F  A DISK        20150605 13:36:21 1       1       NO         TAG20150605T133546
41      B  F  A DISK        20150605 13:36:27 1       1       NO         TAG20150605T133546
42      B  F  A DISK        20150605 13:36:28 1       1       NO         TAG20150605T133546


2个channel的情况下,其中前三个是datafile的backupset,共9个datafile,生成了3个backupset(BS_key=38、39、40),每个backupset包含1个backup piece,得到这样的结果是因为:9个datafile,两根channel,按照平均分布的规则,一根channel读取4个datafile,一根channel读取5个datafile,但因为filesperset=4,每根channel生成的backupset所包含的文件数量由min[filesperset,这条通道读取的Datafile数量]决定,此例中filesperset决定了这个最小值是4,所以每个backupset里的文件数<=4,9个datafile最终就生成了3个backupset,分别包含4个、2个、3个datafile


******************** two channel、maxopenfiles 2、filesperset 4
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 2;
allocate channel d2 device type disk format '/oradata06/vlib/%U' maxopenfiles 2;
backup filesperset 4 database;
}


结果同上
******************** two channel、maxopenfiles 8、filesperset 4
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
allocate channel d2 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
backup filesperset 4 database;
}


结果同上
******************** two channel、maxopenfiles 8、filesperset 12
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
allocate channel d2 device type disk format '/oradata06/vlib/%U' maxopenfiles 8;
backup filesperset 12 database;
}


allocated channel: d1
channel d1: SID=992 device type=DISK


allocated channel: d2
channel d2: SID=3 device type=DISK


Starting backup at 20150605 14:03:41
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00009 name=/oradata06/testaaaaa/ts0422_1.dbf
input datafile file number=00001 name=/oradata06/testaaaaa/system01.dbf
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
channel d1: starting piece 1 at 20150605 14:03:42
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d2: starting piece 1 at 20150605 14:03:42
channel d2: finished piece 1 at 20150605 14:04:07
piece handle=/oradata06/vlib/1nq8nvhu_1_1 tag=TAG20150605T140341 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
including current control file in backup set
channel d2: starting piece 1 at 20150605 14:04:08
channel d2: finished piece 1 at 20150605 14:04:09
piece handle=/oradata06/vlib/1oq8nvin_1_1 tag=TAG20150605T140341 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:01
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel d2: starting piece 1 at 20150605 14:04:09
channel d2: finished piece 1 at 20150605 14:04:10
piece handle=/oradata06/vlib/1pq8nvip_1_1 tag=TAG20150605T140341 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:01
channel d1: finished piece 1 at 20150605 14:04:24
piece handle=/oradata06/vlib/1mq8nvhu_1_1 tag=TAG20150605T140341 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:42
Finished backup at 20150605 14:04:24
released channel: d1
released channel: d2


list backup summary tag TAG20150605T140341;
List of Backups
===============
Key     TY LV S Device Type Completion Time   #Pieces #Copies Compressed Tag
------- -- -- - ----------- ----------------- ------- ------- ---------- ---
53      B  F  A DISK        20150605 14:04:06 1       1       NO         TAG20150605T140341
54      B  F  A DISK        20150605 14:04:08 1       1       NO         TAG20150605T140341
55      B  F  A DISK        20150605 14:04:09 1       1       NO         TAG20150605T140341
56      B  F  A DISK        20150605 14:04:17 1       1       NO         TAG20150605T140341


两根channel,filesperset=12,9个datafile,channel d1读取4个datafile,channel d2读取了5个datafile,根据min[filesperset,这条通道读取的Datafile数量]公式,channel d1生成的backupset里包含有4个datafile,channel d2生成的backupset里包含有5个datafile,9个Datafile备份后最终生成了2个Backupset

******************** two channel、maxopenfiles 4、filesperset 12
结果同上,因为maxopenfiles=4,区别在于channel d2所生成的backuppiece里,5个datafile呈如下分布状态
df3 df4 df6 df5
df3 df4 df6 df5
.....
df3 df4 df6 df5
df8 df8 df8 df8
....
df8 df8 df8 df8


而maxopenfiles=4得例子里,channel d2所生成的backuppiece里,5个datafile呈如下分布状态
df3 df4 df6 df5
df8 df3 df4 df6
df5 df8  ..... ..... 
.....  ......  ..... df3
df4 df6 df5 df8


%%%%%%%%%%结论
归纳一下RMAN备份集里的几个重要概念
1、Number of files in each backupset,一个backupset里包含的datafile个数由哪些因素决定?
我们把需要备份的datafile个数记为number of datafiles
一根channel:
如果number of datafiles<filesperset,Number of files in each backup=Number of datafiles
如果number of datafiles>=filesperset,Number of files in each backup<=filesperset


多根channel:
如果Number of channels=<number of datafiles <filesperset,Number of files in each backupset<=ceil(Number of datafiles/Number of channels)

验证过程:
***Number of channels=3,number of datafiles=7,filesperset=8,Number of files in each backupset<=ceil(7/3)=3
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U';
allocate channel d2 device type disk format '/oradata06/vlib/%U';
allocate channel d3 device type disk format '/oradata06/vlib/%U';
backup filesperset 8 datafile 2,3,4,5,6,7,8;
}


allocated channel: d1
channel d1: SID=134 device type=DISK


allocated channel: d2
channel d2: SID=928 device type=DISK


allocated channel: d3
channel d3: SID=729 device type=DISK


Starting backup at 20150605 16:40:47
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
channel d1: starting piece 1 at 20150605 16:40:48
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d2: starting piece 1 at 20150605 16:40:48
channel d3: starting full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
channel d3: starting piece 1 at 20150605 16:40:48
channel d1: finished piece 1 at 20150605 16:41:03
piece handle=/oradata06/vlib/3eq8o8og_1_1 tag=TAG20150605T164047 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d2: finished piece 1 at 20150605 16:41:13
piece handle=/oradata06/vlib/3fq8o8og_1_1 tag=TAG20150605T164047 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d3: finished piece 1 at 20150605 16:41:13
piece handle=/oradata06/vlib/3gq8o8og_1_1 tag=TAG20150605T164047 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:25
Finished backup at 20150605 16:41:13
released channel: d1
released channel: d2
released channel: d3


如果number of datafiles <Number of channels<filesperset,那么仅有和number of datafiles相等数量的channel被使用,Number of files in each backupset=1;

验证过程:

***Number of channels=4,number of datafiles=3,filesperset=8,Number of files in each backupset=1
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U';
allocate channel d2 device type disk format '/oradata06/vlib/%U';
allocate channel d3 device type disk format '/oradata06/vlib/%U';
allocate channel d4 device type disk format '/oradata06/vlib/%U';
backup filesperset 8 datafile 2,3,4;
}


allocated channel: d1
channel d1: SID=134 device type=DISK


allocated channel: d2
channel d2: SID=928 device type=DISK


allocated channel: d3
channel d3: SID=729 device type=DISK


allocated channel: d4
channel d4: SID=467 device type=DISK


Starting backup at 20150605 16:43:21
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
channel d1: starting piece 1 at 20150605 16:43:22
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
channel d2: starting piece 1 at 20150605 16:43:22
channel d3: starting full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
channel d3: starting piece 1 at 20150605 16:43:22
channel d1: finished piece 1 at 20150605 16:43:37
piece handle=/oradata06/vlib/3hq8o8t9_1_1 tag=TAG20150605T164321 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d2: finished piece 1 at 20150605 16:43:47
piece handle=/oradata06/vlib/3iq8o8ta_1_1 tag=TAG20150605T164321 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d3: finished piece 1 at 20150605 16:43:47
piece handle=/oradata06/vlib/3jq8o8ta_1_1 tag=TAG20150605T164321 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:25
Finished backup at 20150605 16:43:47
released channel: d1
released channel: d2
released channel: d3
released channel: d4


如果Number of datafiles>=filesperset,Number of files in each backupset<=min[ceil(Number of datafiles/Number of channels),filesperset]

验证过程:

***Number of channels=4,number of datafiles=7,filesperset=2,Number of files in each backupset<=min[ceil(7/4),3]=2
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U';
allocate channel d2 device type disk format '/oradata06/vlib/%U';
allocate channel d3 device type disk format '/oradata06/vlib/%U';
allocate channel d4 device type disk format '/oradata06/vlib/%U';
backup filesperset 2 datafile 2,3,4,5,6,7,8;
}


allocated channel: d1
channel d1: SID=134 device type=DISK


allocated channel: d2
channel d2: SID=928 device type=DISK


allocated channel: d3
channel d3: SID=729 device type=DISK


allocated channel: d4
channel d4: SID=467 device type=DISK


Starting backup at 20150605 17:01:54
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
channel d1: starting piece 1 at 20150605 17:01:55
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d2: starting piece 1 at 20150605 17:01:55
channel d3: starting full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
channel d3: starting piece 1 at 20150605 17:01:55
channel d4: starting full datafile backup set
channel d4: specifying datafile(s) in backup set
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
channel d4: starting piece 1 at 20150605 17:01:55
channel d1: finished piece 1 at 20150605 17:02:10
piece handle=/oradata06/vlib/40q8oa03_1_1 tag=TAG20150605T170154 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d4: finished piece 1 at 20150605 17:02:10
piece handle=/oradata06/vlib/43q8oa03_1_1 tag=TAG20150605T170154 comment=NONE
channel d4: backup set complete, elapsed time: 00:00:15
channel d2: finished piece 1 at 20150605 17:02:20
piece handle=/oradata06/vlib/41q8oa03_1_1 tag=TAG20150605T170154 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d3: finished piece 1 at 20150605 17:02:20
piece handle=/oradata06/vlib/42q8oa03_1_1 tag=TAG20150605T170154 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:25
Finished backup at 20150605 17:02:20
released channel: d1
released channel: d2
released channel: d3
released channel: d4


如果Number of datafiles>=filesperset且Number of channels<filesperset,Number of files in each backupset<=min[ceil(Number of datafiles/Number of channels),filesperset]
验证过程:
***Number of channels=3,number of datafiles=7,filesperset=5,Number of files in each backupset<=min[ceil(7/3),3]=3
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U';
allocate channel d2 device type disk format '/oradata06/vlib/%U';
allocate channel d3 device type disk format '/oradata06/vlib/%U';
backup filesperset 5 datafile 2,3,4,5,6,7,8;
}


allocated channel: d1
channel d1: SID=134 device type=DISK


allocated channel: d2
channel d2: SID=928 device type=DISK


allocated channel: d3
channel d3: SID=729 device type=DISK


Starting backup at 20150605 17:07:28
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
channel d1: starting piece 1 at 20150605 17:07:29
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
input datafile file number=00008 name=/oradata06/testaaaaa/ts0212_1.dbf
channel d2: starting piece 1 at 20150605 17:07:29
channel d3: starting full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
channel d3: starting piece 1 at 20150605 17:07:29
channel d1: finished piece 1 at 20150605 17:07:44
piece handle=/oradata06/vlib/44q8oaah_1_1 tag=TAG20150605T170728 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d2: finished piece 1 at 20150605 17:07:54
piece handle=/oradata06/vlib/45q8oaah_1_1 tag=TAG20150605T170728 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d3: finished piece 1 at 20150605 17:07:54
piece handle=/oradata06/vlib/46q8oaah_1_1 tag=TAG20150605T170728 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:25
Finished backup at 20150605 17:07:54
released channel: d1
released channel: d2
released channel: d3


测试过程中还发现一个细节,把number of datafiles平均分布到number of channels的时候如果有两根channel上的datafile数量都要比其它channel少的时候,RMAN会弃用一根channel,比如下面的备份中分配了4根channel,6个datafiles,如果4根channel上都有Datafile的话,其分布情况为
d1:1个datafile
d2:1个datafile
d3:2个datafile
d4:2个datafile
这时d1、d2两根通道上的datafile就要比d3、d4少,RMAN只允许有一根channel上的Datafile数量少于其它channel,这样做的目的是尽量保持每根Channel上的负载均衡,下面的输出中可以看到d4虽被分配但未被使用,d1~d3每根channel上均分到了两个datafile

验证过程:

***Number of channels=4,number of datafiles=6,filesperset=3,Number of files in each backupset<=min[ceil(6/4),3]=2
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U';
allocate channel d2 device type disk format '/oradata06/vlib/%U';
allocate channel d3 device type disk format '/oradata06/vlib/%U';
allocate channel d4 device type disk format '/oradata06/vlib/%U';
backup filesperset 3 datafile 2,3,4,5,6,7;
}


allocated channel: d1
channel d1: SID=134 device type=DISK


allocated channel: d2
channel d2: SID=928 device type=DISK


allocated channel: d3
channel d3: SID=729 device type=DISK


allocated channel: d4
channel d4: SID=467 device type=DISK


Starting backup at 20150605 17:11:17
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oradata06/testaaaaa/undotbs01.dbf
input datafile file number=00007 name=/oradata06/testaaaaa/ts0212.dbf
channel d1: starting piece 1 at 20150605 17:11:18
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/oradata06/testaaaaa/sysaux01.dbf
input datafile file number=00006 name=/oradata06/testaaaaa/xdbts1.dbf
channel d2: starting piece 1 at 20150605 17:11:18
channel d3: starting full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00004 name=/oradata06/testaaaaa/users01.dbf
input datafile file number=00005 name=/oradata06/testaaaaa/ts0329_1.dbf
channel d3: starting piece 1 at 20150605 17:11:18
channel d1: finished piece 1 at 20150605 17:11:33
piece handle=/oradata06/vlib/47q8oahm_1_1 tag=TAG20150605T171117 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:15
channel d2: finished piece 1 at 20150605 17:11:43
piece handle=/oradata06/vlib/48q8oahm_1_1 tag=TAG20150605T171117 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:25
channel d3: finished piece 1 at 20150605 17:11:43
piece handle=/oradata06/vlib/49q8oahm_1_1 tag=TAG20150605T171117 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:25
Finished backup at 20150605 17:11:43
released channel: d1
released channel: d2
released channel: d3
released channel: d4

附带解释一下什么是RMAN Multiplexing
所谓RMAN multiplexing就是同一时刻有多少个datafile被同时写入同一个backuppiece,RMAN multiplexing level由maxopenfiles和filesperset中的最小值决定,其中maxopenfiles代表一根channel可以同时读取多少个datafile,RMAN multiplexing的效果体现为backuppiece各个数据文件呈现间隔存放的状态
run
{
allocate channel d1 device type disk format '/oradata06/vlib/%U' maxopenfiles 4;
backup datafile 1,2,3,4;
}


以上命令生成的backuppiece里df1~df4大致按照如下方式存放
 -----------------
| df1 df2 df3 df4 |
 -----------------
| df1 df2 df3 df4 |
 -----------------
 
如果把上面的maxopenfiles 4改为maxopenfiles 3;
那么生成backuppiece里将会呈现如下分布:
 -----------------
| df1 df2 df3 df1 |
 -----------------
| df2 df3 df4 df4 |
 -----------------

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

请登录后发表评论 登录
全部评论
不仅仅专注Oracle database技术, member of SHOUG

注册时间:2014-04-06

  • 博文量
    128
  • 访问量
    1617046