Oracle Data Guard Concepts and Administration>
Oracle Data Guard Scenarios>
15.2.1 Flashing Back a Failed Primary Database into a Physical Standby Database
The following steps assume that a failover has been performed to a physical standby database and that Flashback Database was enabled on the old primary database at the time of the failover. This procedure brings the old primary database back into the Oracle Data Guard configuration as a physical standby database.
- Step 1 Determine the SCN at which the old standby database became the primary database.
-
On the new primary database, issue the following query to determine the SCN at which the old standby database became the new primary database:
SQL> SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN) FROM V$DATABASE;
- Step 2 Flash back the failed primary database.
-
Shut down the old primary database (if necessary), mount it, and flash it back to the value for
STANDBY_BECAME_PRIMARY_SCN
that was determined inStep 1.SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT; SQL> FLASHBACK DATABASE TO SCN standby_became_primary_scn;
- Step 3 Convert the database to a physical standby database.
-
Issue the following statement on the old primary database:
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
- Step 4 Start transporting redo to the new physical standby database.
-
Perform the following steps on the new primary database:
-
Issue the following query to see the current state of the archive destinations:
SQL> SELECT DEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION, - > ERROR,SRL FROM V$ARCHIVE_DEST_STATUS;
-
If necessary, enable the destination:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_n=ENABLE;
-
Perform a log switch to ensure the standby database begins receiving redo data from the new primary database, and verify it was sent successfully. Issue the following SQL statements on the new primary database:
SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> SELECT DEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION,- > ERROR,SRL FROM V$ARCHIVE_DEST_STATUS;
On the new standby database, you may also need to change the
LOG_ARCHIVE_DEST_
n
initialization parameters so that redo transport services do not transmit redo data to other databases.
-
- Step 5 Start Redo Apply on the new physical standby database.
-
Issue the following SQL statement on the new physical standby database:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
Redo Apply automatically stops each time it encounters a redo record that is generated as the result of a role transition, so Redo Apply will need to be restarted one or more times until it has applied beyond the SCN at which the new primary database became the primary database. Once the failed primary database is restored and is running in the standby role, you can optionally perform a switchover to transition the databases to their original (pre-failure) roles. See "Performing a Switchover to a Physical Standby Database" for more information.