我的编程空间,编程开发者的网络收藏夹
学习永远不晚

DG归档丢失场景下如何重新同步physical standby

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

DG归档丢失场景下如何重新同步physical standby

这篇文章给大家介绍DG归档丢失场景下如何重新同步physical standby,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

一.场景描述

由于归档日志丢失,导致物理备库MRP进程无法与主库同步。

SQL> select thread#, max(sequence#) "Last Standby Seq Received"
  2   from v$archived_log val, v$database vdb
  3   where val.resetlogs_change# = vdb.resetlogs_change#
  4   group by thread# order by 1;

   THREAD# Last Standby Seq Received
---------- -------------------------
         1                      1121
         2                      1143

SQL> select thread#, max(sequence#) "Last Standby Seq Applied"
  2   from v$archived_log val, v$database vdb
  3   where val.resetlogs_change# = vdb.resetlogs_change#
  4   and val.applied in ('YES','IN-MEMORY')
  5   group by thread# order by 1;

   THREAD# Last Standby Seq Applied
---------- ------------------------
         1                      882
         2                      853

二.使用主库增量备份进行备库恢复

1.查询备库SCN

SQL> SELECT CURRENT_SCN FROM V$DATABASE;
SQL> select min(fhscn) from x$kcvfh;  --推荐

MIN(FHSCN)
----------------------------------------
41888422

2.只读表空间处理

如果存在只读表空间,则需要在主库执行下面命令:

SQL> alter tablespace xxx read write ;
SQL> alter tablespace xxx read only ;

3.根据备库SCN,在主库进行增量备份

RMAN> BACKUP INCREMENTAL FROM SCN 41888422 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY';

Starting backup at 2018-03-30 15:38:47
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 instance=racdb12c1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=+DGDATA1/RACDB12C/DATAFILE/ees_dat01.dbf
input datafile file number=00007 name=+DGDATA2/RACDB12C/DATAFILE/ees_idx01.dbf
input datafile file number=00002 name=+DGSYSTEM/RACDB12C/DATAFILE/sysaux.272.960743041
input datafile file number=00001 name=+DGSYSTEM/RACDB12C/DATAFILE/system.271.960743017
input datafile file number=00008 name=+DGDATA1/racdb12c/datafile/ees_idx02.dbf
input datafile file number=00009 name=+DGDATA1/racdb12c/datafile/ees_idx03.dbf
input datafile file number=00003 name=+DGSYSTEM/RACDB12C/DATAFILE/undotbs1.273.960743055
input datafile file number=00004 name=+DGSYSTEM/RACDB12C/DATAFILE/undotbs2.275.960743081
input datafile file number=00005 name=+DGSYSTEM/RACDB12C/DATAFILE/users.276.960743083
channel ORA_DISK_1: starting piece 1 at 2018-03-30 15:38:52
channel ORA_DISK_1: finished piece 1 at 2018-03-30 15:45:50
piece handle=/tmp/ForStandby_5fsv3e4b_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:06:58
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 2018-03-30 15:45:58
channel ORA_DISK_1: finished piece 1 at 2018-03-30 15:46:05
piece handle=/tmp/ForStandby_5gsv3ehf_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 2018-03-30 15:46:05

4.将备份文件copy至备库并注册

scp root@rac1:/tmp/ForStandby_5fsv3e4b_1_1 /tmp

scp root@rac1:/tmp/ForStandby_5gsv3ehf_1_1 /tmp

catalog backuppiece '/tmp/ForStandby_5fsv3e4b_1_1';
catalog backuppiece '/tmp/ForStandby_5gsv3ehf_1_1';

-确认

list backup
BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
12      Incr    1.96G      DISK        00:06:55     2018-03-30 15:45:46
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: FORSTANDBY
        Piece Name: /tmp/ForStandby_5fsv3e4b_1_1
  List of Datafiles in backup set 12
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafilesys/datafile/system.271.960743017
  2       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafilesys/datafile/sysaux.272.960743041
  3       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafilesys/datafile/undotbs1.273.960743055
  4       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafilesys/datafile/undotbs2.275.960743081
  5       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafilesys/datafile/users.276.960743083
  6       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafileuser/datafile/ees_dat01.dbf
  7       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafileuser/datafile/ees_idx01.dbf
  8       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafileuser/datafile/ees_idx02.dbf
  9       Incr 52145113   2018-03-30 15:38:52              NO    /oradata/racdb12cdg/datafileuser/datafile/ees_idx03.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
13      Incr    46.50M     DISK        00:00:08     2018-03-30 15:45:59
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: FORSTANDBY
        Piece Name: /tmp/ForStandby_5gsv3ehf_1_1
  Control File Included: Ckp SCN: 52146933     Ckp time: 2018-03-30 15:45:51

5.恢复备库controlfile

(1).启动备库至nomount状态

startup nomount

(2).备份备库控制文件

cp /oradata/control_file/control01.ctl /oradata/control_file/control01.ctl.bak

(3).恢复控制文件

restore standby controlfile  to '/oradata/control_file/control01.ctl' from '/tmp/ForStandby_5gsv3ehf_1_1';

(4).查看恢复控制文件内容

alter database backup controlfile to trace ;

* 由于控制文件是从主库恢复过来的,因此需要确认相关文件的文件名是否一致,相关命令:

SELECT a.FILE#, a.NAME,a.CHECKPOINT_CHANGE#,a.LAST_CHANGE#,status FROM v$datafile a;
alter system set standby_file_management=manual;
alter database rename file 'file_name' to 'file_name';

6.在备库应用增量备份

RMAN> RECOVER DATABASE NOREDO;

Starting recover at 2018-03-30 16:00:23
 using target database control file instead of recovery catalog
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=22 device type=DISK
 channel ORA_DISK_1: starting incremental datafile backup set restore
 channel ORA_DISK_1: specifying datafile(s) to restore from backup set
 destination for restore of datafile 00001: /oradata/racdb12cdg/datafilesys/datafile/system.271.960743017
 destination for restore of datafile 00002: /oradata/racdb12cdg/datafilesys/datafile/sysaux.272.960743041
 destination for restore of datafile 00003: /oradata/racdb12cdg/datafilesys/datafile/undotbs1.273.960743055
 destination for restore of datafile 00004: /oradata/racdb12cdg/datafilesys/datafile/undotbs2.275.960743081
 destination for restore of datafile 00005: /oradata/racdb12cdg/datafilesys/datafile/users.276.960743083
 destination for restore of datafile 00006: /oradata/racdb12cdg/datafileuser/datafile/ees_dat01.dbf
 destination for restore of datafile 00007: /oradata/racdb12cdg/datafileuser/datafile/ees_idx01.dbf
 destination for restore of datafile 00008: /oradata/racdb12cdg/datafileuser/datafile/ees_idx02.dbf
 destination for restore of datafile 00009: /oradata/racdb12cdg/datafileuser/datafile/ees_idx03.dbf
 channel ORA_DISK_1: reading from backup piece /tmp/ForStandby_5fsv3e4b_1_1
 channel ORA_DISK_1: piece handle=/tmp/ForStandby_5fsv3e4b_1_1 tag=FORSTANDBY
 channel ORA_DISK_1: restored backup piece 1
 channel ORA_DISK_1: restore complete, elapsed time: 00:00:55

Finished recover at 2018-03-30 16:01:21

7.确认

确认主备库SCN,并开启MRP进程,如果成功继续同步,则任务完成。

关于DG归档丢失场景下如何重新同步physical standby就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

DG归档丢失场景下如何重新同步physical standby

下载Word文档到电脑,方便收藏和打印~

下载Word文档

编程热搜

目录