Oracle 19C DataGuard GAP 修复过程(RECOVER STANDBY DATABASE FROM SERVICE)

1. 介绍

DG GAP 顾名思义就是:DG不同步,当备库不能接受到一个或多个主库的归档日志文件时候,就发生了 GAP。

那么,如果遇到GAP如何修复呢?

DG GAP 主要分为以下两类情况:

  • 主库归档日志存在,可以通过配置 Fetch Archive Log(FAL) 参数,自动解决归档 GAP;
  • 主库归档日志丢失,需要 人工干预 来修复;

不同 Oracle 版本的 GAP 修复方式也不尽相同,下面分别介绍不同版本的方式!

11G 的处理步骤:

  • 在主库上创建一个备库的控制文件
  • 以备库的当前SCN号为起点,在主库上做一个增量备份
  • 将增量备份拷贝到备库上
  • 使用新的控制文件将备库启动到mount状态
  • 将增量备份注册到RMAN的catalog,取消备库的恢复应用,恢复增量备份
  • 开启备库的恢复进程

12C 的新特性(RECOVER … FROM SERVICE)

  • 备库启动到nomount状态
  • 从主库恢复控制文件到备库(RMAN> restore standby controlfile from service hfdb)
  • 备库启动到mount状态
  • 恢复GAP(RMAN> recover database from service hfdb noredo using compressed backupset;)
  • 启动备库
  • 开启备库的恢复进程

19C 的新特性(RECOVER STANDBY DATABASE FROM SERVICE)

Oracle随着版本的升级,逐渐将步骤缩减,进行封装,19C 之后可谓是达到了所谓的一键刷新,恢复DG同步。

19C 新特性是在 12C 的基础上,将 RECOVER STANDBY DATABASE 命令与 FROM SERVICE 子句一起使用,以通过对主数据库进行的更改来刷新物理备用数据库。备库可以直接在开启状态进行刷新。

RMAN> recover standby database from service hfdb;

1.1. 19C 新特性恢复

1.2. 环境准备

以下为测试环境信息:

角色

主机名

IP地址

数据库版本

实例名

DB名

DB_UNIQUE名

services名

TNS名

sys密码

主(RAC)

hfdb30

hfdb31

192.168.40.30

192.18.40.31

19C

hfdb1

hfdb2

hfdb

hfdb

hfdb

hfdb

oracle

备(FS)

dghfdb

192.168.40.40

19C

dghfdb

dghfdb

dghfdb

dghfdb

dghfdb

oracle

1.3. 模拟 GAP 发生

首先,模拟备库断电,主库切几个最新的归档,然后手工删掉,重新开启DG同步。

备库停止 DG 同步进程:

#停止监听
[oracle@hfdb40:/home/oracle]$lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-DEC-2024 20:47:05

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hfdb40)(PORT=1521)))
The command completed successfully

#关闭同步进程,关库
[oracle@hfdb40:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 3 20:50:07 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

#停止备份同步进程
SYS@dghfdb> alter database recover managed standby database cancel;

Database altered.

SYS@dghfdb> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@dghfdb>

主库切换多次归档:

SYS@hfdb1> alter system switch logfile;

System altered.

SYS@hfdb1> /

System altered.

SYS@hfdb1> alter system archive log current;

System altered.

SYS@hfdb1> /

System altered.

SYS@hfdb1> exit


SYS@hfdb1> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     43
Next log sequence to archive   44
Current log sequence           44

SYS@hfdb2> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     20
Next log sequence to archive   21
Current log sequence           21

主库删除最近几个归档日志:

ASMCMD> cd /dgrecovery1/HFDB/archivelog/2024_12_04
ASMCMD> ls
thread_1_seq_47.273.1186824837
thread_1_seq_48.276.1186824981
thread_1_seq_49.277.1186825157
thread_1_seq_50.280.1186825307
thread_1_seq_51.281.1186825341
thread_1_seq_52.282.1186827257
thread_1_seq_53.287.1186827601
thread_1_seq_54.272.1186828891
thread_1_seq_55.268.1186829053
thread_1_seq_56.263.1186829059
thread_1_seq_57.260.1186831373
thread_1_seq_58.271.1186831469
thread_1_seq_59.270.1186831519
thread_1_seq_60.267.1186832065
thread_1_seq_61.289.1186837369
thread_1_seq_62.291.1186837385
thread_1_seq_63.292.1186837389
thread_1_seq_65.295.1186837709
thread_1_seq_66.294.1186837715
thread_1_seq_67.297.1186838001
thread_1_seq_68.298.1186839209
thread_1_seq_70.302.1186839233
thread_1_seq_71.304.1186839237
thread_1_seq_72.307.1186839241
thread_1_seq_73.301.1186839415
thread_1_seq_74.300.1186839427
thread_1_seq_75.309.1186845151
thread_1_seq_76.311.1186845161
thread_1_seq_77.312.1186845163
thread_1_seq_78.314.1186845169
thread_2_seq_23.274.1186824841
thread_2_seq_24.275.1186824981
thread_2_seq_25.278.1186825159
thread_2_seq_26.279.1186825303
thread_2_seq_27.283.1186827263
thread_2_seq_28.284.1186827263
thread_2_seq_29.285.1186827337
thread_2_seq_30.286.1186827601
thread_2_seq_31.269.1186828893
thread_2_seq_32.265.1186829053
thread_2_seq_33.258.1186829059
thread_2_seq_34.261.1186831371
thread_2_seq_35.259.1186831467
thread_2_seq_36.266.1186832065
thread_2_seq_37.290.1186837385
thread_2_seq_38.293.1186837393
thread_2_seq_40.296.1186837715
thread_2_seq_41.299.1186839209
thread_2_seq_43.303.1186839233
thread_2_seq_44.305.1186839237
thread_2_seq_45.306.1186839239
thread_2_seq_46.308.1186839429
thread_2_seq_47.310.1186845159
thread_2_seq_48.313.1186845165
thread_2_seq_49.315.1186845171
ASMCMD> rm -rf thread_1_seq_76.311.1186845161
ASMCMD> rm -rf thread_2_seq_48.313.1186845165

备库开启同步进程:

[oracle@hfdb40:/home/oracle]$lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-DEC-2024 21:29:03

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /oracle/app/oracle/product/19c/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /oracle/app/oracle/product/19c/db_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/diag/tnslsnr/hfdb40/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hfdb40)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hfdb40)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                03-DEC-2024 21:29:03
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/hfdb40/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hfdb40)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "dghfdb" has 1 instance(s).
  Instance "dghfdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@hfdb40:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 3 21:29:15 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@dghfdb> startup
