One .1  BLOG Document structure chart

 

image

 

One .2   Preface

 

One .2.1   Reading guide

Technology enthusiasts , After reading this article , You can master the following skills , You can also learn something else you don't know ,~O(∩_∩)O~:

①  Physics dg The recovery of the main library in the case of lost archive files

②  Physics dg Management and maintenance of some sql

 

Be careful : This article BLOG I use yellow background and red font to show the places that need special attention in the code part of , For example, in the following example ,thread 1 The maximum archive log number for is 33,thread 2 The maximum archive log number for is 43 It's something that needs special attention .

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

 

 

If there are any mistakes or imperfections in this article, please correct them ,ITPUB Message or QQ All can , Your criticism is the biggest motivation of my writing .

One .2.2   Introduction to the experimental environment

 

  project

Main library

dg library

db  type

Single instance

Single instance

db version

11.2.0.3

11.2.0.3

db  Storage

FS type

FS type

ORACLE_SID

oradg11g

oradgphy

db_name

oradg11g

oradg11g

host IP Address :

192.168.59.130

192.168.59.130

OS Version and kernel edition

RHEL6.5 64 position ,2.6.32-504.16.2.el6.x86_64

RHEL6.5 64 position ,2.6.32-504.16.2.el6.x86_64

OS hostname

rhel6_lhr

rhel6_lhr

 

 

 

One .2.3   Links to related reference articles

 

dg A series of articles :

【DATAGUARD】 Establish physical backup and logical backup based on the same host ( One ): http://blog.itpub.net/26736162/viewspace-1448197/
【DATAGUARD】 Establish physical backup and logical backup based on the same host ( Two ):  http://blog.itpub.net/26736162/viewspace-1448207/
【DATAGUARD】 Establish physical backup and logical backup based on the same host ( 3、 ... and ):  http://blog.itpub.net/26736162/viewspace-1481972/
【DATAGUARD】 Establish physical backup and logical backup based on the same host ( Four )-- Add a physical dg node :http://blog.itpub.net/26736162/viewspace-1484878/

【DATAGUARD】 Physics dg Of switchover Switch ( 5、 ... and ) :http://blog.itpub.net/26736162/viewspace-1753111/

【DATAGUARD】 Physics dg Of failover Switch ( 6、 ... and ):   http://blog.itpub.net/26736162/viewspace-1753130/

 

 

 

One .2.4   Brief introduction

 

Recently due to the expiration of the contract , I went to interview several companies to do oracle dba The job of , There were a lot of questions in the interview , Some interviewers are too wonderful , It's hard to answer the questions , I'm not very good at expressing myself , As the saying goes, you can't cheat people , So the interviews hit the wall , This is also my weakness , Originally, brother's technology has been very good , General DBA There's nothing wrong with my life , But I just can't pass the interview , Recently, it's really created both physically and mentally , Don't say the , It's tears to say more , This article blog It's based on me going to 1 A question asked by the interviewer during the interview in shop No , At that time, I vaguely felt that there was a way to recover , But I can't remember , As a result, the answer is reconstruction , After coming back, I searched the information and it can be recovered , We did some experiments over the weekend , Today I post it for you to share .

 

One .3   Related knowledge points literacy

 

  All are DG Some basic maintenance knowledge of , No post here , Let's go straight to the experiment .

  Using RMAN Incremental Backups to Refresh a Standby Database

 

You can create an incremental backup of the target database containing changes to the database since the creation of the duplicate or the previous syncrhonization. You can apply the incremental backup to the standby database.

 

Note:

This technique cannot be used to update a duplicate database.

RMAN enables you to synchronize a standby database with a primary database by creating an incremental backup at the source database that contains all changed blocks since the duplicate was created or last refreshed. You then apply the incremental backup to the standby database, which updates it with all changes.

This capability facilitates the temporary conversion of a physical standby database into a reporting database, as described in Oracle Data Guard Concepts and Administration. In particular, this capability makes it possible to reverse the effects of converting the standby into a reporting database. After the standby database has been used for reporting or testing, Flashback Database can reverse any changes resulting from that work, returning the database to its contents when it was still a standby. An incremental backup created with BACKUP INCREMENTAL... FROM SCN can be used to refresh the standby with changes at the primary since the conversion and then managed recovery can resume. The effect is to return the reporting database to its role as standby.

For more details on this scenario, see Oracle Data Guard Concepts and Administration.

Using BACKUP INCREMENTAL... FROM SCN

The incremental backup is created at the source database by means of the BACKUP INCREMENTAL FROM SCN=n form of the BACKUP command. For example:

BACKUP DEVICE TYPE SBT INCREMENTAL FROM SCN 750923 DATABASE;
BACKUP INCREMENTAL FROM SCN 750923 DATABASE;
BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE
FORMAT '/tmp/incr_standby_%U';

RMAN uses the selected SCN as the basis for this incremental backup. For all files being backed up, RMAN includes all data blocks that were changed at SCNs greater than or equal to the FROM SCN in the incremental backup.

Note:

· RMAN does not consider the incremental backup as part of a backup strategy at the source database. The backup is not suitable for use in a normal RECOVER DATABASE operation at the source database.

