上QQ阅读APP看书,第一时间看更新
4.3.8 创建多段备份
创建多个段是一件易如反掌的事情,但是必须使用每个BACKUP命令指定段大小。另外,可以按段运行RMAN VALIDATE命令。新数据字典视图V$和RC_帮助你确定哪些备份是多段备份,以及多段备份中的每个段包含多少个数据块。
1.指定段大小
要创建多段备份,可以为BACKUP命令添加SECTION SIZE参数。可按KB、MB或GB指定段大小。以下是指定多段备份的常用语法:
BACKUP <backup options> SECTION SIZE <size> [K|M|G]
在本例的HR数据库中,USERS表空间约为25MB,并且在备份该表空间时希望使用10MB的段大小:
RMAN> backup tablespace users 2> section size 100m; Starting backup at 25-FEB-14 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 channel ORA_DISK_1: starting compressed full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 backing up blocks 1 through 12800 channel ORA_DISK_1: starting piece 1 at 25-FEB-14 channel ORA_DISK_2: starting compressed full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00006 name=+DATA/RPT12C/DATAFILE/users.259.826650843 channel ORA_DISK_2: starting piece 1 at 25-FEB-14 channel ORA_DISK_3: starting compressed full datafile backup set channel ORA_DISK_3: specifying datafile(s) in backup set input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 backing up blocks 12801 through 25600 channel ORA_DISK_3: starting piece 2 at 25-FEB-14 channel ORA_DISK_4: starting compressed full datafile backup set channel ORA_DISK_4: specifying datafile(s) in backup set input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 backing up blocks 25601 through 32000 channel ORA_DISK_4: starting piece 3 at 25-FEB-14 channel ORA_DISK_1: finished piece 1 at 25-FEB-14 piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/ nnndf0_tag20140225t101644_0.278.840449805 tag=TAG20140225T101644 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_2: finished piece 1 at 25-FEB-14 piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/
nnndf0_tag20140225t101644_0.277.840449805 tag=TAG20140225T101644 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_3: finished piece 2 at 25-FEB-14 piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/ nnndf0_tag20140225t101644_0.276.840449807 tag=TAG20140225T101644 comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_4: finished piece 3 at 25-FEB-14 piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/ nnndf0_tag20140225t101644_0.275.840449807 tag=TAG20140225T101644 comment=NONE channel ORA_DISK_4: backup set complete, elapsed time: 00:00:01 Finished backup at 25-FEB-14 RMAN>
此备份创建3个备份段:前两个段的大小都是100MB,第三个段的大小约为50MB,是数据文件剩余的大小。
提示:
在少量磁盘上备份大型文件时,不要为多段备份使用大的并发值。多个RMAN线程访问同一个磁盘时,由于产生了I/O争用,将会使高并发值带来的时间节省优势荡然无存。
2.使用段大小验证备份
还可以将SECTION SIZE参数与VALIDATE命令结合使用。数据文件块验证的并发操作的优势与使用BACKUP命令的优势是一样的:将使用少得多的时间确保数据文件的块是可读的,而且“校验和”有效。此例验证上一节中备份的数据文件:
RMAN> validate tablespace users 2> section size 100m; Starting validate at 25-FEB-14 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00006 name=+DATA/RPT12C/DATAFILE/users.259.826650843 channel ORA_DISK_2: starting validation of datafile channel ORA_DISK_2: specifying datafile(s) for validation input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 validating blocks 1 through 12800 channel ORA_DISK_3: starting validation of datafile channel ORA_DISK_3: specifying datafile(s) for validation
input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 validating blocks 12801 through 25600 channel ORA_DISK_4: starting validation of datafile channel ORA_DISK_4: specifying datafile(s) for validation input datafile file number=00005 name=+DATA/RPT12C/DATAFILE/users.269.826931347 validating blocks 25601 through 32000 channel ORA_DISK_1: validation complete, elapsed time: 00:00:02 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- --------------------------- ---------- 6 OK 0 16 257 15654354 File Name: +DATA/RPT12C/DATAFILE/users.259.826650843 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 30 Index 0 5 Other 0 205 channel ORA_DISK_2: validation complete, elapsed time: 00:00:02 channel ORA_DISK_3: validation complete, elapsed time: 00:00:03 channel ORA_DISK_4: validation complete, elapsed time: 00:00:03 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 5 OK 0 31873 31998 1991172 File Name: +DATA/RPT12C/DATAFILE/users.269.826931347 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 125 Finished validate at 25-FEB-14 RMAN>
3.多段数据字典视图
V$BACKUP_SET和RC_BACKUP_SET视图具有MULTI_SECTION列,此列指示备份是否是多段备份。同样,V$BACKUP_DATAFILE和RC_BACKUP_DATAFILE视图具有SECTION_SIZE列,此列指示多段备份中每个段的块数。注意,V$视图仅在目标数据库上存在,而RC_视图仅在恢复目录数据库上存在。