ORACLE instance started.

Total System Global Area 3355440576 bytes
Fixed Size                  8902080 bytes
Variable Size             671088640 bytes
Database Buffers         2667577344 bytes
Redo Buffers                7872512 bytes
Database mounted.
Database opened.
SYS@dghfdb> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SYS@dghfdb> alter system register;

System altered.

主库刷新 DEST 状态:

-- 主库上面
SYS@hfdb1> alter system set log_archive_dest_state_2=defer;

System altered.

SYS@hfdb1> alter system set log_archive_dest_state_2=enable;

System altered.

SYS@hfdb1> alter system switch logfile;

System altered.

SYS@hfdb1> alter system archive log current;

System altered.

SYS@hfdb1>

查看同步情况,是否存在 GAP:

-- 主库上面
set line1000
col status for a10
col type for a10
col error for a20
col gap_status for a20
col synchronization_status for a30
col recovery_mode for a30
select inst_id,status,DEST_ID,TYPE,ERROR,GAP_STATUS,SYNCHRONIZED,SYNCHRONIZATION_STATUS,RECOVERY_MODE from GV$ARCHIVE_DEST_STATUS where STatus <> 'INACTIVE' and type = 'PHYSICAL';
-- 显示 UNRESOLVABLE GAP,意味着无法自行修复,需要人工干预
   INST_ID STATUS        DEST_ID TYPE       ERROR                GAP_STATUS           SYNCHRONI SYNCHRONIZATION_STATUS         RECOVERY_MODE
---------- ---------- ---------- ---------- -------------------- -------------------- --------- ------------------------------ ------------------------------
         1 VALID               2 PHYSICAL                        UNRESOLVABLE GAP     NO        CHECK CONFIGURATION            MANAGED REAL TIME APPLY WITH Q                                                                                                                  UERY

         2 VALID               2 PHYSICAL                        UNRESOLVABLE GAP     NO        CHECK CONFIGURATION            MANAGED REAL TIME APPLY WITH Q

                                                                                                                             UERY
SYS@hfdb1> alter system checkpoint;
SYS@hfdb1> col CURRENT_SCN for 999999999999999999
SYS@hfdb1> select current_scn from v$database;

CURRENT_SCN
-----------
    2081735
            
SYS@hfdb2> alter system checkpoint;         
SYS@hfdb2> col CURRENT_SCN for 999999999999999999
SYS@hfdb2> select current_scn from v$database;

CURRENT_SCN
-----------
    2081804


--
SYS@dghfdb> col group# for a20
SYS@dghfdb> set line 1000
SYS@dghfdb> select process,thread#,group#,sequence#,status from gv$managed_standby;

PROCESS                        THREAD# GROUP#                          SEQUENCE# STATUS
--------------------------- ---------- ------------------------------ ---------- ------------------------------------
RFS                                  1 N/A                                     0 IDLE
RFS                                  2 N/A                                     0 IDLE
DGRD                                 0 N/A                                     0 ALLOCATED
ARCH                                 2 14                                     50 CLOSING
DGRD                                 0 N/A                                     0 ALLOCATED
ARCH                                 1 11                                     79 CLOSING
ARCH                                 2 13                                     47 CLOSING
ARCH                                 1 10                                     75 CLOSING
RFS                                  1 2                                      80 IDLE
RFS                                  2 3                                      51 IDLE
RFS                                  0 N/A                                     0 IDLE

PROCESS                        THREAD# GROUP#                          SEQUENCE# STATUS
--------------------------- ---------- ------------------------------ ---------- ------------------------------------
RFS                                  0 N/A                                     0 IDLE
RFS                                  0 N/A                                     0 IDLE
RFS                                  0 N/A                                     0 IDLE
RFS                                  0 N/A                                     0 IDLE
MRP0                                 1 N/A                                    76 WAIT_FOR_GAP

SYS@dghfdb> select count(*) from gv$archived_log where applied='NO';

  COUNT(*)
----------
         6

         7
SYS@dghfdb> select * from v$archive_gap;

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#     CON_ID
---------- ------------- -------------- ----------
         1            76             76          1
         2            48             48          1

SYS@dghfdb>


SYS@dghfdb> select current_scn from v$database;

CURRENT_SCN
-----------
    2080626

-- 主库模拟在恢复过程中新增了数据文件

SYS@hfdb1> select * from v$tablespace;

       TS# NAME                                                                                       INCLUDED_ BIGFILE   FLASHBACK ENCRYPT_I     CON_ID
---------- ------------------------------------------------------------------------------------------ --------- --------- --------- --------- ----------
         0 SYSTEM                                                                                     YES       NO        YES                          0
         1 SYSAUX                                                                                     YES       NO        YES                          0
         2 UNDOTBS1                                                                                   YES       NO        YES                          0
         3 TEMP                                                                                       NO        NO        YES                          0
         4 UNDOTBS2                                                                                   YES       NO        YES                          0
         5 USERS                                                                                      YES       NO        YES                          0
         6 HFDB1                                                                                      YES       NO        YES                          0
         7 OGG_TBS                                                                                    YES       NO        YES                          0

8 rows selected.

SYS@hfdb1> alter tablespace HFDB1 add datafile size 1M autoextend off;

Tablespace altered.

SYS@hfdb1> select current_scn from v$database;

CURRENT_SCN
-----------
    2082960



SYS@hfdb1> select FILE#,name from v$datafile where CREATION_CHANGE#>2080626;

     FILE# NAME
---------- --------------------------------------------------
         8 +DGSYSTEM1/HFDB/DATAFILE/hfdb1.287.1186845893



当前 ADG 已存在 GAP,并且 GAP 期间主库没有增加数据文件,缺少日志号为 48,76 即是前面模拟断电删除的归档日志文件,已经确认无法找回,需要人工干预进行修复。

1.4. 19C 新特性修复

备库取消日志应用:

SYS@dghfdb> alter database recover managed standby database cancel;

