hotmail
作者hotmail·2015-03-23 13:59
软件开发工程师·hotmail

Oracle RMAN 无明显数据更新和业务情况下增量备份情况实验

字数 10624阅读 1328评论 0赞 0

同事在项目中遇到个疑问:近期数据库几乎没有业务,在增量备份中,有新的归档日志备份进来可以理解,发现数据文件也有新的备份,他感觉新的数据信息按说应该在新产生的归档文件中记录,而不进行增量的数据文件备份。

 实际上Oracle在备份的时候扫描数据文件的数据块,发现有SCN比较新则会备份该数据块。

 官方原文:
 Each data block in a datafile contains a system change number (SCN), which is the SCN at which the most recent change was made to the block. During an incremental backup, RMAN reads the SCN of each data block in the input file and compares it to the checkpoint SCN of the parent incremental backup. If the SCN in the input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN copies the block.

测试验证:

RMAN> backup incremental level 0 database tag level_0;                -----进行一次0级别的全备
Starting backup at 07-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/app/oradata/ORCL/datafile/o1_mf_system_8xm4839m_.dbf
input datafile file number=00002 name=/oracle/app/oradata/ORCL/datafile/o1_mf_sysaux_8xm483f7_.dbf
input datafile file number=00005 name=/oracle/app/oradata/ORCL/datafile/o1_mf_example_8xm4gzck_.dbf
input datafile file number=00003 name=/oracle/app/oradata/ORCL/datafile/o1_mf_undotbs1_8xm483gd_.dbf
input datafile file number=00004 name=/oracle/app/oradata/ORCL/datafile/o1_mf_users_8xm483jk_.dbf
input datafile file number=00006 name=/oracle/app/oradata/catalog_rman/rmantbs01.dbf
input datafile file number=00009 name=/oracle/app/oradata/ORCL/datafile/lee.dbf
input datafile file number=00010 name=/oracle/app/oradata/ORCL/datafile/jon.dbf
input datafile file number=00007 name=/oracle/app/oradata/ORCL/datafile/gaoqiang.dbf
input datafile file number=00008 name=/oracle/app/oradata/ORCL/datafile/gao.dbf
channel ORA_DISK_1: starting piece 1 at 07-FEB-15
channel ORA_DISK_1: finished piece 1 at 07-FEB-15
piece handle=/oracle/app/oracle/product/11.2.0/db_1/dbs/1opulda4_1_1 tag=LEVEL_0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 07-FEB-15
channel ORA_DISK_1: finished piece 1 at 07-FEB-15
piece handle=/oracle/app/oracle/product/11.2.0/db_1/dbs/1ppuldat_1_1 tag=LEVEL_0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-FEB-15


RMAN> backup incremental level 1 database tag level_1;       ---进行一次1级别的增量备份
Starting backup at 07-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/app/oradata/ORCL/datafile/o1_mf_system_8xm4839m_.dbf
input datafile file number=00002 name=/oracle/app/oradata/ORCL/datafile/o1_mf_sysaux_8xm483f7_.dbf
input datafile file number=00005 name=/oracle/app/oradata/ORCL/datafile/o1_mf_example_8xm4gzck_.dbf
input datafile file number=00003 name=/oracle/app/oradata/ORCL/datafile/o1_mf_undotbs1_8xm483gd_.dbf
input datafile file number=00004 name=/oracle/app/oradata/ORCL/datafile/o1_mf_users_8xm483jk_.dbf
input datafile file number=00006 name=/oracle/app/oradata/catalog_rman/rmantbs01.dbf
input datafile file number=00009 name=/oracle/app/oradata/ORCL/datafile/lee.dbf
input datafile file number=00010 name=/oracle/app/oradata/ORCL/datafile/jon.dbf
input datafile file number=00007 name=/oracle/app/oradata/ORCL/datafile/gaoqiang.dbf
input datafile file number=00008 name=/oracle/app/oradata/ORCL/datafile/gao.dbf
channel ORA_DISK_1: starting piece 1 at 07-FEB-15
channel ORA_DISK_1: finished piece 1 at 07-FEB-15
piece handle=/oracle/app/oracle/product/11.2.0/db_1/dbs/1qpuldbu_1_1 tag=LEVEL_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 07-FEB-15
channel ORA_DISK_1: finished piece 1 at 07-FEB-15
piece handle=/oracle/app/oracle/product/11.2.0/db_1/dbs/1rpuldcn_1_1 tag=LEVEL_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-FEB-15







查看备份集信息:
RMAN> list backup summary;
List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
51      B  0  A DISK        07-FEB-15       1       1       NO         LEVEL_0
52      B  0  A DISK        07-FEB-15       1       1       NO         LEVEL_0
53      B  1  A DISK        07-FEB-15       1       1       NO         LEVEL_1
54      B  1  A DISK        07-FEB-15       1       1       NO         LEVEL_1


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
51      Incr 0  1.12G      DISK        00:00:21     07-FEB-15               ---0级全备有1.12G的数据量
        BP Key: 65   Status: AVAILABLE  Compressed: NO  Tag: LEVEL_0
        Piece Name: /oracle/app/oracle/product/11.2.0/db_1/dbs/1opulda4_1_1
  List of Datafiles in backup set 51
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_system_8xm4839m_.dbf
  2    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_sysaux_8xm483f7_.dbf
  3    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_undotbs1_8xm483gd_.dbf
  4    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_users_8xm483jk_.dbf
  5    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_example_8xm4gzck_.dbf
  6    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/catalog_rman/rmantbs01.dbf
  7    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/gaoqiang.dbf
  8    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/gao.dbf
  9    0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/lee.dbf
  10   0  Incr 3301755    07-FEB-15 /oracle/app/oradata/ORCL/datafile/jon.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
52      Incr 0  9.36M      DISK        00:00:01     07-FEB-15      
        BP Key: 66   Status: AVAILABLE  Compressed: NO  Tag: LEVEL_0
        Piece Name: /oracle/app/oracle/product/11.2.0/db_1/dbs/1ppuldat_1_1
  SPFILE Included: Modification time: 07-FEB-15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3301764      Ckp time: 07-FEB-15


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
53      Incr 1  104.00K    DISK        00:00:16     07-FEB-15         ---1级增量备份中该备份级包含数据文件的增量数据量有104K的变化量
        BP Key: 67   Status: AVAILABLE  Compressed: NO  Tag: LEVEL_1
        Piece Name: /oracle/app/oracle/product/11.2.0/db_1/dbs/1qpuldbu_1_1
  List of Datafiles in backup set 53
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_system_8xm4839m_.dbf
  2    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_sysaux_8xm483f7_.dbf
  3    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_undotbs1_8xm483gd_.dbf
  4    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_users_8xm483jk_.dbf
  5    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/o1_mf_example_8xm4gzck_.dbf
  6    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/catalog_rman/rmantbs01.dbf
  7    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/gaoqiang.dbf
  8    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/gao.dbf
  9    1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/lee.dbf
  10   1  Incr 3301785    07-FEB-15 /oracle/app/oradata/ORCL/datafile/jon.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
54      Incr 1  9.36M      DISK        00:00:01     07-FEB-15      
        BP Key: 68   Status: AVAILABLE  Compressed: NO  Tag: LEVEL_1
        Piece Name: /oracle/app/oracle/product/11.2.0/db_1/dbs/1rpuldcn_1_1
  SPFILE Included: Modification time: 07-FEB-15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3301793      Ckp time: 07-FEB-15


OK,因此我们可以确定,即使是:不管备份不备份归档日志,数据文件的快变化信息都会备份到RMAN的备份集中。

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广