· The backup sets produced by this command are written to ?/dbs by default, even if the flash recovery area or some other backup destination is defined as the default for disk backups.

· You must create this incremental backup on disk for it to be useful. When you move the incremental backup to the standby, you must catalog it at the standby as described in "Step 3: Catalog the Incremental Backup Files at the Standby Database". Backups on tape cannot be cataloged.

See Also:

《Oracle Database Backup and Recovery Reference 》 for more details on BACKUP command syntax

Refreshing a Standby Database With INCREMENTAL FROM SCN Backups: Example

This example shows the steps required to update a standby database using incremental backups. The assumption is that you have already activated the standby, performed your tests or other operations at the standby, and then used Flashback Database to undo the effects of those changes. The task here is to refresh the standby with the latest changes to the primary, so that it can resume its role as a standby database.

Step 1: Create the Incremental Backup

Create the needed incremental backup at the source database, using BACKUP with the INCREMENTAL FROM SCN clause.

Assume that the incremental backup to be used in updating the duplicate database is to be created on disk, with the filenames for backup pieces determined by the format /tmp/incr_for_standby/bkup_%U.

RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE
FORMAT '/tmp/incr_for_standby/bkup_%U';

Step 2: Make the Incremental Backup Accessible at the Standby Database

Make the backup pieces containing the incremental backup available in some directory accessible on the system containing the standby database. For this example, assume that the destination directory is called /standbydisk1/incrback/ and ensure that it contains nothing besides the incremental backups from Step 1.

Step 3: Catalog the Incremental Backup Files at the Standby Database

Use the RMAN CATALOG command to register the backup sets in the RMAN repository at the duplicate. With an RMAN client connected to the standby database and the recovery catalog (if you use one at the standby), mount the standby and run the following command:

RMAN> CATALOG START WITH '/standbydisk1/incrback/';

The backups are now available for use in recovery of the standby.

Step 4: Apply the Incremental Backup to the Standby Database

Use the RMAN RECOVER command with the NOREDO option to apply the incremental backup to the standby database. All changed blocks captured in the incremental backup are updated at the standby database, bringing it up to date with the primary database. With an RMAN client connected to the standby database, run the following command:

RMAN> RECOVER DATABASE NOREDO;

You can now resume managed recovery at the standby. Any redo logs required at the standby with changes since those contained in the incremental are automatically requested from the primary and applied

 

One .4   Experimental part

 

One .4.1   The goal of the experiment

 

① The main library lost the archive , And then without reconstructing Physics dg We need to get back to physics dg

 

 

One .4.2   Experimental process

 

One .4.2.1   Primary and secondary library environment

Main library :

20:39:41 SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE            SWITCHOVER_STATUS

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

1403587593 ORADG11G      2240299 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PRIMARY          YES READ WRITE           TO STANDBY

 

Elapsed time :  00: 00: 00.01

20:39:42 SQL>

20:42:29 SQL> archive log list;

Database logging mode             Archive Mode

Auto archive              Enable

End of archive             USE_DB_RECOVERY_FILE_DEST

The earliest online log sequence      47

Next archive log sequence    49

Current log sequence            49

20:43:02 SQL>

 

For the library :

20:40:39 SQL>  select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE            SWITCHOVER_STATUS

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

1403587593 ORADG11G      2240295 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY WITH APPLY NOT ALLOWED

 

Elapsed time :  00: 00: 00.06

20:40:44 SQL>

20:42:23 SQL> archive log list;

Database logging mode             Archive Mode

Auto archive              Enable

End of archive             USE_DB_RECOVERY_FILE_DEST

The earliest online log sequence      47

Next archive log sequence    0

Current log sequence            49

20:43:23 SQL>

 

One .4.2.2   Simulated archive loss

Standby database operation , Backup library cancels archiving application , Put the standby database in read-only mode :

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

 

The database has changed .

 

Elapsed time :  00: 00: 01.00

20:44:39 SQL>

20:44:39 SQL>  select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE            SWITCHOVER_STATUS

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

1403587593 ORADG11G      2240536 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY            NOT ALLOWED

 

Elapsed time :  00: 00: 00.00

20:45:09 SQL>

 

 

Main library configuration archive 2 The status of is defer, The purpose is not to automatically transfer the archive to the backup library , In fact, it is often due to network failure , The standby library is down and so on , We switch the main database log many times :

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

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:52:31 SQL>

20:52:31 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:54:54 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.03

20:54:56 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:54:57 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:55:05 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.00

20:55:45 SQL> create table lhr.testdg as select * from dual;

 

Table created .

 

Elapsed time :  00: 00: 00.10

20:55:49 SQL> insert into lhr.testdg select * from dual;

 

Created 1 That's ok .

 

Elapsed time :  00: 00: 00.01

20:56:10 SQL> commit;

 

Submit completed .

 

Elapsed time :  00: 00: 00.00

20:56:43 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:56:52 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

20:56:56 SQL>  insert into lhr.testdg select * from dual;

 

Created 1 That's ok .

 

Elapsed time :  00: 00: 00.00

20:57:07 SQL> commit;

 

Submit completed .

 

Elapsed time :  00: 00: 00.00

20:57:11 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 01.57

20:57:15 SQL>