Database altered.

备库执行修复命令,开始在线刷新备库:

[oracle@hfdb40:/home/oracle]$rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Dec 4 16:02:16 2024
Version 19.3.0.0.0

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

connected to target database: HFDB (DBID=779754523)

RMAN> recover standby database from service hfdb;

Starting recover at 2024-12-04 16:02:25
using target database control file instead of recovery catalog
Oracle instance started

Total System Global Area    3355440576 bytes

Fixed Size                     8902080 bytes
Variable Size                671088640 bytes
Database Buffers            2667577344 bytes
Redo Buffers                   7872512 bytes

contents of Memory Script:
{
   restore standby controlfile from service  'hfdb';
   alter database mount standby database;
}
executing Memory Script

Starting restore at 2024-12-04 16:02:41
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output file name=/oradata/dghfdb/control01.ctl
output file name=/oradata/dghfdb/control02.ctl
Finished restore at 2024-12-04 16:02:49

released channel: ORA_DISK_1
Statement processed
Executing: alter system set standby_file_management=manual

contents of Memory Script:
{
set newname for datafile  8 to
 "/oradata/dghfdb/datafile/hfdb1.287.1186845893";
   restore from service  'hfdb' datafile
    8;
   catalog datafilecopy  "/oradata/dghfdb/datafile/hfdb1.287.1186845893";
   switch datafile all;
}
executing Memory Script

executing command: SET NEWNAME

Starting restore at 2024-12-04 16:02:55
Starting implicit crosscheck backup at 2024-12-04 16:02:55
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2281 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 2024-12-04 16:02:55

Starting implicit crosscheck copy at 2024-12-04 16:02:55
using channel ORA_DISK_1
Finished implicit crosscheck copy at 2024-12-04 16:02:55

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_23_mmp2085b_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_12_mmp225ps_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_24_mmp260l0_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_25_mmp2870t_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_13_mmp287fl_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_14_mmp2bol2_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_26_mmp2boys_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_27_mmp2j5wg_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_28_mmp3bj5s_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_15_mmp3bkow_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_16_mmp3dbcx_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_29_mmp3h4lv_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_17_mmp3hd01_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_30_mmp49jyf_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_18_mmp5pncz_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_19_mmp5po6j_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_20_mmp5py9b_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_31_mmp5qh3w_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_21_mmp5qhxb_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_32_mmp6cksb_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_2_22_mmp6cn1o_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_33_mmp6pc6l_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_34_mmp6phb3_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_35_mmp72b8k_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_36_mmp72f40_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_37_mmpcyw98_.arc
File Name: /archive/DGHFDB/archivelog/2024_11_18/o1_mf_1_38_mmpfwjb8_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_34_mnzlrdcr_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_57_mnzlrfb3_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_35_mnzlvd06_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_58_mnzlvdyc_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_59_mnzlwz7l_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_60_mnzmg136_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_36_mnzmg1q2_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_61_mnzrms9j_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_37_mnzrn94b_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_62_mnzrnb91_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_63_mnzrndns_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_38_mnzrnl52_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_39_mnzrno7p_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_64_mnzrnoln_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_65_mnzryf3w_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_66_mnzrym3q_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_40_mnzrymgs_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_67_mnzs7l8s_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_70_mnztkodc_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_71_mnztkofj_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_44_mnztkog8_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_43_mnztkokg_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_41_mnztkoq2_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_45_mnztkotq_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_68_mnztkowd_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_72_mnztkp31_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_73_mnztmr8y_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_74_mnztn4j5_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_46_mnztn5o4_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_49_mo00folx_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_77_mo00foo8_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_78_mo00fot5_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_47_mo00fpgb_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_75_mo00fpj4_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_50_mo00h1bv_.arc
File Name: /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_79_mo00h1rz_.arc
File Name: /archive/DGHFDB/autobackup/2024_11_19/o1_mf_s_1185450609_mmr2qm0g_.bkp
File Name: /archive/DGHFDB/autobackup/2024_11_19/o1_mf_s_1185453704_mmr6clwq_.bkp

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00008 to /oradata/dghfdb/datafile/hfdb1.287.1186845893
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2024-12-04 16:03:00

cataloged datafile copy
datafile copy file name=/oradata/dghfdb/datafile/hfdb1.287.1186845893 RECID=1 STAMP=1186848181

datafile 8 switched to datafile copy
input datafile copy RECID=1 STAMP=1186848181 file name=/oradata/dghfdb/datafile/hfdb1.287.1186845893

contents of Memory Script:
{
  recover database from service  'hfdb';
}
executing Memory Script

Starting recover at 2024-12-04 16:03:01
using channel ORA_DISK_1
skipping datafile 8; already restored to SCN 2091027
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00001: /oradata/dghfdb/datafile/system.261.1185439411
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00002: /oradata/dghfdb/datafile/sysaux.266.1185439449
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00003: /oradata/dghfdb/datafile/undotbs1.260.1185439475
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00004: /oradata/dghfdb/datafile/undotbs2.258.1185439511
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00005: /oradata/dghfdb/datafile/users.276.1185439523
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00006: /oradata/dghfdb/datafile/hfdb1.257.1185443509
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service hfdb
destination for restore of datafile 00007: /oradata/dghfdb/datafile/ogg_tbs.286.1185478503
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

starting media recovery

media recovery complete, elapsed time: 00:00:00
Finished recover at 2024-12-04 16:03:36
Executing: alter system set standby_file_management=auto
Finished recover at 2024-12-04 16:03:37

RMAN>

方便大家查看,于是记录恢复全过程,通过以上执行过程,可以看到:

  • RECOVER STANDBY DATABASE 命令重新启动备用实例。
  • 从主数据库刷新控制文件,并自动重命名数据文件,临时文件和联机日志。
  • 它可以还原添加到主数据库中的新数据文件,并还原到当前时间的备用数据库。
2024-12-04T15:16:02.831085+08:00
 rfs (PID:26264): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T15:16:02.854393+08:00
 rfs (PID:26262): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T15:16:02.966153+08:00
 rfs (PID:26264): Selected LNO:11 for T-1.S-79 dbid 779754523 branch 1185439387
2024-12-04T15:16:03.050660+08:00
 rfs (PID:26262): Selected LNO:14 for T-2.S-50 dbid 779754523 branch 1185439387
