查看备用数据库状态
select database_role,switchover_status,protection_mode,open_mode from v$database;
停止日志应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
开启归档应用,redo应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
查看MRP进程的状态
select process,status,GROUP#,thread#,sequence# from v$managed_standby;
( 如果不使用USING CURRENT LOGFILE 则MRP0 的状态STATUS 为 " WAIT_FOR_LOG " , 如果主库不切日志,那么备库最后一个文件APPLIED一直为no,APPLY LAG 的value 值也会有应用滞后时间,但是传输transport lag 是同时的。想要使用using current logfile ,使用命令开启日志应用后,如果还无法apply,那么去主库切换日志即可。)
查看备库丢失了日志多长时间,或还没有应用多长时间的日志
set linesize 200
col name for a30
col value for a30
select name,value,datum_time,time_computed from v$dataguard_stats;
查看归档日志,哪些没被应用和正在应用的。
set linesize 180
col name for a90
select dest_id,name,thread#,sequence#,applied from v$archived_log where name !='NULL' and applied !='YES' order by sequence#;