20:57:15 SQL> select * from lhr.testdg;

 

D

-

X

X

X

 

Elapsed time :  00: 00: 00.00

20:58:00 SQL>

20:58:00 SQL> archive log list;

Database logging mode             Archive Mode

Auto archive              Enable

End of archive             USE_DB_RECOVERY_FILE_DEST

The earliest online log sequence      55

Next archive log sequence    57

Current log sequence            57

20:58:30 SQL>

 

View the main library archive :

 

20:58:30 SQL> col name for a100

20:58:55 SQL> set linesize 9999  pagesize 9999

20:58:55 SQL> SELECT dest_id,

20:58:55   2         THREAD#,

20:58:55   3         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)

and a.dest_id=1

ORDER  BY a.THREAD#,

          a.sequence#,

20:58:55  14    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         1          1                                                                                                              40 YES NO             2181533

         1          1                                                                                                              41 YES NO             2181856

         1          1                                                                                                              42 YES NO             2182794

         1          1                                                                                                              43 YES NO             2182842

         1          1                                                                                                              44 YES NO             2223480

         1          1                                                                                                              45 YES NO             2223488

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_46_bxm58pvo_.arc                  46 YES NO             2224321

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_47_bxmc8z90_.arc                  47 YES NO             2234639

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_48_bxmc917l_.arc                  48 YES NO             2234642

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_49_bxmjnyoh_.arc                  49 YES NO             2241189

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_50_bxmjo0gk_.arc                  50 YES NO             2241194

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_51_bxmjo1vw_.arc                  51 YES NO             2241198

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_52_bxmjo9pw_.arc                  52 YES NO             2241209

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_53_bxmjocqc_.arc                  53 YES NO             2241214

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_54_bxmjrnt2_.arc                  54 YES NO             2241390

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_55_bxmjrrbl_.arc                  55 YES NO             2241396

         1          1 /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23/o1_mf_1_56_bxmjscy0_.arc                  56 YES NO             2241419

 

Have chosen 17 That's ok .

 

Elapsed time :  00: 00: 00.00

20:58:56 SQL>

 

Check the backup archive :

20:59:04 SQL> col name for a100

21:00:45 SQL> set linesize 9999  pagesize 9999

21:00:45 SQL> SELECT dest_id,

21:00:45   2         THREAD#,

21:00:45   3         NAME,

21:00:45   4         sequence#,

21:00:45   5         archived,

21:00:45   6         applied,

21:00:45   7         a.NEXT_CHANGE#

21:00:45   8  FROM   v$archived_log a

21:00:45   9  WHERE  a.sequence# >= 45

21:00:45  10  AND    resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

21:00:45  11  and a.dest_id=1

21:00:45  12  ORDER  BY a.THREAD#,

21:00:45  13            a.sequence#,

21:00:45  14    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         1          1                                                                                                              46 YES YES            2224321

         1          1                                                                                                              47 YES YES            2234639

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_48_bxmc9189_.arc                  48 YES YES            2234642

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_49_bxmjnyj3_.arc                  49 YES NO             2241189

 

Elapsed time :  00: 00: 00.01

21:00:46 SQL>

 

 

You can see , The backup library is out of stock ,50 To 56 No reception , Next, we delete the archive log of the main library , We just delete 54、55 this 2 An archive log :

[oracle@rhel6_lhr ~]$ cd /u01/app/oracle/flash_recovery_area/ORADG11G/archivelog/2015_08_23

[oracle@rhel6_lhr 2015_08_23]$ ls

o1_mf_1_46_bxm58pvo_.arc  o1_mf_1_48_bxmc917l_.arc  o1_mf_1_50_bxmjo0gk_.arc  o1_mf_1_52_bxmjo9pw_.arc  o1_mf_1_54_bxmjrnt2_.arc  o1_mf_1_56_bxmjscy0_.arc

o1_mf_1_47_bxmc8z90_.arc  o1_mf_1_49_bxmjnyoh_.arc  o1_mf_1_51_bxmjo1vw_.arc  o1_mf_1_53_bxmjocqc_.arc  o1_mf_1_55_bxmjrrbl_.arc

[oracle@rhel6_lhr 2015_08_23]$ ll

total 23624

-rw-r----- 1 oracle asmadmin   422400 Aug 23 17:40 o1_mf_1_46_bxm58pvo_.arc

-rw-r----- 1 oracle asmadmin 17354240 Aug 23 19:23 o1_mf_1_47_bxmc8z90_.arc

-rw-r----- 1 oracle asmadmin     1536 Aug 23 19:23 o1_mf_1_48_bxmc917l_.arc

-rw-r----- 1 oracle asmadmin  6266368 Aug 23 20:54 o1_mf_1_49_bxmjnyoh_.arc

-rw-r----- 1 oracle asmadmin     2048 Aug 23 20:54 o1_mf_1_50_bxmjo0gk_.arc

-rw-r----- 1 oracle asmadmin     1536 Aug 23 20:54 o1_mf_1_51_bxmjo1vw_.arc

-rw-r----- 1 oracle asmadmin     5120 Aug 23 20:55 o1_mf_1_52_bxmjo9pw_.arc