2024-12-04T15:16:03.270354+08:00
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
alter database recover managed standby database using current logfile disconnect from session
2024-12-04T15:16:03.287601+08:00
Attempt to start background Managed Standby Recovery process (dghfdb)
Starting background process MRP0
2024-12-04T15:16:03.323022+08:00
MRP0 started with pid=55, OS id=26266 
2024-12-04T15:16:03.325656+08:00
Background Managed Standby Recovery process started (dghfdb)
2024-12-04T15:16:04.766251+08:00
Deleted Oracle managed file /archive/DGHFDB/archivelog/2024_12_04/o1_mf_0_0_mo00fnpm_.arc
2024-12-04T15:16:04.806775+08:00
Deleted Oracle managed file /archive/DGHFDB/archivelog/2024_12_04/o1_mf_0_0_mo00fnqx_.arc
2024-12-04T15:16:05.603459+08:00
 rfs (PID:26282): Selected LNO:13 for T-2.S-47 dbid 779754523 branch 1185439387
2024-12-04T15:16:05.613676+08:00
 rfs (PID:26280): Opened log for T-2.S-49 dbid 779754523 branch 1185439387
2024-12-04T15:16:05.679592+08:00
 rfs (PID:26286): Selected LNO:10 for T-1.S-75 dbid 779754523 branch 1185439387
2024-12-04T15:16:05.702251+08:00
 rfs (PID:26284): Opened log for T-1.S-77 dbid 779754523 branch 1185439387
2024-12-04T15:16:05.846988+08:00
 rfs (PID:26288): Opened log for T-1.S-78 dbid 779754523 branch 1185439387
2024-12-04T15:16:06.104246+08:00
 rfs (PID:26280): Archived Log entry 30 added for B-1185439387.T-2.S-49 ID 0x2e7abbb2 LAD:2
2024-12-04T15:16:06.243474+08:00
 rfs (PID:26284): Archived Log entry 31 added for B-1185439387.T-1.S-77 ID 0x2e7abbb2 LAD:2
2024-12-04T15:16:06.356841+08:00
 rfs (PID:26288): Archived Log entry 32 added for B-1185439387.T-1.S-78 ID 0x2e7abbb2 LAD:2
2024-12-04T15:16:08.060389+08:00
ARC2 (PID:26226): Archived Log entry 33 added for T-2.S-47 ID 0x2e7abbb2 LAD:1
2024-12-04T15:16:08.235036+08:00
ARC3 (PID:26228): Archived Log entry 34 added for T-1.S-75 ID 0x2e7abbb2 LAD:1
2024-12-04T15:16:08.352985+08:00
 Started logmerger process
2024-12-04T15:16:08.367172+08:00

IM on ADG: Start of Empty Journal 

IM on ADG: End of Empty Journal 
PR00 (PID:26294): Managed Standby Recovery starting Real Time Apply
2024-12-04T15:16:08.655475+08:00
Parallel Media Recovery started with 4 slaves
2024-12-04T15:16:08.792800+08:00
stopping change tracking
2024-12-04T15:16:09.199992+08:00
PR00 (PID:26294): Media Recovery Log /archive/DGHFDB/archivelog/2024_12_04/o1_mf_2_47_mo00fpgb_.arc
2024-12-04T15:16:09.333761+08:00
Completed: alter database recover managed standby database using current logfile disconnect from session
2024-12-04T15:16:09.391548+08:00
PR00 (PID:26294): Media Recovery Log /archive/DGHFDB/archivelog/2024_12_04/o1_mf_1_75_mo00fpj4_.arc
PR00 (PID:26294): Media Recovery Waiting for T-1.S-76
PR00 (PID:26294): Fetching gap from T-1.S-76 to T-1.S-76
2024-12-04T15:16:49.441462+08:00
ARC0 (PID:26220): Archived Log entry 35 added for T-2.S-50 ID 0x2e7abbb2 LAD:1
2024-12-04T15:16:49.558326+08:00
 rfs (PID:26353): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T15:16:49.676861+08:00
 rfs (PID:26353): Selected LNO:13 for T-2.S-51 dbid 779754523 branch 1185439387
2024-12-04T15:16:49.829986+08:00
ARC1 (PID:26224): Archived Log entry 36 added for T-1.S-79 ID 0x2e7abbb2 LAD:1
2024-12-04T15:16:49.890826+08:00
 rfs (PID:26355): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T15:16:50.007854+08:00
 rfs (PID:26355): Selected LNO:10 for T-1.S-80 dbid 779754523 branch 1185439387
2024-12-04T15:18:55.044228+08:00
PR00 (PID:26294): FAL: Failed to request gap sequence
PR00 (PID:26294):  GAP - thread 1 sequence 76-76
PR00 (PID:26294):  DBID 779754523 branch 1185439387
PR00 (PID:26294): FAL: All defined FAL servers have been attempted
PR00 (PID:26294): -------------------------------------------------------------------------
PR00 (PID:26294): Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
PR00 (PID:26294): parameter is defined to a value that s sufficiently large
PR00 (PID:26294): enough to maintain adequate log switch information to resolve
PR00 (PID:26294): archived redo log gaps.
PR00 (PID:26294): -------------------------------------------------------------------------
2024-12-04T15:31:00.724373+08:00
PL/SQL package SYS.DBMS_RCVMAN version 19.07.00.00 is too new
Oracle must be upgraded to version 08.00.04.00 to work with this package
2024-12-04T15:46:02.613128+08:00
PL/SQL package SYS.DBMS_RCVMAN version 19.07.00.00 is too new
Oracle must be upgraded to version 08.00.04.00 to work with this package
2024-12-04T16:00:18.292668+08:00
alter database recover managed standby database cancel
2024-12-04T16:00:18.299368+08:00
PR00 (PID:26294): MRP0: Background Media Recovery cancelled with status 16037
2024-12-04T16:00:18.299934+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_pr00_26294.trc:
ORA-16037: user requested cancel of managed recovery operation
PR00 (PID:26294): Managed Standby Recovery not using Real Time Apply
Recovery interrupted!
stopping change tracking
2024-12-04T16:00:18.589558+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_pr00_26294.trc:
ORA-16037: user requested cancel of managed recovery operation
2024-12-04T16:00:18.735464+08:00
Background Media Recovery process shutdown (dghfdb)
2024-12-04T16:00:19.300031+08:00
Managed Standby Recovery Canceled (dghfdb)
Completed: alter database recover managed standby database cancel
2024-12-04T16:01:04.501986+08:00
PL/SQL package SYS.DBMS_RCVMAN version 19.07.00.00 is too new
Oracle must be upgraded to version 08.00.04.00 to work with this package
2024-12-04T16:02:28.480672+08:00
License high water mark = 16
2024-12-04T16:02:28.481872+08:00
USER(prelim) (ospid: 29571): terminating the instance
2024-12-04T16:02:29.489218+08:00
Instance terminated by USER(prelim), pid = 29571
2024-12-04T16:02:33.019486+08:00
Starting ORACLE instance (normal) (OS id: 29576)
2024-12-04T16:02:33.032595+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA 
 ****************************************************
