[20161220]rman恢复时间点的疑问.txt

[20161220]rman恢复时间点的疑问.txt

--昨天在恢复时遇到缺少归档的问题,自己开始感觉奇怪,做一点分析记录.

RMAN> list backupset summary ;

List of Backups
===============
Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
...
3899    B  F  A DISK        2016-12-03 03:31:43 1       1       YES        FULL 2016/12/03 03:31:01
3900    B  F  A DISK        2016-12-03 03:31:51 1       1       YES        FULL 2016/12/03 03:31:01
3901    B  F  A DISK        2016-12-03 03:31:53 1       1       YES        FULL 2016/12/03 03:31:01
3902    B  F  A DISK        2016-12-03 03:32:27 1       1       YES        FULL 2016/12/03 03:31:01
3903    B  F  A DISK        2016-12-03 03:39:14 1       1       YES        FULL 2016/12/03 03:31:01
3904    B  A  A DISK        2016-12-03 03:39:18 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01
3905    B  A  A DISK        2016-12-03 03:39:21 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01
3906    B  A  A DISK        2016-12-03 03:39:21 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01

--但是我执行如下恢复,提示缺少seq=15300的归档.
recover database until time '2016-12-03 03:39:20';
--我认为archivelog备份的完成时间是2016-12-03 03:39:21.应该可以.
--按照道理全备份完成后要切换一次日志,但是提示缺少一个seq=15300,为什么呢?

RMAN> list backupset 3903;
List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
3903    Full    2.02G      DISK        00:08:10     2016-12-03 03:39:14
        BP Key: 3903   Status: AVAILABLE  Compressed: YES  Tag: FULL 2016/12/03 03:31:01
        Piece Name: /mnt/tongji230.backup/fulls/tongji230_STATISTI_20161203_3913_full
  List of Datafiles in backup set 3903
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  4       Full 16940567563 2016-12-03 03:31:04 /u01/app/oracle/oradata/statisti/users01.dbf
  5       Full 16940567563 2016-12-03 03:31:04 /u01/app/oracle/oradata/statisti/statistics.dbf

--//可以看出全备份数据文件的完成时间在'2016-12-03 03:39:14'.

RMAN> list backupset  by file tag ='ARCHIVELOG 2016/12/03 03:31:01';
List of Archived Log Backups
============================

Thrd Seq     Low SCN    Low Time            BS Key  S #Pieces #Copies Compressed Tag
---- ------- ---------- ------------------- ------- - ------- ------- ---------- ---
1    15297   16933543374 2016-12-02 03:31:05 3906    A 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01
1    15298   16940500469 2016-12-02 22:00:32 3905    A 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01
1    15299   16940567740 2016-12-03 03:39:15 3904    A 1       1       YES        ARCHIVELOG 2016/12/03 03:31:01

--//seq=15299,Low Time='2016-12-03 03:39:15',可以想像这个是全备份完成后切换的归档日志.这个显示有1点点奇怪的是,仅仅显示Low SCN,Low Time.
--//并没有显示Next SCN,Next Time.换1个方式执行:

RMAN> list backupset 3904;
List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
3904    2.00K      DISK        00:00:02     2016-12-03 03:39:18
        BP Key: 3904   Status: AVAILABLE  Compressed: YES  Tag: ARCHIVELOG 2016/12/03 03:31:01
        Piece Name: /mnt/tongji230.backup/archives/tongji230_STATISTI_20161203_3920_archive

  List of Archived Logs in backup set 3904
  Thrd Seq     Low SCN    Low Time            Next SCN     Next Time
  ---- ------- ---------- ------------------- ------------ ---------
  1    15299   16940567740 2016-12-03 03:39:15 16940567745 2016-12-03 03:39:16

--从结果看备份seq=15299,Next Time=2016-12-03 03:39:16.所以讲恢复只能到'2016-12-03 03:39:16'时间.
--如果恢复'2016-12-03 03:39:20',自然需要seq=15300.

RMAN> recover database test until time '2016-12-03 03:39:16' ;

--我自己认为理解错误!!

--实际上seq=15297,15298的备份文件都很大,而seq=15299是最后切换出来的,归档文件很小,我开了3个通道,这样3个归档分别在不同的通道上备份,
--seq=15299的最先完成备份,而剩下的2个归档文件比较大,所以完成时间推后一点.
--另外我没有仔细看前面的key对应的归档备份.

BS Key=3904,对应的seq=15299.
BS Key=3905,对应的seq=15298.
BS Key=3906,对应的seq=15297.
--//正好反过来.理解错误啊.

RMAN> list backupset   tag ='ARCHIVELOG 2016/12/03 03:31:01' ;
List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
3904    2.00K      DISK        00:00:02     2016-12-03 03:39:18
        BP Key: 3904   Status: AVAILABLE  Compressed: YES  Tag: ARCHIVELOG 2016/12/03 03:31:01
        Piece Name: /mnt/tongji230.backup/archives/tongji230_STATISTI_20161203_3920_archive

  List of Archived Logs in backup set 3904
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    15299   16940567740 2016-12-03 03:39:15 16940567745 2016-12-03 03:39:16

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
3905    13.43M     DISK        00:00:05     2016-12-03 03:39:21
        BP Key: 3905   Status: AVAILABLE  Compressed: YES  Tag: ARCHIVELOG 2016/12/03 03:31:01
        Piece Name: /mnt/tongji230.backup/archives/tongji230_STATISTI_20161203_3919_archive

  List of Archived Logs in backup set 3905
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    15298   16940500469 2016-12-02 22:00:32 16940567740 2016-12-03 03:39:15

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
3906    15.79M     DISK        00:00:05     2016-12-03 03:39:21
        BP Key: 3906   Status: AVAILABLE  Compressed: YES  Tag: ARCHIVELOG 2016/12/03 03:31:01
        Piece Name: /mnt/tongji230.backup/archives/tongji230_STATISTI_20161203_3918_archive

  List of Archived Logs in backup set 3906
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    15297   16933543374 2016-12-02 03:31:05 16940500469 2016-12-02 22:00:32

上一篇:基于华为物联网云平台设计的智能家居控制系统(STM32+ESP8266)


下一篇:C语言-一维指针定义与使用