ITPub博客

首页 > 数据库 > Oracle > 没有tag标识备份的情况下incremental updating backup是如何运行的

没有tag标识备份的情况下incremental updating backup是如何运行的

原创 Oracle 作者:oliseh 时间:2015-05-27 19:50:23 0 删除 编辑
incremental updating backups能够将增量备份应用在datafilecopy上,使得datafilecopy能始终保持更新,很大程度上缩短了恢复时间,典型的用法是
run
{
recover copy of datafile 10 with tag 'df10';
backup incremental level 1 for recover of copy with tag 'df10' datafile 10;
}

上面两次出现了tag 'df10',对datafilecopy和incremental backup进行标记,表示只能用具有'df10'标记的incremental backup来更新具有'df10'标记的datafilecopy,避免因为其它不在incremental updating backups策略里的备份掺杂进来而受到干扰。
像下面这样如果不用tag进行标记,会出现什么情况?
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

简单测试一下

###清理掉所有datafile 10的backup和copy
delete backup of datafile 10;
delete copy of datafile 10;

###首次执行
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 16:54:29
using channel ORA_DISK_1
no copy of datafile 10 found to recover
Finished recover at 20150527 16:54:29

Starting backup at 20150527 16:54:29
using channel ORA_DISK_1
no parent backup or copy of datafile 10 found
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=/oradata06/testaaaaa/ts0523.dbf
output file name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf tag=TAG20150527T165430 RECID=22 STAMP=880822473
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 20150527 16:54:34

RMAN> list backup of datafile 10;

specification does not match any backup in the repository

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
6026    10   A 20150527 16:54:33 12723362707368 20150527 16:54:31
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

###二次执行
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 16:55:41
using channel ORA_DISK_1
no copy of datafile 10 found to recover
Finished recover at 20150527 16:55:41

Starting backup at 20150527 16:55:41
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 16:55:43
channel ORA_DISK_1: finished piece 1 at 20150527 16:55:44
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp tag=TAG20150527T165542 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 16:55:44       

RMAN> list backup of datafile 10;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
6026    10   A 20150527 16:54:33 12723362707368 20150527 16:54:31
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

###三次执行
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 16:56:48
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00010 name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp tag=TAG20150527T165542
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished recover at 20150527 16:56:50

Starting backup at 20150527 16:56:52
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 16:56:53
channel ORA_DISK_1: finished piece 1 at 20150527 16:56:54
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp tag=TAG20150527T165652 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 16:56:54

RMAN> list backup of datafile 10;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6703    Incr 1  32.00K     DISK        00:00:01     20150527 16:56:54
        BP Key: 6705   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165652
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
  List of Datafiles in backup set 6703
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707649 20150527 16:56:53 /oradata06/testaaaaa/ts0523.dbf

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
6428    10   A 20150527 16:56:49 12723362707496 20150527 16:55:43
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

至此一切正常,就像加了tag一样,下面我们强行对datafile 10生成一份incremental level 0的datafilecopy

RMAN> backup incremental level 0 as copy datafile 10;       

Starting backup at 20150527 16:59:49
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=/oradata06/testaaaaa/ts0523.dbf
output file name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf tag=TAG20150527T165949 RECID=25 STAMP=880822792
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 20150527 16:59:54

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
7413    10   A 20150527 16:59:52 12723362707918 20150527 16:59:51
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf      <----新生成的copy
        Tag: TAG20150527T165949

6428    10   A 20150527 16:56:49 12723362707496 20150527 16:55:43
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

###四次执行,可以看到使用的datafilecopy仍然是首次执行生成的o1_mf_ts0523_1jvkBwE8C_.dbf
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 17:01:55
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00010 name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp tag=TAG20150527T165652
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 20150527 17:01:56

Starting backup at 20150527 17:01:58
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 17:02:00
channel ORA_DISK_1: finished piece 1 at 20150527 17:02:01
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp tag=TAG20150527T170158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 17:02:01

RMAN> list backup of datafile 10;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6703    Incr 1  32.00K     DISK        00:00:01     20150527 16:56:54
        BP Key: 6705   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165652
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
  List of Datafiles in backup set 6703
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707649 20150527 16:56:53 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
7855    Incr 1  32.00K     DISK        00:00:01     20150527 17:02:01
        BP Key: 7857   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T170158
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
  List of Datafiles in backup set 7855
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362708222 20150527 17:02:00 /oradata06/testaaaaa/ts0523.dbf

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
7413    10   A 20150527 16:59:52 12723362707918 20150527 16:59:51
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf
        Tag: TAG20150527T165949

7560    10   A 20150527 17:01:55 12723362707649 20150527 16:56:53
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

