adg的archive出现gap,使用增量恢复的方式进行恢复adg,RMAN-06094: datafile 1 must be restored

本文介绍了一种在不重建物理DG的情况下恢复Oracle物理DG的方法。通过模拟归档文件丢失场景,详细展示了如何进行主库基于SCN的增量备份,并在备库恢复过程中解决数据文件名称和路径不匹配的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

① 主库丢失归档文件,然后在不重建物理dg的情况下来恢复物理dg

一.4.2  实验过程

一.4.2.1  主备库环境

查看主库的信息:

 

SQL>select protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE            SWITCHOVER_STATUS

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

MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PRIMARY          YES READ WRITE           TO STANDBY

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/arch/prod
Oldest online log sequence     153
Next log sequence to archive   0
Current log sequence           155

查看备库的信息:

SQL>select protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE    SWITCHOVER_STATUS

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

MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY WITH APPLY NOT ALLOWED

已用时间:  00: 00: 00.06

20:40:44 SQL>

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/arch/phy1
Oldest online log sequence     153
Next log sequence to archive   0
Current log sequence           155

20:43:23 SQL>

一.4.2.2  模拟归档丢失

备库操作,备库取消归档应用,让备库处于只读模式:

20:43:23 SQL> ALTER ATABASE recover managed standby DATABASE cancel;

 

数据库已更改。

SQL>select protection_mode,protection_level,database_role,open_mode,switchover_status from v$database;

 

 PROTECTION_MODE   PROTECTION_LEVEL   DATABASE_ROLE  FOR OPEN_MODE  SWITCHOVER_STATUS

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

MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY     NOT ALLOWED

 

主库配置归档2的状态为defer,目的是为了不把归档自动传递到备库,实际情况下往往是由于网络故障,备库挂掉等等情况导致,我们多次切换主库日志:

20:50:48 SQL>  ALTER system SET log_archive_dest_state_2 = 'defer';

SQL> alter system switch logfile;

、、、、、、、、、、

SQL> select count(*) from test.test;

  COUNT(*)
----------
    658944

SQL> 
SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/arch/prod
Oldest online log sequence     170
Next log sequence to archive   172
Current log sequence           172
SQL> col name for a100
set linesize 9999 pagesize 9999
SELECT dest_id,THREAD#,NAME,sequence#,archived,applied,a.NEXT_CHANGE# FROM v$archived_log a
WHERE a.sequence# >= 40
AND resetlogs_change# =(SELECT d.RESETLOGS_CHANGE# FROM v$database d)
ORDER BY a.THREAD#,a.sequence#,a.dest_id;SQL> SQL>   2    3    4  

   DEST_ID    THREAD# NAME                                                    SEQUENCE# ARC APPLIED   NEXT_CHANGE#
---------- ---------- ---------------------------------------------------------------------------------------------------- ---------- --- --------- ------------

     2        1 ogg1                                                                                          156 YES NO         1024803
     1        1 /u01/arch/prod/1_157_981738248.arc                                      157 YES NO         1024808
     1        1 /u01/arch/prod/1_158_981738248.arc                                      158 YES NO         1024814
     1        1 /u01/arch/prod/1_159_981738248.arc                                      159 YES NO         1024817
     1        1 /u01/arch/prod/1_160_981738248.arc                                      160 YES NO         1024820
     1        1 /u01/arch/prod/1_161_981738248.arc                                      161 YES NO         1024825
     1        1 /u01/arch/prod/1_162_981738248.arc                                      162 YES NO         1025156
     1        1 /u01/arch/prod/1_163_981738248.arc                                      163 YES NO         1025163
     1        1 /u01/arch/prod/1_164_981738248.arc                                      164 YES NO         1025171
     1        1 /u01/arch/prod/1_165_981738248.arc                                      165 YES NO         1025174
     1        1 /u01/arch/prod/1_166_981738248.arc                                      166 YES NO         1025177
     1        1 /u01/arch/prod/1_167_981738248.arc                                      167 YES NO         1025182
     1        1 /u01/arch/prod/1_168_981738248.arc                                      168 YES NO         1025185
     1        1 /u01/arch/prod/1_169_981738248.arc                                      169 YES NO         1025398
     1        1 /u01/arch/prod/1_170_981738248.arc                                      170 YES NO         1025405
     1        1 /u01/arch/prod/1_171_981738248.arc                                      171 YES NO         1025412

