Oracle11gR1的新特性,Rman备份UNDO表空间时排除已经提交的会话对应的数据,提高了Rman备份的效率。
官方文档:http://docs.oracle.com/cd/B28359_01/server.111/b28279/chapter1.htm#AREANO02323
我们知道,UNDO表空间主要用于存储前镜像数据,这些数据在回滚以及恢复过程中可能被用到。但是一个生产数据库的UNDO表空间可能会变得非常巨大,而备份完整的UNDO数据文件在恢复时一般可能用到的比例很小。
测试一下:
--数据库版本 sys@ORCL>select*fromv$version; BANNER ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction PL/sqlRelease11.2.0.4.0-Production CORE 11.2.0.4.0 Production TNSforLinux:Version11.2.0.4.0-Production NLSRTLVersion11.2.0.4.0-Production --创建环境 zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>insertintot1select*fromdba_segments; 5887rowscreated. zx@ORCL>commit; Commitcomplete. zx@ORCL>deletefromt1; 288463rowsdeleted. zx@ORCL>selectstatus,sum(bytes)/1024/1024fromdba_undo_extentsgroupbystatus; STATUS SUM(BYTES)/1024/1024 ----------------------------------------------- UNEXPIRED 9.125 EXPIRED .4375 ACTIVE 89.125 zx@ORCL>commit; Commitcomplete. --两次备份undo表空间文件 RMAN>backupdatafile5; Startingbackupat2016-12-2213:09:27 usingchannelORA_DISK_1 channelORA_DISK_1:startingfulldatafilebackupset channelORA_DISK_1:specifyingdatafile(s)inbackupset inputdatafilefilenumber=00005name=/u02/app/oracle/oradata/orcl/undotbs2_01.dbf channelORA_DISK_1:startingpiece1at2016-12-2213:09:27 channelORA_DISK_1:finishedpiece1at2016-12-2213:09:28 piecehandle=/u02/app/oracle/product/11.2.4/db1/dbs/3aro4007_1_1tag=TAG20161222T130927comment=NONE channelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:01 Finishedbackupat2016-12-2213:09:28 StartingControlFileandSPFILEAutobackupat2016-12-2213:09:28 piecehandle=/u02/app/oracle/product/11.2.4/db1/dbs/c-1444351641-20161222-0fcomment=NONE FinishedControlFileandSPFILEAutobackupat2016-12-2213:09:31 --查看备份后的文件大小 RMAN>listbackupofdatafile5; ListofBackupSets =================== --第一次备份文件大小99.27M BSKeyTypeLVSizeDeviceTypeElapsedTimeCompletionTime ----------------------------------------------------------------- 87Full99.27MDISK00:00:032016-12-2212:11:54 BPKey:87Status:AVAILABLECompressed:NOTag:TAG20161222T121151 PieceName:/u02/app/oracle/product/11.2.4/db1/dbs/36ro3sk7_1_1 ListofDatafilesinbackupset87 FileLVTypeCkpSCNCkpTimeName ------------------------------------------- 5Full90420312016-12-2212:11:51/u02/app/oracle/oradata/orcl/undotbs2_01.dbf --第二次备份文件大小2.16M BSKeyTypeLVSizeDeviceTypeElapsedTimeCompletionTime ----------------------------------------------------------------- 89Full2.16MDISK00:00:012016-12-2212:34:42 BPKey:89Status:AVAILABLECompressed:NOTag:TAG20161222T123441 PieceName:/u02/app/oracle/product/11.2.4/db1/dbs/38ro3tv1_1_1 ListofDatafilesinbackupset89 FileLVTypeCkpSCNCkpTimeName ------------------------------------------- 5Full90425762016-12-2212:34:41/u02/app/oracle/oradata/orcl/undotbs2_01.dbf --查看操作系统文件大小 [oracle@rhel6release]$ls-lh/u02/app/oracle/product/11.2.4/db1/dbs/36ro3sk7_1_1 -rw-r-----1oracleoinstall100MDec2212:11/u02/app/oracle/product/11.2.4/db1/dbs/36ro3sk7_1_1 [oracle@rhel6release]$ls-lh/u02/app/oracle/product/11.2.4/db1/dbs/38ro3tv1_1_1 -rw-r-----1oracleoinstall2.2MDec2212:34/u02/app/oracle/product/11.2.4/db1/dbs/38ro3tv1_1_1
这个新特性也有一些限制
- Compatible parametermust beset to 11.0 or higher
- Backup must use a disk or OSB channel
- For 'backup copy of <object>' or 'backup datafilecopy' thedatabase must be open for undo optimization to be used.
- Not active for LEVEL 1 incremental backups,only for LEVEL 0 and FULL backups
MOS文档:RMAN 11G : RMAN UNDO backup optimization (文档 ID 406468.1)
A Complete Understanding of RMAN Compression (文档 ID 563427.1)