Flashback in a Data Guard Environment but what are the steps

The Setup of an Data Guard environment with Physical Standby via Data Guard Broker was done including an Switchover. Everything fine and works as expected. (Oracle Release is and PSU Jan 2017).

The Dev Team asked for a Flashback Database if possible a few days ago. Okay no problem. But what do I have to do exactly.

What are the steps to do? ( The requested timestamp for Flashback on the Primary DB is „07.09.2017 17:15“ )

Stop Apply on the Standby

DGMGRL> connect sys@gtdb10_11_DG
Connected as SYSDBA.
DGMGRL> edit database gtdb10_11 set state='APPLY-OFF';

To get the Primary easily after the Flashback in Sync with the Standby you need to flashback the Standby a short time before you flashback the Primary.

Primary =   „07.09.2017 17:15“

Standby =  „07.09.2017 17:00“

sqlplus / as sysdba

flashback standby DATABASE TO TIMESTAMP(to_date('07.09.2017 17:00','dd.mm.yyyy hh24:mi'))

Now to the Primary Database and I describe the easiest way

srvctl stop db -d gtdb10_12
sqlplus / as sysdba
SQL*Plus: Release Production on Mon Sep 11 13:12:32 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount

SQL> flashback DATABASE TO TIMESTAMP(to_date( '07.09.2017 17:15','dd.mm.yyyy hh24:mi'))

After Flashback the Primary open the DB with resetlogs

SQL> alter database open resetlogs;

# Stop the mounted database
SQL> shutdown immediate

# Restart the Primary
srvctl start db -d gtdb10_12

Flashback done

# Now I restarted the Standby is normally not needed
srvctl stop db -d gtdb10_11
srvctl start db -d gtdb10_11

# Start the Apply on the Standby Database
DGMGRL> connect sys@gtdb10_11_DG
Connected as SYSDBA.
DGMGRL> edit database gtdb10_11 set state='APPLY-ON';

The Dev Team can go on :-)


Important is that you have to start with Flashback on the Standby Site not on the Primary Site. Otherwise you need to recreate the whole Standby Database and that could be very time intensiv by having the risk that you work without a Physical Database during the Setup. Also the Switchover has to be redone because whole Standby Database was newly created.

Restore Points

If you work with „restore points“ than keep also in mind that you create the first restore point on the Standby Database and then the Restore Point on the Primary Site.









Problems with Adaptive Features in What’s to do?

The Adaptive Features is divided in two parts

  • Adaptive Plans
    • the possibility to change plans during execution
  • Adaptive Statistics
    • the statistics allow plans to be built from the results of previous executions

Version 12.1 

In 12.1 both components  will be managed by the parameter „optimizer_features_enable“ and is per default on „TRUE“.

Version 12.2

In 12.2 the parameter „optimizer_features_enable“ obsolete. The adaptive feature is now controlled by two parameters

  • optimizer_adaptive_statistics default „FALSE“
  • optimizer_adaptive_plans default „TRUE“

What are the recommendation for if you do a upgrade. You should directly adopt the 12.2 default  by applying the following Patches:

  • Patch 22652097 splits the parameter optimizer_adaptive_features into two, as above, and disables adaptive statistics.
  • Patch 21171382 disables the automatic creation of extended statistics unless the optimizer preference AUTO_STAT_EXTENSIONS is set to ON.


If you Upgrade to 12.1..2 set directly the Default for Oracle 12.2.

Yes, the next Upgrade to Release 12.2 came sooner or later.