2024-12-04T16:02:33.035287+08:00
**********************************************************************
2024-12-04T16:02:33.035439+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA) 

2024-12-04T16:02:33.035828+08:00
 Per process system memlock (soft) limit = 7813M
2024-12-04T16:02:33.035970+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 3202M
2024-12-04T16:02:33.036305+08:00
 Available system pagesizes:
  4K, 2048K 
2024-12-04T16:02:33.036704+08:00
 Supported system pagesize(s):
2024-12-04T16:02:33.036851+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2024-12-04T16:02:33.036991+08:00
        4K       Configured               5               5        NONE
2024-12-04T16:02:33.037373+08:00
     2048K             2500            1601            1601        NONE
2024-12-04T16:02:33.037560+08:00
**********************************************************************
2024-12-04T16:02:36.180638+08:00
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
2024-12-04T16:02:36.247066+08:00
Initial number of CPU is 4
Number of processor cores in the system is 4
Number of processor sockets in the system is 1
Capability Type : Network 
capabilities requested : 7 detected : 0 Simulated : 0
Capability Type : Runtime Environment 
capabilities requested : 400000FF detected : 40000000 Simulated : 0
Capability Type : Engineered Systems 
capabilities requested : 7 detected : 0 Simulated : 0
Capability Type : Database Test 
capabilities requested : 3 detected : 0 Simulated : 0
Autotune of undo retention is turned on. 
IMODE=BR
ILAT =332
LICENSE_MAX_USERS = 0
SYS auditing is enabled
NOTE: remote asm mode is local (mode 0x1; from cluster type)
NOTE: Using default ASM root directory ASM
NOTE: remote asm mode is local (mode 0x1; from cluster type)
NOTE: Cluster configuration type = NONE [2]
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0.
ORACLE_HOME:    /oracle/app/oracle/product/19c/db_1
System name:	Linux
Node name:	hfdb40
Release:	3.10.0-957.el7.x86_64
Version:	#1 SMP Thu Oct 4 20:48:51 UTC 2018
Machine:	x86_64
Using parameter settings in server-side spfile /oracle/app/oracle/product/19c/db_1/dbs/spfiledghfdb.ora
System parameters with non-default values:
  processes                = 2000
  sessions                 = 3024
  sga_target               = 3200M
  control_files            = "/oradata/dghfdb/control01.ctl"
  control_files            = "/oradata/dghfdb/control02.ctl"
  db_file_name_convert     = "+DGDATA1/hfdb"
  db_file_name_convert     = "/oradata/dghfdb"
  db_file_name_convert     = "+DGSYSTEM1/hfdb"
  db_file_name_convert     = "/oradata/dghfdb"
  log_file_name_convert    = "+DGSYSTEM1/hfdb"
  log_file_name_convert    = "/oradata/dghfdb"
  db_block_size            = 8192
  compatible               = "19.0.0"
  log_archive_dest_1       = "LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dghfdb"
  log_archive_dest_2       = "SERVICE=hfdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hfdb"
  fal_client               = "dghfdb"
  fal_server               = "hfdb"
  log_archive_config       = "DG_CONFIG=(dghfdb,hfdb)"
  log_archive_format       = "%t_%s_%r.arc"
  db_recovery_file_dest    = "/archive"
  db_recovery_file_dest_size= 2G
  standby_file_management  = "AUTO"
  undo_tablespace          = "UNDOTBS1"
  remote_login_passwordfile= "EXCLUSIVE"
  db_domain                = ""
  audit_file_dest          = "/oracle/app/oracle/admin/dghfdb/adump"
  audit_trail              = "NONE"
  db_name                  = "hfdb"
  db_unique_name           = "dghfdb"
  open_cursors             = 2000
  pga_aggregate_target     = 1G
  diagnostic_dest          = "/oracle/app/oracle"
