dataguard gap

1,错误日志

1Completed: 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.

------------------------------------------------------------

https://blogs.oracle.com/database4cn/post/rmandataguardstandby

2,查询数据库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

3,增量备份

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

4,传输备份到备

$ scp * 10.4.1.32:/nxarchive/bak

---------------

10110023267841

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#)

-----------------------

            1.0110E+13

SQL> col min(checkpoint_change#) format 99999999999999;

SQL> /

MIN(CHECKPOINT_CHANGE#)

-----------------------

        10110023275988

SQL>  

SQL>  

SQL>  

SQL>  

SQL>  

SQL>  

5,数据库恢复

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;    

Database altered.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

$ 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

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

6,恢复控制文件

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

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

7,状态检查

##alter system archive log current

select unique thread# as thread,max(sequence#) over(partition by thread#) as last from gv$archived_log where applied='YES'

/

上一篇:企业官网丨网站建设如何挑选云服务器?


下一篇:SLS机器学习最佳实战:时序预测