Flashing Back a Failed Primary Database into a Physical Standby Database

來源:互聯網
上載者:User

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:xiangsir@hotmail.com

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.