2024-12-04T16:02:36.708606+08:00
============================================================
NOTE: PatchLevel of this instance 0
============================================================
Starting background process PMON
2024-12-04T16:02:36.808777+08:00
PMON started with pid=2, OS id=29583 
Starting background process CLMN
2024-12-04T16:02:36.829898+08:00
CLMN started with pid=3, OS id=29585 
Starting background process PSP0
2024-12-04T16:02:36.849678+08:00
PSP0 started with pid=4, OS id=29587 
Starting background process VKTM
2024-12-04T16:02:37.906843+08:00
VKTM started with pid=5, OS id=29590 at elevated (RT) priority
2024-12-04T16:02:37.906861+08:00
Starting background process GEN0
2024-12-04T16:02:37.910251+08:00
VKTM running at (1)millisec precision with DBRM quantum (100)ms
2024-12-04T16:02:37.935212+08:00
GEN0 started with pid=6, OS id=29594 
Starting background process MMAN
2024-12-04T16:02:37.966706+08:00
MMAN started with pid=7, OS id=29596 
Starting background process GEN1
2024-12-04T16:02:38.029621+08:00
GEN1 started with pid=9, OS id=29600_29601 
Starting background process DIAG
2024-12-04T16:02:38.054351+08:00
DIAG started with pid=11, OS id=29603 
Starting background process OFSD
2024-12-04T16:02:38.090789+08:00
OFSD started with pid=12, OS id=29605_29606 
Starting background process DBRM
2024-12-04T16:02:38.092874+08:00
Oracle running with ofslib:'Oracle File Server Library' version=2
2024-12-04T16:02:38.111686+08:00
DBRM started with pid=14, OS id=29608 
Starting background process VKRM
2024-12-04T16:02:38.131899+08:00
VKRM started with pid=15, OS id=29610 
Starting background process SVCB
2024-12-04T16:02:38.163385+08:00
SVCB started with pid=16, OS id=29612 
Starting background process PMAN
2024-12-04T16:02:38.195188+08:00
PMAN started with pid=17, OS id=29614 
Starting background process DIA0
2024-12-04T16:02:38.225801+08:00
DIA0 started with pid=18, OS id=29616 
Starting background process DBW0
2024-12-04T16:02:38.250334+08:00
DBW0 started with pid=19, OS id=29618 
Starting background process LGWR
2024-12-04T16:02:38.269963+08:00
LGWR started with pid=20, OS id=29620 
Starting background process CKPT
2024-12-04T16:02:38.289488+08:00
CKPT started with pid=21, OS id=29622 
2024-12-04T16:02:38.320394+08:00
LGWR slave LG00 created with pid=22, OS pid=29624
Starting background process SMON
2024-12-04T16:02:38.342005+08:00
SMON started with pid=23, OS id=29627 
LGWR slave LG01 created with pid=24, OS pid=29629
Starting background process SMCO
2024-12-04T16:02:38.405354+08:00
SMCO started with pid=25, OS id=29631 
Starting background process RECO
2024-12-04T16:02:38.437046+08:00
RECO started with pid=26, OS id=29633 
Starting background process LREG
2024-12-04T16:02:38.478840+08:00
LREG started with pid=28, OS id=29637 
Starting background process PXMN
2024-12-04T16:02:38.531012+08:00
PXMN started with pid=30, OS id=29641 
Starting background process FENC
2024-12-04T16:02:38.550429+08:00
FENC started with pid=31, OS id=29643 
Starting background process MMON
2024-12-04T16:02:38.583920+08:00
MMON started with pid=32, OS id=29645 
Starting background process MMNL
2024-12-04T16:02:38.615212+08:00
MMNL started with pid=31, OS id=29647 
Starting background process TMON
2024-12-04T16:02:38.636079+08:00
TMON started with pid=33, OS id=29649 
2024-12-04T16:02:38.637608+08:00
Setting CPU count to 4
ORACLE_BASE from environment = /oracle/app/oracle
2024-12-04T16:02:41.284331+08:00
PGA_AGGREGATE_LIMIT specified is high
2024-12-04T16:02:41.284674+08:00
WARNING: pga_aggregate_limit value is too high for the
amount of physical memory on the system
  PGA_AGGREGATE_LIMIT is 6000 MB
  PGA_AGGREGATE_TARGET is 1024 MB.
  physical memory size is 7982 MB
  limit based on physical memory and SGA usage is 3984 MB
  SGA_TARGET is 3200 MB
Using default pga_aggregate_limit of 6000 MB
2024-12-04T16:02:46.323237+08:00
##### Conversion to standby controlfile pending for restored file   #####################
No controlfile conversion
No controlfile conversion
2024-12-04T16:02:49.156283+08:00
alter database mount standby database
2024-12-04T16:02:53.287274+08:00
Converting controlfile to standby
If db_file_name_convert or log_file_name_convert parameters
are not used, then RMAN intervention is required to fix the
file names in the converted control file. Refer to RMAN
documentation for how to fix all file names.
Clearing standby activation ID 779795378 (0x2e7abbb2)
The primary database controlfile was created using the
'MAXLOGFILES 192' clause.
There is space for up to 188 standby redo logfiles
Use the following SQL commands on the standby database to create
standby redo logfiles that match the primary database:
ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 209715200;
ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 209715200;
ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 209715200;
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 209715200;
ALTER DATABASE ADD STANDBY LOGFILE 'srl5.f' SIZE 209715200;
WARNING: OMF is enabled on this database. Creating a physical 
standby controlfile, when OMF is enabled on the primary 
database, requires manual RMAN intervention to resolve OMF 
datafile pathnames.
NOTE: Please refer to the RMAN documentation for procedures 
describing how to manually resolve OMF datafile pathnames.
Set as converted control file due to db_unique_name mismatch
Changing di2dbun from hfdb to dghfdb
.... (PID:29654): RT: Role transition work is not done
.... (PID:29654): Redo network throttle feature is disabled at mount time
2024-12-04T16:02:53.458584+08:00
Successful mount of redo thread 1, with mount id 781122345
2024-12-04T16:02:53.459278+08:00
.... (PID:29654): Database role set to PHYSICAL STANDBY [kcvfdb.c:9076]
Physical Standby Database mounted.
.... (PID:29654): STARTING ARCH PROCESSES
Starting background process ARC0
2024-12-04T16:02:53.485758+08:00
ARC0 started with pid=37, OS id=29672 
.... (PID:29654): ARC0: Archival started
.... (PID:29654): STARTING ARCH PROCESSES COMPLETE
2024-12-04T16:02:53.496037+08:00
ARC0 (PID:29672): Becoming a 'no FAL' ARCH
2024-12-04T16:02:53.496360+08:00
In-memory operation on ADG is currently only supported on Engineered systems and PaaS.
inmemory_adg_enabled is turned off automatically.
Please contact our support team for EXADATA solutions
Lost write protection disabled
.... (PID:29654): Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST [krsd.c:18157]
2024-12-04T16:02:53.506706+08:00
TT00 (PID:29674): Gap Manager starting
2024-12-04T16:02:53.525869+08:00
TMON (PID:29649): STARTING ARCH PROCESSES
Starting background process ARC1
2024-12-04T16:02:53.554783+08:00
ARC1 started with pid=40, OS id=29678 
Starting background process ARC2
Starting background process ARC3
2024-12-04T16:02:53.580196+08:00
ARC2 started with pid=41, OS id=29680 
2024-12-04T16:02:53.601552+08:00
ARC3 started with pid=42, OS id=29682 
TMON (PID:29649): ARC1: Archival started
TMON (PID:29649): ARC2: Archival started
TMON (PID:29649): ARC3: Archival started
TMON (PID:29649): STARTING ARCH PROCESSES COMPLETE
2024-12-04T16:02:53.714816+08:00
Archiving previously deferred ORLs (dghfdb)
Completed: alter database mount standby database
2024-12-04T16:02:54.959668+08:00
ALTER SYSTEM SET standby_file_management='MANUAL' SCOPE=BOTH;
2024-12-04T16:02:55.095279+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 1: '/oradata/dghfdb/datafile/system.261.1185439411'
2024-12-04T16:02:55.519986+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 2: '/oradata/dghfdb/datafile/sysaux.266.1185439449'
2024-12-04T16:02:55.668123+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 3: '/oradata/dghfdb/datafile/undotbs1.260.1185439475'
2024-12-04T16:02:55.838972+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 4: '/oradata/dghfdb/datafile/undotbs2.258.1185439511'
2024-12-04T16:02:55.839920+08:00
WARNING: Clusterware not configured
WARNING: Clusterware not configured
WARNING: Clusterware not configured
WARNING: Clusterware not configured
2024-12-04T16:02:56.009128+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 5: '/oradata/dghfdb/datafile/users.276.1185439523'
2024-12-04T16:02:56.334408+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 6: '/oradata/dghfdb/datafile/hfdb1.257.1185443509'
2024-12-04T16:02:56.356239+08:00
 rfs (PID:29701): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T16:02:56.392515+08:00
 rfs (PID:29703): Primary database is in MAXIMUM PERFORMANCE mode