159 rows selected.

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/arch/phy1
Oldest online log sequence     154
Next log sequence to archive   0
Current log sequence           156
SQL> col name for a100
set linesize 9999 pagesize 9999
SELECT dest_id,THREAD#,NAME,sequence#,archived,applied,a.NEXT_CHANGE# FROM v$archived_log a
WHERE a.sequence# >= 40
AND resetlogs_change# =(SELECT d.RESETLOGS_CHANGE# FROM v$database d)
ORDER BY a.THREAD#,aSQL> SQL>   2    3    4  .sequence#,a.dest_id;

   DEST_ID    THREAD# NAME                                                    SEQUENCE# ARC APPLIED   NEXT_CHANGE#
---------- ---------- ---------------------------------------------------------------------------------------------------- ---------- --- --------- ------------
     1        1 /u01/arch/phy1/1_152_981738248.arc                                      152 YES YES         1015367
     1        1 /u01/arch/phy1/1_153_981738248.arc                                      153 YES YES         1015455
     1        1 /u01/arch/phy1/1_154_981738248.arc                                      154 YES YES         1016001
     1        1 /u01/arch/phy1/1_155_981738248.arc                                      155 YES NO         1024646
     1        1 /u01/arch/phy1/1_156_981738248.arc                                      156 YES NO         1024803

40 rows selected.

 

可以看到,备库已经断档了,157到171都没有接收,接下来我们删除主库的归档日志,我们只删除54、55这2 个归档日志:

[oracle@primary prod]$ rm -rf 1_162_981738248.arc
[oracle@primary prod]$ rm -rf 1_163_981738248.arc
[oracle@primary prod]$ rm -rf 1_164_981738248.arc
[oracle@primary prod]$ rm -rf 1_165_981738248.arc
[oracle@primary prod]$ rm -rf 1_166_981738248.arc
[oracle@primary prod]$ rm -rf 1_167_981738248.arc
[oracle@primary prod]$ rm -rf 1_168_981738248.arc
[oracle@primary prod]$ rm -rf 1_169_981738248.arc

 

主库开启备库的归档:

SQL>  ALTER system SET log_archive_dest_state_2 = 'enable';

备库开启日志恢复模式:

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL>  select thread#,low_sequence#,high_sequence# from v$archive_gap;

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
     1         162        169

可以看到备库已经产生gap 了。

 一.4.2.3  主库基于SCN备份

162-169号日志不见了,这个时候我们以162号的归档日志的next_change#即161号的first_change#为scn号来对主库基于scn的rman 增量备份。

