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 stop
shutdown immediate
startup
alter 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;--检查备库状态
网页标题:oracledataguard常用sql语句
URL标题:
http://cdweb.net/article/gjgdhh.html