用TNSPING 对方是否通。 6、修改备库处于应用归档状态 alter database recover managed standby database disconnect from session;
如果主库从不过来归档,可以通过在主库侧手工修改参数如下: ALTER SYSTEM SET log_archive_dest_state_2='DEFER' SCOPE=MEMORY; ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY;
7、测试 通过在主库执行alter system switch logfile;切换日志可以观察到备库会自动应用通过主库传过来的日志。
三、切换测试 1、在主库端 select switchover_stats from v$database; 如果是to standby 表可以正常切换. 直接执行 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY; 否则执行: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
shutdown immediate; startup nomount; alter database mount standby database;
2、在备库
在备库 SELECT SWITCHOVER_STATUS FROM V$DATABASE; 如果是to_primary 表可以正常切换. 执行:ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY; 否则执行: ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;