千家信息网

oracle dataguard常用sql语句

发表于:2024-11-11 作者:千家信息网编辑
千家信息网最后更新 2024年11月11日,select log_mode,open_mode ,database_role from v$database; --查看dataguard主备库状态select status from v$ins
千家信息网最后更新 2024年11月11日oracle dataguard常用sql语句
select log_mode,open_mode ,database_role from v$database; --查看dataguard主备库状态select status from v$instance; --查看数据库状态alter database recover managed standby database cancel; --取消日志应用alter database recover managed standby database using current logfile disconnect;--备库开启实时应用select sequence#,applied from v$archived_log order by sequence#; --备库若全为yes 则表明standby库已经实时复制了alter database recover managed standby database disconnect from session;--备库mount应用日志alter  system switch logfile;--主库切换日志--启停dg主库alter system set log_archive_dest_state_2 = 'defer';lsnrctl stopshutdown immediatestartupalter system set log_archive_dest_state_2 = 'enable';--备库停止alter database recover managed standby database cancel;shutdown immediate--备库开启startup mount --启动到mount状态alter database recover managed standby database disconnect from session; --启动日志应用主备执行archive log list 看是否同步,备库可执行select * from v$archive_gap;看是否有延时alter  system switch logfile;--主库执行切换日志,看备库是否及时应用日志同步成功后,备库执行ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;--取消日志应用alter database open;--将备库打开alter database recover managed standby database using current logfile disconnect;--备库开启实时应用select log_mode,open_mode ,database_role from v$database;--检查备库状态


0