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


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值