Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3127962
  • 博文数量: 206
  • 博客积分: 3409
  • 博客等级: 中校
  • 技术积分: 4066
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 10:21
个人简介

● ITPUB名人堂嘉宾 ● ChinaUnix社区博客专家 ● ChinaUnix社区Oracle板块版主 ● 优酷网认证音乐牛人:EricGuitar ● SDOUG 核心成员 ●E-mail:gaoqiangdba@163.com

文章分类

全部博文(206)

文章存档

2021年(11)

2020年(7)

2019年(7)

2016年(5)

2015年(36)

2014年(23)

2013年(15)

2012年(23)

2011年(61)

2010年(18)

分类: Oracle

2015-03-10 16:07:12

  


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

 实际上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的备份集中。
阅读(4824) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~