-rw-r----- 1 oracle asmadmin     2048 Aug 23 20:55 o1_mf_1_53_bxmjocqc_.arc

-rw-r----- 1 oracle asmadmin    96256 Aug 23 20:56 o1_mf_1_54_bxmjrnt2_.arc

-rw-r----- 1 oracle asmadmin     2560 Aug 23 20:56 o1_mf_1_55_bxmjrrbl_.arc

-rw-r----- 1 oracle asmadmin    12800 Aug 23 20:57 o1_mf_1_56_bxmjscy0_.arc

[oracle@rhel6_lhr 2015_08_23]$ rm -rf o1_mf_1_54*

[oracle@rhel6_lhr 2015_08_23]$ rm -rf o1_mf_1_55*

You have new mail in /var/spool/mail/oracle

[oracle@rhel6_lhr 2015_08_23]$ ll

total 23524

-rw-r----- 1 oracle asmadmin   422400 Aug 23 17:40 o1_mf_1_46_bxm58pvo_.arc

-rw-r----- 1 oracle asmadmin 17354240 Aug 23 19:23 o1_mf_1_47_bxmc8z90_.arc

-rw-r----- 1 oracle asmadmin     1536 Aug 23 19:23 o1_mf_1_48_bxmc917l_.arc

-rw-r----- 1 oracle asmadmin  6266368 Aug 23 20:54 o1_mf_1_49_bxmjnyoh_.arc

-rw-r----- 1 oracle asmadmin     2048 Aug 23 20:54 o1_mf_1_50_bxmjo0gk_.arc

-rw-r----- 1 oracle asmadmin     1536 Aug 23 20:54 o1_mf_1_51_bxmjo1vw_.arc

-rw-r----- 1 oracle asmadmin     5120 Aug 23 20:55 o1_mf_1_52_bxmjo9pw_.arc

-rw-r----- 1 oracle asmadmin     2048 Aug 23 20:55 o1_mf_1_53_bxmjocqc_.arc

-rw-r----- 1 oracle asmadmin    12800 Aug 23 20:57 o1_mf_1_56_bxmjscy0_.arc

[oracle@rhel6_lhr 2015_08_23]$

 

The main library opens the archive of the backup library :

21:05:44 SQL> ALTER system SET log_archive_dest_state_2 = 'enable';

 

The system has changed .

 

Elapsed time :  00: 00: 00.00

21:19:46 SQL>

 

The standby library opens the real-time application :

21:00:46 SQL> alter database recover managed standby database using current logfile disconnect from session;

 

The database has changed .

 

Elapsed time :  00: 00: 06.02

21:22:17 SQL>

 

At this time, the standby alarm log :

Sun Aug 23 21:22:16 2015

Managed Standby Recovery starting Real Time Apply

Parallel Media Recovery started with 2 slaves

Waiting for all non-current ORLs to be archived...

All non-current ORLs have been archived.

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_49_bxmjnyj3_.arc

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_50_bxml3lv7_.arc

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_51_bxml3lrh_.arc

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_52_bxml3lqv_.arc

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_53_bxml3lz7_.arc

Media Recovery Waiting for thread 1 sequence 54

Fetching gap sequence in thread 1, gap sequence 54-55

Completed: alter database recover managed standby database using current logfile disconnect from session

Sun Aug 23 21:25:17 2015

Error 12154 received logging on to the standby

FAL[client, USER]: Error 12154 connecting to oradg11g for fetching gap sequence

Sun Aug 23 21:57:57 2015

FAL[client]: Failed to request gap sequence

GAP - thread 1 sequence 54-55

DBID 1403587593 branch 886695024

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.

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

 

 

Check the backup archive again :

21:34:58 SQL>

21:36:10 SQL> col name for a100

21:37:40 SQL> set linesize 9999  pagesize 9999

21:37:40 SQL> SELECT dest_id,

21:37:40   2         THREAD#,

21:37:40   3         NAME,

21:37:40   4         sequence#,

21:37:40   5         archived,

21:37:41   6         applied,

21:37:41   7         a.NEXT_CHANGE#

21:37:41   8  FROM   v$archived_log a

21:37:41   9  WHERE  a.sequence# >= 45

21:37:41  10  AND    resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

21:37:41  11  ORDER  BY a.THREAD#,

21:37:41  12            a.sequence#,

21:37:41  13    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         2          1                                                                                                              45 YES YES            2223488

         1          1                                                                                                              46 YES YES            2224321

         1          1                                                                                                              47 YES YES            2234639

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_48_bxmc9189_.arc                  48 YES YES            2234642

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_49_bxmjnyj3_.arc                  49 YES YES            2241189

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_50_bxml3lv7_.arc                  50 YES YES            2241194

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_51_bxml3lrh_.arc                  51 YES YES            2241198

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_52_bxml3lqv_.arc                  52 YES YES            2241209

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_53_bxml3lz7_.arc                  53 YES YES            2241214

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_56_bxml3lz0_.arc                  56 YES NO             2241419

         2          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_57_bxml3m03_.arc                  57 YES NO             2243353

 

Have chosen 11 That's ok .

 

Elapsed time :  00: 00: 00.01

21:37:41 SQL>