选择首次执行生成的o1_mf_ts0523_1jvkBwE8C_.dbf进行recover的原因是强行生成的o1_mf_ts0523_1jvkU-Hdw_.dbf在四次执行recovery copy of datafile 10时尚没有合适的基于其自身的incremental level 1 backup,但是backup incremental level 1 for recover of copy datafile 10生成却是基于o1_mf_ts0523_1jvkU-Hdw_.dbf而生成的,从下面的查询结果可以看出

---在catalog db里查看datafile 10的copy信息
RMAN@tstdb2-SQL> select copy_key,file#,checkpoint_change#,checkpoint_time from rc_backup_copy_details where file#=10;

        COPY_KEY            FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME
---------------- ---------------- ------------------ -----------------
            7413               10     12723362707918 20150527 16:59:51
            7560               10     12723362707649 20150527 16:56:53

---在catalog db里查看datafile 10的所有ncremental level 1 backup信息
set numwidth 16
set linesize 120
RMAN@tstdb2-SQL>select bs_key,incremental_level,completion_time,incremental_change#,checkpoint_change# from rc_backup_datafile where file#=10 order by completion_time;
          BS_KEY INCREMENTAL_LEVEL COMPLETION_TIME   INCREMENTAL_CHANGE# CHECKPOINT_CHANGE#
---------------- ----------------- ----------------- ------------------- ------------------
            6289                 1 20150527 16:55:44      12723362707368     12723362707496
            6703                 1 20150527 16:56:54      12723362707496     12723362707649
            7855                 1 20150527 17:02:01      12723362707918     12723362708222

从上述信息可以看出最新生成的incremental level 1的backup(BS_KEY=7855)是基于COPY_KEY=7413所对应的copy,因为COPY_KEY=7413的CHECKPOINT_CHANGE#比COPY_KEY=7560的CHECKPOINT_CHANGE#更大,RMAN incremental level 1 backup总是会在最近的一次level 0或者level 1 backup的基础上进行,所以选择了COPY_KEY=7413这个copy

###五次执行,会发现recover的datafilecopy变为了o1_mf_ts0523_1jvkU-Hdw_.dbf,选择的incremental level 1 backup是第四次执行中生成的o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
run
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 18:30:16
 allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=466 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00010 name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp tag=TAG20150527T170158
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 20150527 18:30:18

Starting backup at 20150527 18:30:20
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 18:30:22
channel ORA_DISK_1: finished piece 1 at 20150527 18:30:23
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp tag=TAG20150527T183020 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 18:30:23       

RMAN> list backup of datafile 10;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6703    Incr 1  32.00K     DISK        00:00:01     20150527 16:56:54
        BP Key: 6705   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165652
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
  List of Datafiles in backup set 6703
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707649 20150527 16:56:53 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
7855    Incr 1  32.00K     DISK        00:00:01     20150527 17:02:01
        BP Key: 7857   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T170158
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
  List of Datafiles in backup set 7855
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362708222 20150527 17:02:00 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
8473    Incr 1  32.00K     DISK        00:00:01     20150527 18:30:23
        BP Key: 8475   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T183020
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp
  List of Datafiles in backup set 8473
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362713971 20150527 18:30:22 /oradata06/testaaaaa/ts0523.dbf

RMAN> list copy of datafile 10;

List of Datafile Copies
=======================

Key     File S Completion Time   Ckp SCN    Ckp Time        
------- ---- - ----------------- ---------- -----------------
8162    10   A 20150527 18:30:17 12723362708222 20150527 17:02:00
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf
        Tag: TAG20150527T165949

7560    10   A 20150527 17:01:55 12723362707649 20150527 16:56:53
        Name: /oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkBwE8C_.dbf
        Tag: TAG20150527T165430

###强行对datafile 10生成incremental level 1 backup
RMAN> backup incremental level 1 datafile 10;

Starting backup at 20150527 18:36:49
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 18:36:51
channel ORA_DISK_1: finished piece 1 at 20150527 18:36:52
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp tag=TAG20150527T183649 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 18:36:52

---列出最新的backup
RMAN> list backup of datafile 10;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6703    Incr 1  32.00K     DISK        00:00:01     20150527 16:56:54
        BP Key: 6705   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165652
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
  List of Datafiles in backup set 6703
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707649 20150527 16:56:53 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
7855    Incr 1  32.00K     DISK        00:00:01     20150527 17:02:01
        BP Key: 7857   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T170158
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
  List of Datafiles in backup set 7855
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362708222 20150527 17:02:00 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
8473    Incr 1  32.00K     DISK        00:00:01     20150527 18:30:23
        BP Key: 8475   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T183020
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp
  List of Datafiles in backup set 8473
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362713971 20150527 18:30:22 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
8793    Incr 1  32.00K     DISK        00:00:01     20150527 18:36:52
        BP Key: 8795   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T183649
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp
  List of Datafiles in backup set 8793
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362714552 20150527 18:36:51 /oradata06/testaaaaa/ts0523.dbf
 