SQL> SELECT (SELECT MIN(d.CHECKPOINT_CHANGE#) FROM v$datafile d) datafile_scn,
(SELECT MIN(d.CHECKPOINT_CHANGE#)
FROM v$datafile_header d WHERE  rownum = 1) datafile_header_scn,
(SELECT current_scn FROM v$database) current_scn,
(SELECT b.NEXT_CHANGE# FROM v$archived_log b WHERE b.SEQUENCE# = 161
AND resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d) AND rownum = 1) NEXT_CHANGE# FROM dual;  2    3    4    5    6  

DATAFILE_SCN DATAFILE_HEADER_SCN CURRENT_SCN NEXT_CHANGE#
------------ ------------------- ----------- ------------
     1024825         1024825     1024824

这几个值基本上差不多,我们可以以 2241214 或者2241213为基准来备份,若是数据文件和文件头的scn 不一致我们应该取这几个值中最小的一个。

在主库上进行增量备份:

RMAN> run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
backup as compressed backupset incremental from SCN 1024824 database format '/u01/app/oracle/backup/standby_%d_%T_%U.bak' ;
release channel d1;
release channel d2;

using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=139 device type=DISK

allocated channel: d2
channel d2: SID=30 device type=DISK

Starting backup at 19-SEP-18
channel d1: starting compressed full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/ogg2/undotbs01.dbf
channel d1: starting piece 1 at 19-SEP-18
channel d2: starting compressed full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ogg2/system01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ogg2/test03.dbf
input datafile file number=00009 name=/u01/app/oracle/oradata/ogg2/test05.dbf
input datafile file number=00010 name=/u01/app/oracle/oradata/ogg2/test031.dbf
input datafile file number=00011 name=/u01/app/oracle/oradata/ogg2/test032.dbf
channel d2: starting piece 1 at 19-SEP-18
channel d2: finished piece 1 at 19-SEP-18
piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1ctdg6a9_1_1.bak tag=FOR STANDBY comment=NONE
channel d2: backup set complete, elapsed time: 00:01:26
channel d2: starting compressed full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/ogg2/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ogg2/users01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ogg2/test01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/ogg2/test02.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/ogg2/test04.dbf
channel d2: starting piece 1 at 19-SEP-18
channel d1: finished piece 1 at 19-SEP-18
piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1btdg6a9_1_1.bak tag=FOR STANDBY comment=NONE
channel d1: backup set complete, elapsed time: 00:01:34
channel d1: starting compressed full datafile backup set
channel d1: specifying datafile(s) in backup set
including standby control file in backup set
channel d1: starting piece 1 at 19-SEP-18
channel d1: finished piece 1 at 19-SEP-18
piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1etdg6d7_1_1.bak tag=FOR STANDBY comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d2: finished piece 1 at 19-SEP-18
piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1dtdg6cv_1_1.bak tag=FOR STANDBY comment=NONE
channel d2: backup set complete, elapsed time: 00:00:30
Finished backup at 19-SEP-18

released channel: d1

released channel: d2

 

进行控制文件的备份:

RMAN>  run
{
allocate channel c1 type disk;
backup current controlfile for standby format '/u01/app/oracle/backup/db_%T_%d_%t_%s_%p.ctl';
}2> 3> 4> 5> 

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=139 device type=DISK

Starting backup at 19-SEP-18
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including standby control file in backup set
channel c1: starting piece 1 at 19-SEP-18
channel c1: finished piece 1 at 19-SEP-18
piece handle=/u01/app/oracle/backup/db_20180919_OGG2_987241142_47_1.ctl tag=TAG20180919T093902 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 19-SEP-18
released channel: c1

将备份端数据启动该nomount进行恢复控制文件,然后启动到mount,在恢复数据文件

[oracle@standby backup]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Sep 19 09:55:15 2018

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

connected to target database: OGG2 (not mounted)

RMAN> restore standby controlfile to '/u01/app/oracle/flash_recovery_area/ogg1/control02.ctl' from '/u01/app/oracle/backup/db_20180919_OGG2_987241142_47_1.ctl';

Starting restore at 19-SEP-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=125 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 19-SEP-18

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

二、 恢复备库,注意这个数据文件是主库中的数据文件名称,要先在数据库中将其修改成备库的数据库名称
RMAN> report schema
2> ;
RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name STANDBY

RMAN> report schema;

Starting implicit crosscheck backup at 19-SEP-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=139 device type=DISK
Finished implicit crosscheck backup at 19-SEP-18

Starting implicit crosscheck copy at 19-SEP-18
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 19-SEP-18

searching for all files in the recovery area
cataloging files...
no files cataloged

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name OGG1

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     /u01/app/oracle/oradata/ogg1/system01.dbf
2    0        SYSAUX               ***     /u01/app/oracle/oradata/ogg1/sysaux01.dbf
3    0        UNDOTBS1             ***     /u01/app/oracle/oradata/ogg1/undotbs01.dbf
4    0        USERS                ***     /u01/app/oracle/oradata/ogg1/users01.dbf
5    10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test01.dbf
6    0        TEST                 ***     /u01/app/oracle/oradata/ogg1/test02.dbf
7    0        TEST                 ***     /u01/app/oracle/oradata/ogg1/test03.dbf
8    10       TEST2                ***     /u01/app/oracle/oradata/ogg1/test04.dbf
9    10       TEST2                ***     /u01/app/oracle/oradata/ogg1/test05.dbf
10   0        TEST                 ***     /u01/app/oracle/oradata/ogg1/test031.dbf
11   10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test032.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ogg1/temp01.dbf

但是备份端的数据文件名称和主库的数据文件名称和路径不一致:
[oracle@standby ogg1]$ ll
total 2549432
-rw-r----- 1 oracle oinstall  10043392 Sep 19 10:01 control01.ctl
-rw-r----- 1 oracle oinstall  52429312 Sep 14 13:44 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Sep 14 13:44 redo02.log
-rw-r----- 1 oracle oinstall  52429312 Sep 14 13:44 redo03.log
-rw-r----- 1 oracle oinstall  52429312 Sep 19 10:01 standby01.log
-rw-r----- 1 oracle oinstall  52429312 Sep 19 09:29 standby02.log
-rw-r----- 1 oracle oinstall  52429312 Sep 14 13:25 standby03.log
-rw-r----- 1 oracle oinstall  52429312 Sep 14 13:25 standby04.log
-rw-r----- 1 oracle oinstall 629153792 Sep 19 09:29 sysaux.dbf
-rw-r----- 1 oracle oinstall 734011392 Sep 19 09:29 system.dbf
-rw-r----- 1 oracle oinstall  10493952 Sep 19 09:29 test01.dbf
-rw-r----- 1 oracle oinstall  10493952 Sep 19 09:29 test032.dbf
-rw-r----- 1 oracle oinstall  10493952 Sep 19 09:29 test04.dbf
-rw-r----- 1 oracle oinstall  10493952 Sep 19 09:29 test05.dbf
-rw-r----- 1 oracle oinstall 823140352 Sep 19 09:29 undotbs1.dbf
-rw-r----- 1 oracle oinstall   5251072 Sep 19 09:29 users.dbf
[oracle@standby ogg1]$ ls
control01.ctl  redo02.log  standby01.log  standby03.log  sysaux.dbf  test01.dbf   test04.dbf  undotbs1.dbf
redo01.log     redo03.log  standby02.log  standby04.log  system.dbf  test032.dbf  test05.dbf  users.dbf
[oracle@standby ogg2]$ ls
temp01.dbf  test02.dbf  test031.dbf  test03.dbf
所以要先进行:

#####如果想避免出现这种情况的话,在进行异地备份恢复的时候,在进行数据文件命名的时候严格按照主库的数据文件名称来定义######
[oracle@standby ogg2]$ mv * ../ogg1
[oracle@standby ogg2]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 19 11:09:48 2018

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 rename file '/u01/app/oracle/oradata/ogg2/test02.dbf' to '/u01/app/oracle/oradata/ogg1/test02.dbf';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/test03.dbf' to '/u01/app/oracle/oradata/ogg1/test03.dbf';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/temp01.dbf' to '/u01/app/oracle/oradata/ogg1/temp01.dbf';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/test031.dbf' to '/u01/app/oracle/oradata/ogg1/test031.dbf';

Database altered.

SQL> alter system set standby_file_management=auto scope=both sid='*';

System altered.

SQL> alter system set standby_file_management=manual scope=both;

System altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg1/system01.dbf' to '/u01/app/oracle/oradata/ogg1/system.dbf';

Database altered.


SQL> alter database rename file '/u01/app/oracle/oradata/ogg1/sysaux01.dbf' to '/u01/app/oracle/oradata/ogg1/sysaux.dbf';

Database altered.


SQL> alter database rename file '/u01/app/oracle/oradata/ogg1/users01.dbf' to '/u01/app/oracle/oradata/ogg1/users.dbf';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg1/undotbs01.dbf' to '/u01/app/oracle/oradata/ogg1/undotbs1.dbf';                

Database altered.

SQL>  alter system set standby_file_management=auto scope=both sid='*';

System altered.

RMAN> report schema;

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name STANDBY


List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    700      SYSTEM               ***     /u01/app/oracle/oradata/ogg1/system.dbf
2    600      SYSAUX               ***     /u01/app/oracle/oradata/ogg1/sysaux.dbf
3    785      UNDOTBS1             ***     /u01/app/oracle/oradata/ogg1/undotbs1.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ogg1/users.dbf
5    10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test01.dbf
6    10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test02.dbf
7    10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test03.dbf
8    10       TEST2                ***     /u01/app/oracle/oradata/ogg1/test04.dbf
9    10       TEST2                ***     /u01/app/oracle/oradata/ogg1/test05.dbf
10   10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test031.dbf
11   10       TEST                 ***     /u01/app/oracle/oradata/ogg1/test032.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ogg1/temp01.dbf

RMAN> recover database noredo;

Starting recover at 19-SEP-18
using channel ORA_DISK_1
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: /u01/app/oracle/oradata/ogg1/system.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/ogg1/sysaux.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/ogg1/users.dbf
destination for restore of datafile 00006: /u01/app/oracle/oradata/ogg1/test02.dbf
destination for restore of datafile 00008: /u01/app/oracle/oradata/ogg1/test04.dbf
destination for restore of datafile 00010: /u01/app/oracle/oradata/ogg1/test031.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/standby_OGG2_20180919_1gtdg6n4_1_1.bak
channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1gtdg6n4_1_1.bak tag=TAG20180919T093948
channel ORA_DISK_1: restored backup piece 1
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: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: /u01/app/oracle/oradata/ogg1/undotbs1.dbf
destination for restore of datafile 00005: /u01/app/oracle/oradata/ogg1/test01.dbf
destination for restore of datafile 00007: /u01/app/oracle/oradata/ogg1/test03.dbf
destination for restore of datafile 00009: /u01/app/oracle/oradata/ogg1/test05.dbf
destination for restore of datafile 00011: /u01/app/oracle/oradata/ogg1/test032.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/standby_OGG2_20180919_1htdg6n4_1_1.bak
channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/standby_OGG2_20180919_1htdg6n4_1_1.bak tag=TAG20180919T093948
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished recover at 19-SEP-18

RMAN> exit


Recovery Manager complete.
[oracle@standby dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 19 11:21:20 2018

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> col name for a100
set linesize 9999 pagesize 9999
SELECT dest_id,THREAD#,NAME,sequence#,archived,applied,a.NEXT_CHANGE# FROM v$archived_log a
WHERE a.sequence# >= 40
AND resetlogs_change# =(SELECT d.RESETLOGS_CHANGE# FROM v$database d)
ORDER BY a.THREAD#,aSQL> SQL> .sequence#,a.dest_id;
  2    3    4  
   DEST_ID    THREAD# NAME                                                    SEQUENCE# ARC APPLIED   NEXT_CHANGE#
---------- ---------- ---------------------------------------------------------------------------------------------------- ---------- --- --------- ------------
     2        1 /u01/arch/phy1/1_173_981738248.arc                                      173 YES NO         1027491
     2        1 /u01/arch/phy1/1_174_981738248.arc                                      174 YES NO         1027693
     1        1 /u01/arch/phy1/1_175_981738248.arc                                      175 YES NO         1027993
     1        1 /u01/arch/phy1/1_176_981738248.arc                                      176 YES NO         1031524
     1        1 /u01/arch/phy1/1_177_981738248.arc                                      177 YES NO         1032805
     1        1 /u01/arch/phy1/1_178_981738248.arc                                      178 YES NO         1033214

6 rows selected.

SQL>  alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL> col name for a100
set linesize 9999 pagesize 9999
SELECT dest_id,THREAD#,NAME,sequence#,archived,applied,a.NEXT_CHANGE# FROM v$archived_log a
WHERE a.sequence# >= 40
AND resetlogs_change# =(SELECT d.RESETLOGS_CHANGE# FROM v$database d)
ORDER BY a.THREAD#,aSQL> SQL>   2    3    4  .sequence#,a.dest_id;

   DEST_ID    THREAD# NAME                                                    SEQUENCE# ARC APPLIED   NEXT_CHANGE#
---------- ---------- ---------------------------------------------------------------------------------------------------- ---------- --- --------- ------------
     2        1 /u01/arch/phy1/1_173_981738248.arc                                      173 YES YES         1027491
     2        1 /u01/arch/phy1/1_174_981738248.arc                                      174 YES YES         1027693
     1        1 /u01/arch/phy1/1_175_981738248.arc                                      175 YES YES         1027993
     1        1 /u01/arch/phy1/1_176_981738248.arc                                      176 YES YES         1031524
     1        1 /u01/arch/phy1/1_177_981738248.arc                                      177 YES YES         1032805
     1        1 /u01/arch/phy1/1_178_981738248.arc                                      178 YES IN-MEMORY     1033214

6 rows selected.

SQL> select * from v$archive_gap;

no rows selected

四、 备库read only 模式打开

22:41:41 SQL> alter database recover managed standby database cancel;

数据库已更改。

已用时间:  00: 00: 01.00

22:43:40 SQL> alter database open;

数据库已更改

已用时间:  00: 00: 00.22

22:43:45 SQL> alter database recover managed standby database using current logfile disconnect from session;

数据库已更改。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值