21:40:35 SQL> select thread#,low_sequence#,high_sequence# from v$archive_gap;

 

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#

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

         1            54             55

 

Elapsed time :  00: 00: 00.01

21:50:38 SQL>

You can see that the standby database has been generated gap 了 .

One .4.2.3   The main library is based on SCN Backup

54、55 Log number one is missing , At this time, we use 53 No. of the archive log next_change# namely 54 The no. first_change# by scn Number to the main library based on scn Of rman Incremental backup .

 

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# = 53

        AND    resetlogs_change# =

               (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

        AND    rownum = 1) NEXT_CHANGE#

FROM   dual;

 

wps86BC.tmp 

 

These values are basically the same , We can use  2241214  perhaps 2241213 As a benchmark to backup , If it's data file and header scn Inconsistent, we should take the smallest of these values .

 

run

{

allocate channel d1 type disk;

allocate channel d2 type disk;

backup as compressed backupset incremental from SCN 2241214 database format '/u05/oracle/oracle_bk/ORADG11G/standby_%d_%T_%U.bak' include current controlfile for standby filesperset=5  tag 'FOR STANDBY';

release channel d1;

release channel d2;

}

 

 

 

[oracle@rhel6_lhr ~]$ rman target /

 

Recovery Manager : Release 11.2.0.3.0 - Production on Sunday 8 month 23 21:55:49 2015

 

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

 

Connected to target database : ORADG11G (DBID=1403587593)

 

RMAN> run

2> {

3> allocate channel d1 type disk;

4> allocate channel d2 type disk;

5> backup as compressed backupset incremental from SCN 2241214 database format '/u05/oracle/oracle_bk/ORADG11G/standby_%d_%T_%U.bak' include current controlfile for standby filesperset=5  tag 'FOR STANDBY';

6> release channel d1;

7> release channel d2;

8> }

 

Replace the recovery directory with the target database control file

Assigned channels : d1

passageway d1: SID=145 Device type =DISK

 

Assigned channels : d2

passageway d2: SID=19 Device type =DISK

 

start-up backup On 2015-08-23 21:55:54

 

Backup will start on 2015-08-30 21:55:54 abandoned

Archive logs will not be retained or backed up

passageway d1: Starting compressed backup set of all data files

passageway d1: Specifying data files in the backup set

Input data file : File number =00001 name =/u01/app/oracle/oradata/oradg11g/system01.dbf

Input data file : File number =00003 name =/u01/app/oracle/oradata/oradg11g/undotbs01.dbf

Input data file : File number =00005 name =/u01/app/oracle/oradata/oradg11g/example01.dbf

passageway d1: Starting segment 1 On 2015-08-23 21:55:54

passageway d2: Starting compressed backup set of all data files

passageway d2: Specifying data files in the backup set

Input data file : File number =00002 name =/u01/app/oracle/oradata/oradg11g/sysaux01.dbf

Input data file : File number =00006 name =/u01/app/oracle/oradata/oradg11g/logmnrtbs1.dbf

Input data file : File number =00004 name =/u01/app/oracle/oradata/oradg11g/users01.dbf

passageway d2: Starting segment 1 On 2015-08-23 21:55:54

 

passageway d2: Completed segment 1 On 2015-08-23 22:00:00

Segment handle =/u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak Mark =FOR STANDBY notes =NONE

passageway d2: Backup set completed , After time :00:04:06

passageway d2: Starting compressed backup set of all data files

passageway d2: Specifying data files in the backup set

The backup set contains backup control files

passageway d2: Starting segment 1 On 2015-08-23 22:00:03

passageway d2: Completed segment 1 On 2015-08-23 22:00:04

Segment handle =/u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak Mark =FOR STANDBY notes =NONE

passageway d2: Backup set completed , After time :00:00:01

passageway d1: Completed segment 1 On 2015-08-23 22:00:54

Segment handle =/u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak Mark =FOR STANDBY notes =NONE

passageway d1: Backup set completed , After time :00:05:00

 

Backup will start on 2015-08-30 22:00:54 abandoned

Archive logs will not be retained or backed up

passageway d1: Starting compressed backup set of all data files

passageway d1: Specifying data files in the backup set

The backup set contains the current control file

passageway d1: Starting segment 1 On 2015-08-23 22:00:55

passageway d1: Completed segment 1 On 2015-08-23 22:00:56

Segment handle =/u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2uqfbpgm_1_1.bak Mark =FOR STANDBY notes =NONE

passageway d1: Backup set completed , After time :00:00:01

complete backup On 2015-08-23 22:00:56

 

Release channels : d1

 

Release channels : d2

 

RMAN>

RMAN>

RMAN> list backupset summary;

 

 

Backup list

===============

keyword      TY LV S Device type Completion time             Number of segments replications Compression mark

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

9       B     A DISK        2015-08-23 21:59:53 1       1       YES        FOR STANDBY

10      B     A DISK        2015-08-23 22:00:04 1       1       YES        FOR STANDBY

11      B     A DISK        2015-08-23 22:00:49 1       1       YES        FOR STANDBY

12      B     A DISK        2015-08-23 22:00:55 1       1       YES        FOR STANDBY

RMAN> exit

 

 

Recovery manager complete .