2024-12-04T16:02:56.480659+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 7: '/oradata/dghfdb/datafile/ogg_tbs.286.1185478503'
2024-12-04T16:02:56.577768+08:00
 rfs (PID:29701): Selected LNO:13 for T-2.S-51 dbid 779754523 branch 1185439387
2024-12-04T16:02:56.626532+08:00
Errors in file /oracle/app/oracle/diag/rdbms/dghfdb/dghfdb/trace/dghfdb_mz00_29689.trc:
ORA-01110: data file 8: '/oradata/dghfdb/datafile/hfdb1.287.1186845893'
ORA-01565: error in identifying file '/oradata/dghfdb/datafile/hfdb1.287.1186845893'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
2024-12-04T16:02:56.662167+08:00
 rfs (PID:29703): Selected LNO:10 for T-1.S-80 dbid 779754523 branch 1185439387
Checker run found 1 new persistent data failures
2024-12-04T16:03:00.346027+08:00
Full restore complete of datafile 8 /oradata/dghfdb/datafile/hfdb1.287.1186845893.  Elapsed time: 0:00:00
  checkpoint is 2091027
  last deallocation scn is 3
2024-12-04T16:03:01.464905+08:00
Switch of datafile 8 complete to datafile copy 
  checkpoint is 2091027
2024-12-04T16:03:05.704761+08:00
Incremental restore complete of datafile 1 /oradata/dghfdb/datafile/system.261.1185439411
  checkpoint is 2091050
  last deallocation scn is 1035078
2024-12-04T16:03:21.144898+08:00
Incremental restore complete of datafile 2 /oradata/dghfdb/datafile/sysaux.266.1185439449
  checkpoint is 2091071
  last deallocation scn is 1723671
2024-12-04T16:03:26.216525+08:00
Incremental restore complete of datafile 3 /oradata/dghfdb/datafile/undotbs1.260.1185439475
  checkpoint is 2091110
  last deallocation scn is 2051192
2024-12-04T16:03:30.168253+08:00
Incremental restore complete of datafile 4 /oradata/dghfdb/datafile/undotbs2.258.1185439511
  checkpoint is 2091120
  last deallocation scn is 2077035
2024-12-04T16:03:32.440839+08:00
Incremental restore complete of datafile 5 /oradata/dghfdb/datafile/users.276.1185439523
  checkpoint is 2091129
  last deallocation scn is 3
2024-12-04T16:03:33.544642+08:00
Incremental restore complete of datafile 6 /oradata/dghfdb/datafile/hfdb1.257.1185443509
  checkpoint is 2091134
  last deallocation scn is 3
2024-12-04T16:03:34.894847+08:00
Incremental restore complete of datafile 7 /oradata/dghfdb/datafile/ogg_tbs.286.1185478503
  checkpoint is 2091143
  last deallocation scn is 3
2024-12-04T16:03:35.894572+08:00
alter database recover datafile list clear
Completed: alter database recover datafile list clear
alter database recover datafile list
 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8
Completed: alter database recover datafile list
 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8
alter database recover
 if needed standby start
2024-12-04T16:03:35.897797+08:00
Media Recovery Start
 Started logmerger process
2024-12-04T16:03:35.938535+08:00
PR00 (PID:29746): Managed Standby Recovery not using Real Time Apply
2024-12-04T16:03:36.214101+08:00
Parallel Media Recovery started with 4 slaves
ORA-279 signalled during: alter database recover
 if needed standby start
...
2024-12-04T16:03:36.959209+08:00
ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=BOTH;
2024-12-04T16:03:37.268091+08:00
stopping change tracking
2024-12-04T16:04:27.939081+08:00
alter database open
2024-12-04T16:04:27.950689+08:00
Ping without log force is disabled:
  instance mounted in exclusive mode.
2024-12-04T16:04:27.954011+08:00
Beginning Standby Crash Recovery.
 Started logmerger process
2024-12-04T16:04:28.040724+08:00
PR00 (PID:29811): Managed Standby Recovery starting Real Time Apply
2024-12-04T16:04:28.357039+08:00
Parallel Media Recovery started with 4 slaves
2024-12-04T16:04:28.378153+08:00
stopping change tracking
PR00 (PID:29811): Media Recovery Waiting for T-1.S-80 (in transit)
2024-12-04T16:04:28.642704+08:00
Media Recovery of Online Log [Thread=1, Seq=80]
2024-12-04T16:04:28.643191+08:00
Recovery of Online Redo Log: Thread 1 Group 10 Seq 80 Reading mem 0
  Mem# 0: /oradata/dghfdb/onlinelog/group_10.280.1185445703
PR00 (PID:29811): Media Recovery Waiting for T-2.S-51 (in transit)
2024-12-04T16:04:28.734217+08:00
Media Recovery of Online Log [Thread=2, Seq=51]
2024-12-04T16:04:28.734689+08:00
Recovery of Online Redo Log: Thread 2 Group 13 Seq 51 Reading mem 0
  Mem# 0: /oradata/dghfdb/onlinelog/group_13.283.1185445729
