成都网站建设设计

将想法与焦点和您一起共享

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

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

创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、成都网站建设、宜城网络推广、微信平台小程序开发、宜城网络营销、宜城企业策划、宜城品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联建站为所有大学生创业者提供宜城建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com

一.场景描述

由于归档日志丢失,导致物理备库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就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


分享标题:DG归档丢失场景下如何重新同步physicalstandby
本文链接:http://chengdu.cdxwcx.cn/article/jsiseo.html