Dataguard主、备库切换方法总结

Dataguard主、备库切换方法总结

文章目录[隐藏]

一、主备切换:

1.将主库切换成物理standby:

alter database commit to switchover to physical standby with session shutdown;
startup mount;

2.备库执行切换成primary,完成后数据库是mount,需要open:

recover managed standby database cancel;
recover automatic standby database ;
RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
alter database commit to switchover to primary with session shutdown;
select status from v$instance;
startup;

3.打开新的备库(原主库)的归档应用:

alter database recover managed standby database using current logfile disconnect from session;

检查日志应用状态:

column name format a50;
set line 200;
SELECT thread#,sequence#,name,applied FROM v$archived_log order by sequence#;

4.验证切换后,归档应用是否正常:
新备库执行:

column name format a50;
set line 200;
SELECT thread#,sequence#,name,applied FROM v$archived_log order by sequence#;

5.检查切换后的主备库的角色:
新的主备库分别执行:

select switchover_status,database_role from v$database;

注意切换完成以后必须自行添加临时文件,当我们在Primary端添加一个临时表空间,Standby端虽然不能创建出临时文件,但是临时表空间的信息是联动的带入的

posted @ 2020-01-12 02:32  耀阳居士  阅读(1249)  评论(0编辑  收藏  举报