###六次执行,o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp这个增量备份是基于第五次输出的Key=8162这个datafile copy
、o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp这个增量备份是基于o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp
{
recover copy of datafile 10;
backup incremental level 1 for recover of copy datafile 10;
}

Starting recover at 20150527 18:43:27
 using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00010 name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp tag=TAG20150527T183020
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00010 name=/oradata06/fra/TSTDB1/datafile/o1_mf_ts0523_1jvkU-Hdw_.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp tag=TAG20150527T183649
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 20150527 18:43:29

Starting backup at 20150527 18:43:31
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=00010 name=/oradata06/testaaaaa/ts0523.dbf
channel ORA_DISK_1: starting piece 1 at 20150527 18:43:33
channel ORA_DISK_1: finished piece 1 at 20150527 18:43:34
piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T184331_1jvqHrmUe_.bkp tag=TAG20150527T184331 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20150527 18:43:34      

RMAN@tstdb2-SQL> select bs_key,incremental_level,completion_time,incremental_change#,checkpoint_change# from rc_backup_datafile where file#=10 order by completion_time;

          BS_KEY INCREMENTAL_LEVEL COMPLETION_TIME   INCREMENTAL_CHANGE# CHECKPOINT_CHANGE#
---------------- ----------------- ----------------- ------------------- ------------------
            6289                 1 20150527 16:55:44      12723362707368     12723362707496
            6703                 1 20150527 16:56:54      12723362707496     12723362707649
            7855                 1 20150527 17:02:01      12723362707918     12723362708222
            8473                 1 20150527 18:30:23      12723362708222     12723362713971
            8793                 1 20150527 18:36:52      12723362713971     12723362714552
            9289                 1 20150527 18:43:34      12723362714552     12723362715035

6 rows selected.

RMAN@tstdb2-SQL> select copy_key,file#,checkpoint_change#,checkpoint_time from rc_backup_copy_details where file#=10;

        COPY_KEY            FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME
---------------- ---------------- ------------------ -----------------
            7560               10     12723362707649 20150527 16:56:53
            8960               10     12723362714552 20150527 18:36:51

RMAN> list backup of datafile 10;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6289    Incr 1  32.00K     DISK        00:00:01     20150527 16:55:44
        BP Key: 6290   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165542
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165542_1jvkGD7SV_.bkp
  List of Datafiles in backup set 6289
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707496 20150527 16:55:43 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
6703    Incr 1  32.00K     DISK        00:00:01     20150527 16:56:54
        BP Key: 6705   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T165652
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T165652_1jvkKO5ej_.bkp
  List of Datafiles in backup set 6703
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362707649 20150527 16:56:53 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
7855    Incr 1  32.00K     DISK        00:00:01     20150527 17:02:01
        BP Key: 7857   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T170158
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T170158_1jvkcgD_w_.bkp
  List of Datafiles in backup set 7855
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362708222 20150527 17:02:00 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
8473    Incr 1  32.00K     DISK        00:00:01     20150527 18:30:23
        BP Key: 8475   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T183020
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183020_1jvpYgU5o_.bkp
  List of Datafiles in backup set 8473
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362713971 20150527 18:30:22 /oradata06/testaaaaa/ts0523.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ -----------------
8793    Incr 1  32.00K     DISK        00:00:01     20150527 18:36:52
        BP Key: 8795   Status: AVAILABLE  Compressed: NO  Tag: TAG20150527T183649
        Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_27/o1_mf_nnnd1_TAG20150527T183649_1jvpvt3PW_.bkp
  List of Datafiles in backup set 8793
  File LV Type Ckp SCN    Ckp Time          Name
  ---- -- ---- ---------- ----------------- ----
  10   1  Incr 12723362714552 20150527 18:36:51 /oradata06/testaaaaa/ts0523.dbf


从上述结果可以推断出,在执行"recover copy of datafile 10"的时候,如果存在多个datafilecopy,那么RMAN会按照如下条件选择:
时间最近的一次datafilecopy,且要有基于该次Datafilecopy的incremental level 1 backup用来配合recover,这样的datafilecopy才会被选中;
在执行"backup incremental level 1 for recover of copy datafile 10"的时候总是会以最近的一次datafilecopy为基础进行level 1的增量备份


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/53956/viewspace-1674291/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 都是时区惹的祸
请登录后发表评论 登录
全部评论
不仅仅专注Oracle database技术, member of SHOUG

注册时间:2014-04-06

  • 博文量
    128
  • 访问量
    1616949