验证主库是否能执行角色转换到备库 原主库执行
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS ----------------- TO STANDBY 1 row selected
开始把物理主库改变为物理备库 在原主库执行。
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY; 或 SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY with session shutdown;
关闭并重启主库(原主库执行)
SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT;
验证备库是否能执行角色转换到主库(原备库执行)
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS ----------------- TO_PRIMARY 1 row selected
开始把物理备库转换成物理主库(原备库执行)
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
如果报ORA-16139: media recovery required,可能是由于未应用日志引起,可先执行 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
打开备库,然后关闭重启.(原备库执行)
SQL> ALTER DATABASE OPEN; SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP;
验证是否转换成功(原备库执行)
SQL> ALTER SYSTEM SWITCH LOGFILE;
应用归档日志(原主库上执行)
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; --非实时应用日志,此为应用归档日志
4.1 ORACLE DATAGUARD SWITCHOVER 步骤
原文:https://www.cnblogs.com/halberd-lee/p/10639088.html