dataguard gap处理,通过rman增量恢复

【摘要】 1,故障现象Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSIONTue Jan 18 10:24:45 2022FAL[client]: Failed to request gap sequence GAP - SCN range: 0x0931.ec587602 - 0x0931...

1,故障现象

Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION
Tue Jan 18 10:24:45 2022
FAL[client]: Failed to request gap sequence
 GAP - SCN range: 0x0931.ec587602 - 0x0931.ec587602
 DBID 639780530 branch 1000850613
FAL[client]: All defined FAL servers have been attempted.
------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that's sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
------------------------------------------------------------

2,处理方法

2.1查询备库scn

col CURRENT_SCN format 99999999999999;
SELECT CURRENT_SCN FROM V$DATABASE;
  CURRENT_SCN
---------------
 10110023267841

SQL> col min(checkpoint_change#) format 99999999999999;
SQL> select min(checkpoint_change#) from v$datafile_header
  2  where file# not in (select file# from v$datafile where enabled = 'READ ONLY');
MIN(CHECKPOINT_CHANGE#)
-----------------------
         10110023275988

2.2 主数据库执行增量备份

RMAN> BACKUP INCREMENTAL FROM SCN 10110023275988 DATABASE FORMAT '/u01/app/oracle/bak/bak_%U' tag 'FORSTANDBY';

Starting backup at 2022-01-18 10:31:50
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 instance=nongxian2 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=00004 name=+DATA/nongxian/datafile/users.437.1000850541
input datafile file number=00006 name=+DATA/nongxian/datafile/agri_tb01.dbf
input datafile file number=00007 name=+DATA/nongxian/datafile/txnlist_tb01.dbf
input datafile file number=00008 name=+DATA/nongxian/datafile/nyplat_tb01.dbf
input datafile file number=00009 name=+DATA/nongxian/datafile/txnlist_tb02.dbf
input datafile file number=00003 name=+DATA/nongxian/datafile/undotbs1.678.1000850541
input datafile file number=00005 name=+DATA/nongxian/datafile/undotbs2.806.1000850677
input datafile file number=00002 name=+DATA/nongxian/datafile/sysaux.697.1000850541
input datafile file number=00001 name=+DATA/nongxian/datafile/system.683.1000850541
channel ORA_DISK_1: starting piece 1 at 2022-01-18 10:31:51
channel ORA_DISK_1: finished piece 1 at 2022-01-18 10:38:26
piece handle=/u01/app/oracle/bak/bak_hq0jj6cn_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:06:35
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 2022-01-18 10:38:27
channel ORA_DISK_1: finished piece 1 at 2022-01-18 10:38:28
piece handle=/u01/app/oracle/bak/bak_hr0jj6p2_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-01-18 10:38:28

RMAN> exit

2.3传输增量备份到备机

$ scp * 10.4.1.32:/nxarchive/bak

2.4备注册增量备份文件,并执行恢复

$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jan 18 11:15:58 2022

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: NONGXIAN (DBID=639780530, not open)
RMAN> catalog start with '/nxarchive/bak';

using target database control file instead of recovery catalog
searching for all files that match the pattern /nxarchive/bak

List of Files Unknown to the Database
=====================================
File Name: /nxarchive/bak/bak_hq0jj6cn_1_1
File Name: /nxarchive/bak/bak_hr0jj6p2_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /nxarchive/bak/bak_hq0jj6cn_1_1
File Name: /nxarchive/bak/bak_hr0jj6p2_1_1

RMAN> recover database;

Starting recover at 18-JAN-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=3698 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: /nxdata/system.683.1000850541
destination for restore of datafile 00002: /nxdata/sysaux.697.1000850541
destination for restore of datafile 00003: /nxdata/undotbs1.678.1000850541
destination for restore of datafile 00004: /nxdata/users.437.1000850541
destination for restore of datafile 00005: /nxdata/undotbs2.806.1000850677
destination for restore of datafile 00006: /nxdata/agri_tb01.dbf
destination for restore of datafile 00007: /nxdata/txnlist_tb01.dbf
destination for restore of datafile 00008: /nxdata/nyplat_tb01.dbf
destination for restore of datafile 00009: /nxdata/txnlist_tb02.dbf
channel ORA_DISK_1: reading from backup piece /nxarchive/bak/bak_hq0jj6cn_1_1
channel ORA_DISK_1: piece handle=/nxarchive/bak/bak_hq0jj6cn_1_1 tag=FORSTANDBY
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

starting media recovery

archived log for thread 1 with sequence 29577 is already on disk as file /nxarchive/1_29577_1000850613.dbf
archived log for thread 1 with sequence 29606 is already on disk as file /nxarchive/1_29606_1000850613.dbf
archived log for thread 1 with sequence 29614 is already on disk as file /nxarchive/1_29614_1000850613.dbf
archived log for thread 1 with sequence 29615 is already on disk as file /nxarchive/1_29615_1000850613.dbf
archived log for thread 1 with sequence 29616 is already on disk as file /nxarchive/1_29616_1000850613.dbf
archived log for thread 1 with sequence 29617 is already on disk as file /nxarchive/1_29617_1000850613.dbf
archived log for thread 1 with sequence 29618 is already on disk as file /nxarchive/1_29618_1000850613.dbf
archived log for thread 2 with sequence 27594 is already on disk as file /nxarchive/2_27594_1000850613.dbf
archived log for thread 2 with sequence 27617 is already on disk as file /nxarchive/2_27617_1000850613.dbf
archived log for thread 2 with sequence 27619 is already on disk as file /nxarchive/2_27619_1000850613.dbf
archived log for thread 2 with sequence 27620 is already on disk as file /nxarchive/2_27620_1000850613.dbf
unable to find archived log
archived log thread=1 sequence=0
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/18/2022 11:16:56
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 0 and starting SCN of 10110023267842

RMAN> exit

2.5恢复备控制文件

RMAN> RESTORE STANDBY CONTROLFILE FROM '/nxarchive/bak/bak_hr0jj6p2_1_1';

Starting restore at 18-JAN-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1058 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/nxdata/current.ctl
Finished restore at 18-JAN-22

2.6启动日志应用,并检查同步状态

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 18 11:17:50 2022

Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> 
SQL> SQL> SQL> SQL> --延时查询(备);
SQL> SET LINESIZE 500;
SQL> col value format a20;
SQL> select * from v$dataguard_stats;

NAME                             VALUE                UNIT                           TIME_COMPUTED                  DATUM_TIME
-------------------------------- -------------------- ------------------------------ ------------------------------ ------------------------------
transport lag                    +00 00:12:16         day(2) to second(0) interval   01/18/2022 11:39:13            01/18/2022 11:38:44
apply lag                        +00 00:12:16         day(2) to second(0) interval   01/18/2022 11:39:13            01/18/2022 11:38:44
apply finish time                                     day(2) to second(3) interval   01/18/2022 11:39:13
estimated startup time           13                   second                         01/18/2022 11:39:13

本文为华为云社区用户原创内容,转载于链接:https://bbs.huaweicloud.com/blogs/327386,转载请备注转载处。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值