oracle dg failover

本文介绍了在OracleDataGuard环境中进行配置、监控、故障转移以及恢复操作的关键SQL命令,包括参数查看、数据库状态检查、立即故障切换、物理日志处理等,涵盖了从日常管理到紧急情况应对的过程。
摘要由CSDN通过智能技术生成

show parameter DG_BROKER_CONFIG_FILE1;
show parameter DG_BROKER_START;
select dbid,name,db_unique_name,log_mode,open_mode,database_role,activation#,switchover#,protection_mode,protection_level,checkpoint_change#,archive_change#
from v$database;

select status,DEST_ID,TYPE,ERROR,GAP_STATUS,SYNCHRONIZED,SYNCHRONIZATION_STATUS,RECOVERY_MODE from V$ARCHIVE_DEST_STATUS where STatus <> ‘INACTIVE’;

Standby:
SELECT name, value, datum_time, time_computed FROM V$DATAGUARD_STATS;

Dev:
dgmgrl sys/Ora***** as sysdba
DGMGRL> show configuration;

Prod:
dgmgrl sys/Ora*****@dbnamep_2288 as sysdba

dgmgrl sys/Ora******@dbnamep_2289 as sysdba

DGMGRL> FAILOVER TO dbnamep_2289;

Specify the optional IMMEDIATE clause to perform an immediate failover if any of the following conditions are true:
• An ORA-752 error has occurred at the standby database
• An ORA-600 [3020] error has occurred at the standby database and Oracle support has determined that it was caused by a lost write at the primary database
• A complete failover is not possible
DGMGRL> FAILOVER TO database-name IMMEDIATE;

手动操作
If the primary database can be mounted, it may be possible to flush any unsent redo data from the primary database to the target standby database using the ALTER SYSTEM FLUSH REDO;
SQL> ALTER SYSTEM FLUSH REDO TO target_db_name;

SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#


     1            90             92

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE ‘filespec1’;

Failover:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE FAILOVER TO target_db_name;
SQL> ALTER DATABASE OPEN;
If Redo Apply has stopped at any of the other physical standby databases in your Data Guard configuration, then restart it
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

–error
error occurs, use the FORCE option
SQL> ALTER DATABASE FAILVOVER TO xxxxxx FORCE;
If the FORCE option is unsuccessful, Perform a data loss failover.
SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
SQL> ALTER DATABASE OPEN;

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值