本帖最后由 fishcat 于 2013-1-5 22:42 编辑
fishcat论 RMAN备份中加filesperset的重要性
测试版本:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
主要是想通过本实验说明一下在RMAN备份中加filesperset的重要性。
1.首先我们来看一下不加filesperset的情况
备份脚本如下
run{
BACKUP
FORMAT '/backup/arch_%T_%s_%p'
SKIP INACCESSIBLE
ARCHIVELOG ALL DELETE INPUT;
}
输出结果如下;
RMAN> run{
2> BACKUP
3> FORMAT '/backup/arch_%T_%s_%p'
4> SKIP INACCESSIBLE
5> ARCHIVELOG ALL DELETE INPUT;
6> }
Starting backup at 06-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=18 stamp=799372426
input archive log thread=1 sequence=8 recid=19 stamp=799388587
input archive log thread=1 sequence=9 recid=20 stamp=799388917
input archive log thread=1 sequence=10 recid=21 stamp=799388919
input archive log thread=1 sequence=11 recid=22 stamp=799388978
input archive log thread=1 sequence=12 recid=23 stamp=799388978
input archive log thread=1 sequence=13 recid=24 stamp=799389020
input archive log thread=1 sequence=14 recid=25 stamp=799389021
input archive log thread=1 sequence=15 recid=26 stamp=799389074
input archive log thread=1 sequence=16 recid=27 stamp=799389074
input archive log thread=1 sequence=17 recid=28 stamp=799389127
input archive log thread=1 sequence=18 recid=29 stamp=799389127
input archive log thread=1 sequence=19 recid=30 stamp=799389180
input archive log thread=1 sequence=20 recid=31 stamp=799389180
input archive log thread=1 sequence=21 recid=32 stamp=799389259
input archive log thread=1 sequence=22 recid=33 stamp=799629023
input archive log thread=1 sequence=25 recid=36 stamp=802827464
input archive log thread=1 sequence=26 recid=37 stamp=802931160
input archive log thread=1 sequence=27 recid=38 stamp=803005819
input archive log thread=1 sequence=28 recid=39 stamp=803019943
input archive log thread=1 sequence=30 recid=42 stamp=803023367
input archive log thread=1 sequence=41 recid=52 stamp=803024144
input archive log thread=1 sequence=42 recid=53 stamp=803024161
input archive log thread=1 sequence=43 recid=54 stamp=803024198
input archive log thread=1 sequence=44 recid=55 stamp=803024226
input archive log thread=1 sequence=45 recid=56 stamp=803342776
input archive log thread=1 sequence=46 recid=57 stamp=803425515
input archive log thread=1 sequence=47 recid=58 stamp=803534463
input archive log thread=1 sequence=48 recid=59 stamp=803690908
input archive log thread=1 sequence=49 recid=60 stamp=803706266
input archive log thread=1 sequence=50 recid=61 stamp=803968227
input archive log thread=1 sequence=51 recid=62 stamp=803969590
input archive log thread=1 sequence=52 recid=63 stamp=803970041
input archive log thread=1 sequence=53 recid=64 stamp=803970265
input archive log thread=1 sequence=54 recid=65 stamp=803970612
channel ORA_DISK_1: starting piece 1 at 06-JAN-13 --------------开始备份
从以上可以看到分配了channel,并输入归档文件sequence1-54(输入的日志中间有些不连续,是因为用filesperset备过的原因)
然后开始备份
等备份一段时间后中断备份,并查看备份的结果
user interrupt received
Finished backup at 06-JAN-13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03099: job cancelled at user request
-------------------结果
RMAN> list backup of archivelog all;
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
53 403.66M DISK 00:00:38 06-JAN-13
BP Key: 49 Status: AVAILABLE Compressed: NO Tag: TAG20130106T051012
Piece Name: /backup/arch_20130106_67_1
List of Archived Logs in backup set 53
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 7 611416 12-NOV-12 632618 14-NOV-12
1 8 632618 14-NOV-12 656229 15-NOV-12
1 9 656229 15-NOV-12 656659 15-NOV-12
1 10 656659 15-NOV-12 656666 15-NOV-12
1 11 656666 15-NOV-12 656718 15-NOV-12
1 12 656718 15-NOV-12 656724 15-NOV-12
1 13 656724 15-NOV-12 656752 15-NOV-12
1 14 656752 15-NOV-12 656758 15-NOV-12
1 15 656758 15-NOV-12 656816 15-NOV-12
1 16 656816 15-NOV-12 656822 15-NOV-12
1 17 656822 15-NOV-12 656875 15-NOV-12
1 18 656875 15-NOV-12 656881 15-NOV-12
1 19 656881 15-NOV-12 656939 15-NOV-12
1 20 656939 15-NOV-12 656945 15-NOV-12
1 21 656945 15-NOV-12 657008 15-NOV-12
1 22 657008 15-NOV-12 680522 17-NOV-12
1 25 740176 23-DEC-12 763905 23-DEC-12
1 26 763905 23-DEC-12 793371 25-DEC-12
1 27 793371 25-DEC-12 818199 26-DEC-12
1 28 818199 26-DEC-12 840267 26-DEC-12
1 30 842886 26-DEC-12 843130 26-DEC-12
1 41 853379 26-DEC-12 853732 26-DEC-12
1 42 853732 26-DEC-12 853785 26-DEC-12
1 43 853785 26-DEC-12 854108 26-DEC-12
1 44 854108 26-DEC-12 854175 26-DEC-12
1 45 854175 26-DEC-12 874461 29-DEC-12
1 46 874461 29-DEC-12 913135 30-DEC-12
1 47 913135 30-DEC-12 951276 01-JAN-13
1 48 951276 01-JAN-13 986830 02-JAN-13
1 49 986830 02-JAN-13 1016793 03-JAN-13
1 50 1016793 03-JAN-13 1045991 06-JAN-13
1 51 1045991 06-JAN-13 1049414 06-JAN-13
1 52 1049414 06-JAN-13 1049614 06-JAN-13
1 53 1049614 06-JAN-13 1049720 06-JAN-13
1 54 1049720 06-JAN-13 1050009 06-JAN-13
从备份集中可以看到已经从7-54备份了,因为刚好备54的时候中断了,但是我们就在这个时候
中断了,让备份失败了
然后我们重新备份又会出现什么情况呢
重新备份结果如下:
RMAN> run{
2> BACKUP
3> FORMAT '/backup/arch_%T_%s_%p'
4> SKIP INACCESSIBLE
5> ARCHIVELOG ALL DELETE INPUT;
6> }
Starting backup at 06-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=18 stamp=799372426
input archive log thread=1 sequence=8 recid=19 stamp=799388587
input archive log thread=1 sequence=9 recid=20 stamp=799388917
input archive log thread=1 sequence=10 recid=21 stamp=799388919
input archive log thread=1 sequence=11 recid=22 stamp=799388978
input archive log thread=1 sequence=12 recid=23 stamp=799388978
input archive log thread=1 sequence=13 recid=24 stamp=799389020
input archive log thread=1 sequence=14 recid=25 stamp=799389021
input archive log thread=1 sequence=15 recid=26 stamp=799389074
input archive log thread=1 sequence=16 recid=27 stamp=799389074
input archive log thread=1 sequence=17 recid=28 stamp=799389127
input archive log thread=1 sequence=18 recid=29 stamp=799389127
input archive log thread=1 sequence=19 recid=30 stamp=799389180
input archive log thread=1 sequence=20 recid=31 stamp=799389180
input archive log thread=1 sequence=21 recid=32 stamp=799389259
input archive log thread=1 sequence=22 recid=33 stamp=799629023
input archive log thread=1 sequence=25 recid=36 stamp=802827464
input archive log thread=1 sequence=26 recid=37 stamp=802931160
input archive log thread=1 sequence=27 recid=38 stamp=803005819
input archive log thread=1 sequence=28 recid=39 stamp=803019943
input archive log thread=1 sequence=30 recid=42 stamp=803023367
input archive log thread=1 sequence=41 recid=52 stamp=803024144
input archive log thread=1 sequence=42 recid=53 stamp=803024161
input archive log thread=1 sequence=43 recid=54 stamp=803024198
input archive log thread=1 sequence=44 recid=55 stamp=803024226
input archive log thread=1 sequence=45 recid=56 stamp=803342776
input archive log thread=1 sequence=46 recid=57 stamp=803425515
input archive log thread=1 sequence=47 recid=58 stamp=803534463
input archive log thread=1 sequence=48 recid=59 stamp=803690908
input archive log thread=1 sequence=49 recid=60 stamp=803706266
input archive log thread=1 sequence=50 recid=61 stamp=803968227
input archive log thread=1 sequence=51 recid=62 stamp=803969590
input archive log thread=1 sequence=52 recid=63 stamp=803970041
input archive log thread=1 sequence=53 recid=64 stamp=803970265
input archive log thread=1 sequence=54 recid=65 stamp=803970612
input archive log thread=1 sequence=55 recid=66 stamp=803970808
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
user interrupt received
Finished backup at 06-JAN-13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03099: job cancelled at user request
从这里可以看到,又重新备份7-54了
查看备份集中的结果如何:
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
53 403.66M DISK 00:00:38 06-JAN-13
BP Key: 49 Status: AVAILABLE Compressed: NO Tag: TAG20130106T051012
Piece Name: /backup/arch_20130106_67_1
List of Archived Logs in backup set 53
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 7 611416 12-NOV-12 632618 14-NOV-12
1 8 632618 14-NOV-12 656229 15-NOV-12
1 9 656229 15-NOV-12 656659 15-NOV-12
1 10 656659 15-NOV-12 656666 15-NOV-12
1 11 656666 15-NOV-12 656718 15-NOV-12
1 12 656718 15-NOV-12 656724 15-NOV-12
1 13 656724 15-NOV-12 656752 15-NOV-12
1 14 656752 15-NOV-12 656758 15-NOV-12
1 15 656758 15-NOV-12 656816 15-NOV-12
1 16 656816 15-NOV-12 656822 15-NOV-12
1 17 656822 15-NOV-12 656875 15-NOV-12
1 18 656875 15-NOV-12 656881 15-NOV-12
1 19 656881 15-NOV-12 656939 15-NOV-12
1 20 656939 15-NOV-12 656945 15-NOV-12
1 21 656945 15-NOV-12 657008 15-NOV-12
1 22 657008 15-NOV-12 680522 17-NOV-12
1 25 740176 23-DEC-12 763905 23-DEC-12
1 26 763905 23-DEC-12 793371 25-DEC-12
1 27 793371 25-DEC-12 818199 26-DEC-12
1 28 818199 26-DEC-12 840267 26-DEC-12
1 30 842886 26-DEC-12 843130 26-DEC-12
1 41 853379 26-DEC-12 853732 26-DEC-12
1 42 853732 26-DEC-12 853785 26-DEC-12
1 43 853785 26-DEC-12 854108 26-DEC-12
1 44 854108 26-DEC-12 854175 26-DEC-12
1 45 854175 26-DEC-12 874461 29-DEC-12
1 46 874461 29-DEC-12 913135 30-DEC-12
1 47 913135 30-DEC-12 951276 01-JAN-13
1 48 951276 01-JAN-13 986830 02-JAN-13
1 49 986830 02-JAN-13 1016793 03-JAN-13
1 50 1016793 03-JAN-13 1045991 06-JAN-13
1 51 1045991 06-JAN-13 1049414 06-JAN-13
1 52 1049414 06-JAN-13 1049614 06-JAN-13
1 53 1049614 06-JAN-13 1049720 06-JAN-13
1 54 1049720 06-JAN-13 1050009 06-JAN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
54 408.20M DISK 00:00:38 06-JAN-13
BP Key: 50 Status: AVAILABLE Compressed: NO Tag: TAG20130106T051756
Piece Name: /backup/arch_20130106_69_1
List of Archived Logs in backup set 54
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 7 611416 12-NOV-12 632618 14-NOV-12
1 8 632618 14-NOV-12 656229 15-NOV-12
1 9 656229 15-NOV-12 656659 15-NOV-12
1 10 656659 15-NOV-12 656666 15-NOV-12
1 11 656666 15-NOV-12 656718 15-NOV-12
1 12 656718 15-NOV-12 656724 15-NOV-12
1 13 656724 15-NOV-12 656752 15-NOV-12
1 14 656752 15-NOV-12 656758 15-NOV-12
1 15 656758 15-NOV-12 656816 15-NOV-12
1 16 656816 15-NOV-12 656822 15-NOV-12
1 17 656822 15-NOV-12 656875 15-NOV-12
1 18 656875 15-NOV-12 656881 15-NOV-12
1 19 656881 15-NOV-12 656939 15-NOV-12
1 20 656939 15-NOV-12 656945 15-NOV-12
1 21 656945 15-NOV-12 657008 15-NOV-12
1 22 657008 15-NOV-12 680522 17-NOV-12
1 25 740176 23-DEC-12 763905 23-DEC-12
1 26 763905 23-DEC-12 793371 25-DEC-12
1 27 793371 25-DEC-12 818199 26-DEC-12
1 28 818199 26-DEC-12 840267 26-DEC-12
1 30 842886 26-DEC-12 843130 26-DEC-12
1 41 853379 26-DEC-12 853732 26-DEC-12
1 42 853732 26-DEC-12 853785 26-DEC-12
1 43 853785 26-DEC-12 854108 26-DEC-12
1 44 854108 26-DEC-12 854175 26-DEC-12
1 45 854175 26-DEC-12 874461 29-DEC-12
1 46 874461 29-DEC-12 913135 30-DEC-12
1 47 913135 30-DEC-12 951276 01-JAN-13
1 48 951276 01-JAN-13 986830 02-JAN-13
1 49 986830 02-JAN-13 1016793 03-JAN-13
1 50 1016793 03-JAN-13 1045991 06-JAN-13
1 51 1045991 06-JAN-13 1049414 06-JAN-13
1 52 1049414 06-JAN-13 1049614 06-JAN-13
1 53 1049614 06-JAN-13 1049720 06-JAN-13
1 54 1049720 06-JAN-13 1050009 06-JAN-13
1 55 1050009 06-JAN-13 1050081 06-JAN-13
1 56 1050081 06-JAN-13 1051113 06-JAN-13
重备份集中可以看到,7-54存在2份备份,53和54号备份集中都存在备份
也就是说如果备份中途中断,那么再次备份的时候会将原来备份过的文件再次备份
这样的话如果是对于存储来说恐怕有点浪费空间了,ibm的高端存储10w一个T,可想而知
如果节省点空间就要节省多少money。
2,下面测试一下加上filesperset后的情况
备份脚本如下:
run{
BACKUP FILESPERSET 4
FORMAT '/backup/arch_%T_%s_%p'
SKIP INACCESSIBLE
ARCHIVELOG ALL DELETE INPUT;
}
--------------结果
RMAN> run{
2> BACKUP FILESPERSET 4
3> FORMAT '/backup/arch_%T_%s_%p'
4> SKIP INACCESSIBLE
5> ARCHIVELOG ALL DELETE INPUT;
6> }
Starting backup at 06-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=41 recid=52 stamp=803024144
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_71_1 tag=TAG20130106T052309 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_41_799111702.dbf recid=52 stamp=803024144
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=42 recid=53 stamp=803024161
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_72_1 tag=TAG20130106T052309 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_42_799111702.dbf recid=53 stamp=803024161
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=43 recid=54 stamp=803024198
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_73_1 tag=TAG20130106T052309 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_43_799111702.dbf recid=54 stamp=803024198
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=44 recid=55 stamp=803024226
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
user interrupt received
Finished backup at 06-JAN-13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03099: job cancelled at user request
备份到sequence44的时候中断
然后RMAN> list backup of archivelog all;看结果集
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
55 48.86M DISK 00:00:03 06-JAN-13
BP Key: 51 Status: AVAILABLE Compressed: NO Tag: TAG20130106T052309
Piece Name: /backup/arch_20130106_71_1
List of Archived Logs in backup set 55
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 41 853379 26-DEC-12 853732 26-DEC-12
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
56 48.86M DISK 00:00:03 06-JAN-13
BP Key: 52 Status: AVAILABLE Compressed: NO Tag: TAG20130106T052309
Piece Name: /backup/arch_20130106_72_1
List of Archived Logs in backup set 56
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 42 853732 26-DEC-12 853785 26-DEC-12
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
57 48.86M DISK 00:00:04 06-JAN-13
BP Key: 53 Status: AVAILABLE Compressed: NO Tag: TAG20130106T052309
Piece Name: /backup/arch_20130106_73_1
List of Archived Logs in backup set 57
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 43 853785 26-DEC-12 854108 26-DEC-12
---------结果集中显示备份到43了
下面继续备份
RMAN> run{
2> BACKUP FILESPERSET 4
3> FORMAT '/backup/arch_%T_%s_%p'
4> SKIP INACCESSIBLE
5> ARCHIVELOG ALL DELETE INPUT;
6> }
Starting backup at 06-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=28 recid=39 stamp=803019943
input archive log thread=1 sequence=30 recid=42 stamp=803023367
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_75_1 tag=TAG20130106T052642 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_28_799111702.dbf recid=39 stamp=803019943
archive log filename=/archive1/1_30_799111702.dbf recid=42 stamp=803023367
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=44 recid=55 stamp=803024226
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_76_1 tag=TAG20130106T052642 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_44_799111702.dbf recid=55 stamp=803024226
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=47 recid=58 stamp=803534463
input archive log thread=1 sequence=48 recid=59 stamp=803690908
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
channel ORA_DISK_1: finished piece 1 at 06-JAN-13
piece handle=/backup/arch_20130106_77_1 tag=TAG20130106T052642 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/archive1/1_47_799111702.dbf recid=58 stamp=803534463
archive log filename=/archive1/1_48_799111702.dbf recid=59 stamp=803690908
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=49 recid=60 stamp=803706266
input archive log thread=1 sequence=50 recid=61 stamp=803968227
input archive log thread=1 sequence=51 recid=62 stamp=803969590
channel ORA_DISK_1: starting piece 1 at 06-JAN-13
可以看到再次备份的时候已经不备份备份过的归档文件了
总结:1.如果不加filesperset,那么可能一个备份集中存在多个文件,如果这个备份集还没有备份完成,而中途
中断,那么下次备份的时候还会再次备份备份过的文件。
2.我们可以加filesperset来限制备份集的文件数,从而减少备份失败的文件,在备份失败后,下次备份节约空间
3.从上面可以看出,如果不加filesperset,所有文件用一个备份集的时候,在input文件的时候,是按照sequence的顺序的
如果加了filesperset则会用多个备份集,而input的时候则没按照顺序input。
4.rman删除文件是在一个备份集中所有文件备份完成之后删除的。
上面的实验还留有疑问:到底是input到备份集中的所有文件备份完成了,下次备份就不用重复备份,
还是因为DELETE INPUT把备份过的文件删除了,下次备份就不用重复备份呢?
只有下次论证了。。。 |
|