--查看主备库的切换状态
set linesize 200
select name,log_mode,open_mode,database_role,protection_mode,switchover_status from v$database;
--查看归档日志
archive log list;
select thread#,sequence#,first_time,next_time,applied from v$archived_log where thread#=1 order by 4;
select thread#,sequence#,first_time,next_time,applied from v$archived_log where thread#=2 order by 4;
--日志接收延迟
select value from v$dataguard_stats where name='transport lag';
--日志应用延迟
select value from v$dataguard_stats where name='apply lag';
--主库切换
shutdown immediate;(2)
alter database commit to switchover to physical standby with session stutdown;
--备库切换
alter database commit to switchover to primary;
shutdown immediate;
startup
--应用日志
startup
recover managed standby database using current logfile disconnect from session;
————————————————————————————————————————————————————————————
本人主要从事架构优化、系统建设、系统运维等方面的工作,专注于Oracle、Mysql、Redis、PG、OGG等技术和系统建设、运维、优化,欢迎留言或者微信(deadknight9)交流,转载请注明出处。