oracle Physical Standby failover step

 Performing a Failover to a Physical Standby Database

以下是failover步骤


Step 1   Flush any unsent redo from the primary database to the target standby database.


在主库运行以下命令

ALTER SYSTEM FLUSH REDO TO target_db_name

Step 2   Verify that the standby database has the most recently archived redo log file for each primary database redo thread.

查询V$ARCHIVED_LOG视图看最近的归档有没传送到备库

For example:

SQL> SELECT UNIQUE THREAD# AS THREAD, MAX(SEQUENCE#) -
OVER (PARTITION BY thread#) AS LAST from V$ARCHIVED_LOG;
    
THREAD       LAST
---------- ----------        
 1        100

如果没有应用,则手工应用

For example:

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1';

Step 3   Identify and resolve any archived redo log gaps.
查看有没丢失相关归档,然后手工注册

Query the V$ARCHIVE_GAP view on the target standby database to determine if there are any redo gaps on the target standby database.

For example:

SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP; THREAD#    LOW_SEQUENCE# HIGH_SEQUENCE#---------- ------------- --------------         1            90             92

For example:

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1';

Step 4   Repeat Step 3 until all gaps are resolved.

重复上面的检查

Step 5   Stop Redo Apply.

备库停止日志应用

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Step 6   Finish applying all received redo data.
备库完全日志应用

Issue the following SQL statement on the target standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

Step 7   Verify that the target standby database is ready to become a primary database.
检查相关状态

Query the SWITCHOVER_STATUS column of the V$DATABASE view on the target standby database.

For example:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS-----------------
TO PRIMARY1 row selected


Step 8   Switch the physical standby database to the primary role.

failover成主库

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

Note:

The WITH SESSION SHUTDOWN clause can be omitted from the switchover statement if the query of the SWITCHOVER_STATUS column performed in the previous step returned a value of TO PRIMARY.

Step 9   Open the new primary database.

SQL> ALTER DATABASE OPEN;
打开数据库

Step 10   Back up the new primary database.

Oracle recommends that a full backup be taken of the new primary database.

对打开的主库进行备份。


If the error condition cannot be resolved, a failover can still be performed (with some data loss) by issuing the following SQL statement on the target standby database:
如果有相关归档丢失等,则丢失部分数据,直接激活standby 数据库即可

SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-1966042/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7199859/viewspace-1966042/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值