作者:dbtan |【转载时请以超链接形式标明文章出处作者信息】


Oracle 11g UNDO表空间备份增强:

前面提到,由于UNDO表空间在恢复时不可缺少,所以在进行备份时必须备份该表空间,但是一旦事务提交,修改被确认,则该事务的前镜像被标记为INACTIVE,其中的信息在恢复时也就不会被用到,如果在备份时能够跳过这些数据,则备份UNDO表空间的效率就可以大大提高。

在Oracle Database 11g中,Oracle引入了一个新的特性RMAN UNDO备份优化。在RMAN备份UNDO表空间时,提交事务的UNDO信息将不备份,这个特性随RMAN强制启用。在测试中,一个395MB的UNDO表空间备份文件的大小仅为10.06M:

sys@TQGZS11G> select file#,name,ceil(bytes/1024/1024) MB,status from v$datafile;  
     FILE# NAME                                                       MB STATUS
---------- -------------------------------------------------- ---------- ----------
         1 /oracle/oradata/tqgzs11g/system01.dbf                     740 SYSTEM
         2 /oracle/oradata/tqgzs11g/sysaux01.dbf                     645 ONLINE
         3 /oracle/oradata/tqgzs11g/undotbs01.dbf                    395 ONLINE
         4 /oracle/oradata/tqgzs11g/users01.dbf                       13 ONLINE
         5 /oracle/oradata/tqgzs11g/example01.dbf                    100 ONLINE
         6 /oracle/oradata/tqgzs11g/TQ.dbf                           100 ONLINE
6 rows selected.

[oracle@rhel52: ~]$rman target /
[uniread] Loaded history (5 lines)
Recovery Manager: Release 11.1.0.7.0 - Production on Sat Dec 26 20:41:37 2009
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: TQGZS11G (DBID=3743726461)

RMAN> backup datafile 3 format '/oracle/rmanbk/undotbs_%d_%T_%s_%p.bak';

Starting backup at 26-DEC-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=138 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oracle/oradata/tqgzs11g/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 26-DEC-09
channel ORA_DISK_1: finished piece 1 at 26-DEC-09
piece handle=/oracle/rmanbk/undotbs_TQGZS11G_20091226_2_1.bak tag=TAG20091226T204142 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 26-DEC-09

RMAN> list backup;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    10.06M     DISK        00:00:04     26-DEC-09     
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20091226T204142
        Piece Name: /oracle/rmanbk/undotbs_TQGZS11G_20091226_2_1.bak
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 1065943    26-DEC-09 /oracle/oradata/tqgzs11g/undotbs01.dbf

这一特性是许多DBA期待已久的,在一个繁忙的生产环境中,UNDO表空间可能占用几十GB的空间,全部备份显然并不合理,现在Oracle 11g解决了这个问题。

- The End -