[oracle@rhel6_lhr ~]$ ll -h /u05/oracle/oracle_bk/ORADG11G/*

-rw-r----- 1 oracle asmadmin 1.2M Aug 23 22:00 /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak

-rw-r----- 1 oracle asmadmin 1.4M Aug 23 21:59 /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak

-rw-r----- 1 oracle asmadmin 1.1M Aug 23 22:00 /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak

-rw-r----- 1 oracle asmadmin 1.1M Aug 23 22:00 /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2uqfbpgm_1_1.bak

[oracle@rhel6_lhr ~]$

 

You can see that the incremental backup is successful , Next, transfer the backup to the backup library , It can be used scp perhaps ftp Tools , scp * oracle@192.168.213.101:/u05/oracle/oracle_bk/ORADG11G/.

 

[oracle@rhel6_lhr ~]$ scp /u05/oracle/oracle_bk/ORADG11G/* oracle@192.168.59.130:/u05/oracle/

The authenticity of host '192.168.59.130 (192.168.59.130)' can't be established.

RSA key fingerprint is 77:e6:11:1a:7c:c7:81:7c:88:c9:21:18:51:2a:84:d1.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.59.130' (RSA) to the list of known hosts.

oracle@192.168.59.130's password:

standby_ORADG11G_20150823_2rqfbp7a_1_1.bak                                                                                                                                      100% 1144KB   1.1MB/s   00:00   

standby_ORADG11G_20150823_2sqfbp7a_1_1.bak                                                                                                                                      100% 1376KB   1.3MB/s   00:00   

standby_ORADG11G_20150823_2tqfbpf0_1_1.bak                                                                                                                                      100% 1104KB   1.1MB/s   00:00   

standby_ORADG11G_20150823_2uqfbpgm_1_1.bak                                                                                                                                      100% 1120KB   1.1MB/s   00:00   

You have new mail in /var/spool/mail/oracle

[oracle@rhel6_lhr ~]$

One .4.2.4   The standby database performs the recovery operation

One 、  Restart the standby database to nomount State to restore the control file

22:09:23 SQL> set line 9999

22:10:26 SQL> col name format a10

22:10:26 SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME       CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE            SWITCHOVER_STATUS

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

1403587593 ORADG11G       2241213 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY WITH APPLY NOT ALLOWED

 

Elapsed time :  00: 00: 00.01

22:11:41 SQL> create pfile='?/dbs/standby_pfile_before_recover_dg.ora' from spfile;

 

File created .

 

Elapsed time :  00: 00: 00.01

22:12:29 SQL>

22:12:29 SQL> shutdown immediate;

The database is closed .

Database has been uninstalled .

ORACLE Routine closed .

22:13:46 SQL> startup nomount;

ORACLE Routine started .

 

Total System Global Area  242171904 bytes

Fixed Size                  2227256 bytes

Variable Size             197133256 bytes

Database Buffers           37748736 bytes

Redo Buffers                5062656 bytes

22:13:56 SQL> show parameter control

 

NAME                                 TYPE                   VALUE

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

control_file_record_keep_time        integer                7

control_files                        string                 /u01/app/oracle/oradata/oradgp

                                                            hy/crontal01.ctl, /u01/app/ora

                                                            cle/oradata/oradgphy/control02

                                                            .ctl

control_management_pack_access       string                 DIAGNOSTIC+TUNING

 

[oracle@rhel6_lhr ~]$ rman target /

 

Recovery Manager : Release 11.2.0.3.0 - Production on Sunday 8 month 23 22:30:24 2015

 

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

 

Connected to target database : ORADG11G ( Not loaded )

 

RMAN>  restore standby  controlfile  to '/u01/app/oracle/oradata/oradgphy/crontal01.ctl' from '/u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak';

 

start-up restore On 2015-08-23 22:30:26

Replace the recovery directory with the target database control file

Assigned channels : ORA_DISK_1

passageway ORA_DISK_1: SID=134 Device type =DISK

 

passageway ORA_DISK_1: Restoring control files

passageway ORA_DISK_1: Restore complete , when : 00:00:01

complete restore On 2015-08-23 22:30:27

 

RMAN> restore standby  controlfile   to '/u01/app/oracle/oradata/oradgphy/control02.ctl' from '/u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak';

 

start-up restore On 2015-08-23 22:30:52

Use channel ORA_DISK_1

 

passageway ORA_DISK_1: Restoring control files

passageway ORA_DISK_1: Restore complete , when : 00:00:01

complete restore On 2015-08-23 22:30:53

 

RMAN>

RMAN> catalog start with '/u05/oracle/';

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: catalog command ( stay 08/23/2015 22:33:07 On ) Failure

ORA-01507: The database is not mounted

 

RMAN> alter database mount;

 

Database mounted

Release channels : ORA_DISK_1

 

RMAN> catalog start with '/u05/oracle/';

 

 

Search and style /u05/oracle All files that match

 

List of unknown files in the database

=====================================

file name : /u05/oracle/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2uqfbpgm_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak

 

Are you sure you want to list the above files ( Input YES or NO)? yes

Cataloguing the files ...

The catalogue is complete

 

A list of files that have been cataloged

=======================

file name : /u05/oracle/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2uqfbpgm_1_1.bak

file name : /u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak

 

Two 、  Restore the backup database

 

RMAN> recover DATABASE noredo;

 

start-up recover On 2015-08-23 22:37:12

Use channel ORA_DISK_1

passageway ORA_DISK_1: Starting restore of incremental data file backup set

passageway ORA_DISK_1: Specifying data files to restore from backup set

Data files 00002 Restore target for : /u01/app/oracle/oradata/oradgphy/sysaux01.dbf

Data files 00004 Restore target for : /u01/app/oracle/oradata/oradgphy/users01.dbf

Data files 00006 Restore target for : /u01/app/oracle/oradata/oradgphy/logmnrtbs1.dbf

passageway ORA_DISK_1: Reading backup fragment /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak

passageway ORA_DISK_1: Segment handle = /u05/oracle/oracle_bk/ORADG11G/standby_ORADG11G_20150823_2sqfbp7a_1_1.bak Mark = FOR STANDBY

passageway ORA_DISK_1: The backup fragment has been restored 1

passageway ORA_DISK_1: Restore complete , when : 00:00:01

passageway ORA_DISK_1: Starting restore of incremental data file backup set

passageway ORA_DISK_1: Specifying data files to restore from backup set

Data files 00001 Restore target for : /u01/app/oracle/oradata/oradgphy/system01.dbf

Data files 00003 Restore target for : /u01/app/oracle/oradata/oradgphy/undotbs01.dbf

Data files 00005 Restore target for : /u01/app/oracle/oradata/oradgphy/example01.dbf

passageway ORA_DISK_1: Reading backup fragment /u05/oracle/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak

passageway ORA_DISK_1: Segment handle = /u05/oracle/standby_ORADG11G_20150823_2rqfbp7a_1_1.bak Mark = FOR STANDBY

passageway ORA_DISK_1: The backup fragment has been restored 1

passageway ORA_DISK_1: Restore complete , when : 00:00:03

 

complete recover On 2015-08-23 22:37:16

 

RMAN>

 

Alarm log :

Sun Aug 23 22:37:12 2015

Incremental restore complete of datafile 4 /u01/app/oracle/oradata/oradgphy/users01.dbf

  checkpoint is 2245592

  last deallocation scn is 3

Incremental restore complete of datafile 6 /u01/app/oracle/oradata/oradgphy/logmnrtbs1.dbf

  checkpoint is 2245592

Incremental restore complete of datafile 2 /u01/app/oracle/oradata/oradgphy/sysaux01.dbf

  checkpoint is 2245592

  last deallocation scn is 995211

Incremental restore complete of datafile 3 /u01/app/oracle/oradata/oradgphy/undotbs01.dbf

  checkpoint is 2245591

  last deallocation scn is 3

Incremental restore complete of datafile 5 /u01/app/oracle/oradata/oradgphy/example01.dbf

  checkpoint is 2245591

  last deallocation scn is 1015098

Incremental restore complete of datafile 1 /u01/app/oracle/oradata/oradgphy/system01.dbf

  checkpoint is 2245591

  last deallocation scn is 993074

3、 ... and 、  The standby library is applied redo

 

[oracle@rhel6_lhr ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Sunday 8 month 23 22:39:48 2015

 

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

 

 

Connect to :

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

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

 

22:39:48 SQL> col name for a100

22:40:29 SQL> set linesize 9999  pagesize 9999

22:40:29 SQL> SELECT dest_id,

22:40:29   2         THREAD#,

22:40:29   3         NAME,

22:40:29   4         sequence#,

22:40:29   5         archived,

22:40:29   6         applied,

22:40:29   7         a.NEXT_CHANGE#

22:40:29   8  FROM   v$archived_log a

22:40:29   9  WHERE  a.sequence# >= 40

22:40:29  10  AND    resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

22:40:29  11  ORDER  BY a.THREAD#,

22:40:29  12            a.sequence#,

22:40:30  13    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_48_bxmc9189_.arc                  48 YES NO             2234642

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_49_bxmjnyj3_.arc                  49 YES NO             2241189

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_50_bxml3lv7_.arc                  50 YES NO             2241194

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_51_bxml3lrh_.arc                  51 YES NO             2241198

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_52_bxml3lqv_.arc                  52 YES NO             2241209

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_53_bxml3lz7_.arc                  53 YES NO             2241214

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_56_bxml3lz0_.arc                  56 YES NO             2241419

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_57_bxml3m03_.arc                  57 YES NO             2243353

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_58_bxmp464x_.arc                  58 YES NO             2248351

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_59_bxmpksob_.arc                  59 YES NO             2248782

 

Have chosen 10 That's ok .

 

Elapsed time :  00: 00: 00.01

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

 

The database has changed .

 

Elapsed time :  00: 00: 06.02

22:41:19 SQL> col name for a100

22:41:40 SQL> set linesize 9999  pagesize 9999

22:41:40 SQL> SELECT dest_id,

22:41:41   2         THREAD#,

22:41:41   3         NAME,

22:41:41   4         sequence#,

22:41:41   5         archived,

22:41:41   6         applied,

22:41:41   7         a.NEXT_CHANGE#

22:41:41   8  FROM   v$archived_log a

22:41:41   9  WHERE  a.sequence# >= 40

22:41:41  10  AND    resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

22:41:41  11  ORDER  BY a.THREAD#,

22:41:41  12            a.sequence#,

22:41:41  13    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_48_bxmc9189_.arc                  48 YES NO             2234642

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_49_bxmjnyj3_.arc                  49 YES NO             2241189

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_50_bxml3lv7_.arc                  50 YES NO             2241194

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_51_bxml3lrh_.arc                  51 YES NO             2241198

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_52_bxml3lqv_.arc                  52 YES NO             2241209

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_53_bxml3lz7_.arc                  53 YES NO             2241214

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_56_bxml3lz0_.arc                  56 YES NO             2241419

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_57_bxml3m03_.arc                  57 YES NO             2243353

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_58_bxmp464x_.arc                  58 YES YES            2248351

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_59_bxmpksob_.arc                  59 YES IN-MEMORY      2248782

 

Have chosen 10 That's ok .

 

Elapsed time :  00: 00: 00.00

22:41:41 SQL>

22:41:41 SQL> SELECT * FROM V$ARCHIVE_GAP;

 

No line selected

 

Elapsed time :  00: 00: 00.01

22:41:41 SQL>

 

Four 、  For the library read only  Mode on

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

 

The database has changed .

 

Elapsed time :  00: 00: 01.00

22:43:40 SQL> alter database open;

 

The database has changed .

 

Elapsed time :  00: 00: 00.22

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

 

 

The database has changed .

 

Elapsed time :  00: 00: 06.04

22:44:00 SQL> 22:44:00 SQL>

22:44:02 SQL> select * from lhr.testdg;

 

D

-

X

X

X

 

Elapsed time :  00: 00: 00.00

22:44:10 SQL>

One .4.2.5   Verification operation

Main library :

22:41:00 SQL> alter system switch logfile;

 

The system has changed .

 

Elapsed time :  00: 00: 00.01

22:45:14 SQL> insert into lhr.testdg select * from lhr.testdg;

 

Created 3 That's ok .

 

Elapsed time :  00: 00: 00.00

22:45:29 SQL> commit;

 

Submit completed .

 

Elapsed time :  00: 00: 00.01

22:45:32 SQL> select count(1) from lhr.testdg;

 

  COUNT(1)

----------

         6

 

Elapsed time :  00: 00: 00.00

22:45:42 SQL> archive log list;

Database logging mode             Archive Mode

Auto archive              Enable

End of archive             USE_DB_RECOVERY_FILE_DEST

The earliest online log sequence      59

Next archive log sequence    61

Current log sequence            61

22:46:03 SQL>

 

For the library :

 

22:46:54 SQL> col name for a100

22:47:13 SQL> set linesize 9999  pagesize 9999

22:47:13 SQL> SELECT dest_id,

22:47:13   2         THREAD#,

22:47:13   3         NAME,

22:47:13   4         sequence#,

22:47:13   5         archived,

22:47:13   6         applied,

22:47:13   7         a.NEXT_CHANGE#

22:47:13   8  FROM   v$archived_log a

22:47:13   9  WHERE  a.sequence# >= 50

22:47:13  10  AND    resetlogs_change# = (SELECT d.RESETLOGS_CHANGE# FROM v$database d)

22:47:13  11  ORDER  BY a.THREAD#,

22:47:13  12            a.sequence#,

22:47:13  13    a.dest_id;

 

   DEST_ID    THREAD# NAME                                                                                                  SEQUENCE# ARC APPLIED   NEXT_CHANGE#

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

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_50_bxml3lv7_.arc                  50 YES NO             2241194

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_51_bxml3lrh_.arc                  51 YES NO             2241198

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_52_bxml3lqv_.arc                  52 YES NO             2241209

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_53_bxml3lz7_.arc                  53 YES NO             2241214

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_56_bxml3lz0_.arc                  56 YES NO             2241419

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_57_bxml3m03_.arc                  57 YES NO             2243353

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_58_bxmp464x_.arc                  58 YES YES            2248351

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_59_bxmpksob_.arc                  59 YES YES            2248782

         1          1 /u01/app/oracle/flash_recovery_area/ORADGPHY/archivelog/2015_08_23/o1_mf_1_60_bxmq3tn7_.arc                  60 YES IN-MEMORY      2249391

 

Have chosen 9 That's ok .

 

Elapsed time :  00: 00: 00.00

22:47:13 SQL>

 

You can see that the primary and secondary libraries are normal .

One .4.2.6   Delete backup Library

 

If the backup doesn't work , You can now delete  

RMAN> DELETE BACKUP TAG 'FOR STANDBY';

 

 

 

One .4.3   Summary of the experiment

 

Last , We can see , In the main warehouse archivelog Lost, unable to synchronize to standby , You can take advantage of increments scn The way , To avoid rebuilding standby, Don't think it's over , Now that the archive is lost , The database should be fully prepared once .

 

 

One .5   summary

Conduct Dataguard  Maintenance is very common operation and maintenance requirements , In the actual scenario , We try to choose a safe and complete strategy to operate , Ensure that data is not lost .