沒有tag標識備份的情況下incremental updating backup是如何執行的

oliseh發表於2015-05-27
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     
        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資訊
> 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
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      

> 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.

> 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章