Flashing Back a Failed Primary Database into a Physical Standby Database

The following steps assume that a failover has been performed to aphysical standby database and that Flashback Database was enabled on the oldprimary database at the time of the failover. This procedure brings the oldprimary database back into the Data Guard configuration as a physical standbydatabase.

 

Step 1   Determine theSCN at which the old standby database became the primary database.

 

On the new primary database, issue the following query to determinethe SCN at which the old standby database became the new primary database:

 

SQL>  SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)FROM V$DATABASE;

 

TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)

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

1095159

 

Step 2   Flash backthe failed primary database.

Shut down the old primary database (if necessary), mountit, and flash it back to the value for STANDBY_BECAME_PRIMARY_SCN that wasdetermined in Step1.

SQL> shutdownimmediate;

SQL> STARTUPMOUNT;

SQL> FLASHBACKDATABASE TO SCN 1095159;

 

Step 3   Convert thedatabase to a physical standby database.

Perform the following steps on the old primary database:

  1. Issue the following statement on the old primary database:

SQL> ALTERDATABASE CONVERT TO PHYSICAL STANDBY;

Database altered.

 

This statement will dismount the database after successfullyconverting the control file to a standby control file.

 

  1. Shut down and restart the database:

SQL>shutdown immediate;

SQL>startup mount;

 

Step 4   Starttransporting redo to the new physical standby database.

Perform the following steps on the new primary database:

  1. Issue the following query to see the current state of the archive destinations:

SQL> col ERRORfor a20

SQL> colDESTINATION for a20

SQL> colDEST_NAME for a20

SQL> SELECTDEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION,ERROR,SRL FROMV$ARCHIVE_DEST_STATUS;

 

  1. If necessary, enable the destination:

SQL> ALTER SYSTEMSET LOG_ARCHIVE_DEST_STATE_n=ENABLE;

 

  1. 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> SELECTDEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION,ERROR,SRL FROMV$ARCHIVE_DEST_STATUS;

 

Step 5   Start RedoApply on the new physical standby database.

Issue the following SQL statement on the new physical standbydatabase:

 

SQL> alterdatabase recover managed standby database using current logfile disconnect fromsession;

 

Redo Apply automatically stops each time it encounters a redo recordthat is generated as the result of a role transition, so Redo Apply will needto be restarted one or more times until it has applied beyond the SCN at whichthe new primary database became the primary database. Once the failed primarydatabase is restored and is running in the standby role, you can optionallyperform a switchover to transition the databases to their original(pre-failure) roles.



转载请注明作者出处及原文链接,否则将追究法律责任:

作者:xiangsir

原文链接:http://blog.csdn.net/xiangsir/article/details/9206877

QQ:444367417

MSN:[email protected]


 

你可能感兴趣的:(oracle,primary,failed,Data,flashback,11g,standby,Physical,guard)