2024-12-04T16:04:28.923674+08:00
Incomplete Recovery applied until change 2091143 time 12/04/2024 16:03:35
2024-12-04T16:04:29.059409+08:00
stopping change tracking
2024-12-04T16:04:29.105325+08:00
Completed Standby Crash Recovery.
Endian type of dictionary set to little
Undo initialization finished serial:0 start:21230124 end:21230124 diff:0 ms (0.0 seconds)
Dictionary check beginning
Dictionary check complete
Database Characterset is ZHS16GBK
No Resource Manager plan active
2024-12-04T16:04:30.118930+08:00
replication_dependency_tracking turned off (no async multimaster replication found)
Physical standby database opened for read only access.
Completed: alter database open
2024-12-04T16:04:30.687980+08:00
Unable to obtain current patch information as the database or pluggable database was opened for read-only access.
===========================================================
Dumping current patch information
===========================================================
Unable to obtain current patch information due to error: 16000
===========================================================
2024-12-04T16:04:30.986993+08:00
PL/SQL package SYS.DBMS_RCVMAN version 19.07.00.00 is too new
Oracle must be upgraded to version 08.00.04.00 to work with this package
db_recovery_file_dest_size of 2048 MB is 7.65% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
2024-12-04T16:04:35.927628+08:00
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
alter database recover managed standby database using current logfile disconnect from session
2024-12-04T16:04:35.939805+08:00
Attempt to start background Managed Standby Recovery process (dghfdb)
Starting background process MRP0
2024-12-04T16:04:35.966679+08:00
MRP0 started with pid=57, OS id=29864 
2024-12-04T16:04:35.968583+08:00
Background Managed Standby Recovery process started (dghfdb)
2024-12-04T16:04:41.016669+08:00
 Started logmerger process
2024-12-04T16:04:41.032207+08:00

IM on ADG: Start of Empty Journal 

IM on ADG: End of Empty Journal 
PR00 (PID:29870): Managed Standby Recovery starting Real Time Apply
2024-12-04T16:04:41.326843+08:00
Parallel Media Recovery started with 4 slaves
2024-12-04T16:04:41.344728+08:00
stopping change tracking
2024-12-04T16:04:41.386878+08:00
TT02 (PID:29881): Waiting for all non-current ORLs to be archived
2024-12-04T16:04:41.387015+08:00
TT02 (PID:29881): All non-current ORLs have been archived
2024-12-04T16:04:41.434560+08:00
PR00 (PID:29870): Media Recovery Waiting for T-1.S-80 (in transit)
2024-12-04T16:04:41.435805+08:00
Recovery of Online Redo Log: Thread 1 Group 10 Seq 80 Reading mem 0
  Mem# 0: /oradata/dghfdb/onlinelog/group_10.280.1185445703
PR00 (PID:29870): Media Recovery Waiting for T-2.S-51 (in transit)
2024-12-04T16:04:41.491457+08:00
Recovery of Online Redo Log: Thread 2 Group 13 Seq 51 Reading mem 0
  Mem# 0: /oradata/dghfdb/onlinelog/group_13.283.1185445729
2024-12-04T16:04:42.028845+08:00
Completed: alter database recover managed standby database using current logfile disconnect from session

备库开启日志同步进程:

[oracle@hfdb40:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 4 16:04:25 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SYS@dghfdb> alter database open;

Database altered.

SYS@dghfdb> alter database recover managed standby database using current logfile disconnect from session;


Database altered.

主库重新激活同步:

SYS@hfdb1> alter system set log_archive_dest_state_2=defer;

System altered.

SYS@hfdb1> alter system set log_archive_dest_state_2=enable;

System altered.

查询是否存在 GAP,确认主备是否同步:

set line 1000
col status for a10
col type for a10
col error for a20
col gap_status for a20
col synchronization_status for a30
col recovery_mode for a60
select inst_id,status,DEST_ID,TYPE,ERROR,GAP_STATUS,SYNCHRONIZED,SYNCHRONIZATION_STATUS,RECOVERY_MODE from GV$ARCHIVE_DEST_STATUS where STatus <> 'INACTIVE' and type = 'PHYSICAL';
-- 显示 NO GAP,同步正常
  INST_ID STATUS        DEST_ID TYPE       ERROR                GAP_STATUS           SYNCHRONI SYNCHRONIZATION_STATUS         RECOVERY_MODE
---------- ---------- ---------- ---------- -------------------- -------------------- --------- ------------------------------ ------------------------------------------------------------
         2 VALID               2 PHYSICAL                        NO GAP               NO        CHECK CONFIGURATION            MANAGED REAL TIME APPLY WITH QUERY
         1 VALID               2 PHYSICAL                        NO GAP               NO        CHECK CONFIGURATION            MANAGED REAL TIME APPLY WITH QUERY

-- 备库执行
SYS@dghfdb>  select process,thread#,group#,sequence#,status from gv$managed_standby;

PROCESS                        THREAD# GROUP#                          SEQUENCE# STATUS
--------------------------- ---------- ------------------------------ ---------- ------------------------------------
ARCH                                 0 N/A                                     0 CONNECTED
DGRD                                 0 N/A                                     0 ALLOCATED
DGRD                                 0 N/A                                     0 ALLOCATED
ARCH                                 0 N/A                                     0 CONNECTED
ARCH                                 0 N/A                                     0 CONNECTED
ARCH                                 0 N/A                                     0 CONNECTED
RFS                                  2 N/A                                     0 IDLE
RFS                                  2 3                                      51 IDLE
RFS                                  1 N/A                                     0 IDLE
RFS                                  1 2                                      80 IDLE
MRP0                                 2 N/A                                    51 APPLYING_LOG

11 rows selected.
SYS@dghfdb>  select count(*) from gv$archived_log where applied='NO';

  COUNT(*)
----------
         0

SYS@dghfdb> select * from v$archive_gap;

no rows selected

SYS@dghfdb>

至此,19C 的 GAP 也已修复,可以看到 Oracle 随着版本升级,越来越自动化的操作,意味着运维自动化的未来。

查考:- 墨天轮精品课

你可能感兴趣的:(Oracle,oracle,数据库,ADG)