Oracle DG switchover

Oracle DG switchover
(12C以上)

  1. 检查DB状态

show parameter db_unique_name;
show parameter log_Archive_dest;
show parameter log_file_name_convert;

select ts#,name,ts#,status from v$tempfile;

SELECT thread#, instance, status FROM v$thread;

select name,role,instance,thread#,sequence#,action from gv$dataguard_process;

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’;

如有异常 可以打开跟踪日志用于故障诊断 主从都开(默认不用)
–alter system set log_archive_trace=8191 sid=’*’;
–show parameter background_dump_dest;

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

检查当前会话 ,没应用连接

select i.instance_name,i.host_name,s.inst_id,sid,s.serial#,s.username,s.status,action,schemaname,osuser,process,blocking_session
from gv s e s s i o n s , g v session s, gv sessions,gvinstance i
where s.inst_id=i.inst_id
and s.username is not null
and s.status =‘ACTIVE’;

insert into t1(id) values(3);
select * from t1;

DG broker 核对状态

  1. 切换检查
    alter database switchover to dbname_2289 verify;

  2. 无异常 执行切换
    alter database switchover to dbname_2289;

BDUMP下查看日志
alert_dbname_2288.log, alert_dbname_2289.log

NAME TYPE VALUE


background_dump_dest string D:\ORACLE\12201\RDBMS\TRACE

日志中看切换过程:

Starting switchover
……
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY
……
ALTER DATABASE SWITCHOVER TO PRIMARY

  1. Open the new primary database
    dbname_2289
    SQL>alter database open;

  2. 重启 new standby
    dbname_2288
    SQL>shut abort
    SQL>startup
    SQL>alter database recover managed standby database disconnect;

  3. 检查DG状态

select DB_UNIQUE_NAME,DATABASE_ROLE from v$database;

如果之前打开过跟踪日志,现在可以关闭
alter system set log_archive_trace=0;

primary:
alter system switch logfile;

select dest_id,error,status from vKaTeX parse error: Expected 'EOF', got '#' at position 57: …ct max(sequence#̲),thread# from …log_history group by thread#;
select name,role,instance,thread#,sequence#,action from gv$dataguard_process;

standby :
select max(sequence#),thread# from vKaTeX parse error: Expected 'EOF', got '#' at position 29: …group by thread#̲; select name,r…dataguard_process;
SELECT name, value, datum_time, time_computed FROM V$DATAGUARD_STATS;

(老版本查看方式,12.2以后不用)
–select thread#,sequence#,process,status from gv$managed_standby; // deprecated in Oracle 12.2

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值