问题起源于客户的一个12c的数据库,需要启动到非real time apply的模式,但是发现执行:
alter database recover managed standby database cancel;
alter database recover managed standby database disconnect from session;
之后,数据库还是一直工作在real time apply的模式。
去alertlog中找了一下,发现了答案:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
Thu Jun 09 12:16:03 2016 Errors in file /cust/mydb/rdbms/oracle/diag/rdbms/rmydb/mydb/trace/mydb_pr00_24168.trc: ORA-16037: user requested cancel of managed recovery operation Thu Jun 09 12:16:03 2016 MRP0: Background Media Recovery process shutdown (mydb) Thu Jun 09 12:16:04 2016 Managed Standby Recovery Canceled (mydb) Completed: alter database recover managed standby database cancel alter database recover managed standby database disconnect from session <==我们平时的发起语句 Thu Jun 09 12:16:13 2016 Attempt to start background Managed Standby Recovery process (mydb) Starting background process MRP0 Thu Jun 09 12:16:13 2016 MRP0 started with pid=27, OS id=17971 Thu Jun 09 12:16:13 2016 MRP0: Background Managed Standby Recovery process started (mydb) Thu Jun 09 12:16:19 2016 Started logmerger process Thu Jun 09 12:16:19 2016 Managed Standby Recovery starting Real Time Apply <==使用了real time apply,而上述语句在11g中的效果是使用real time apply,在12c中行为发生了变化。 Thu Jun 09 12:17:06 2016 Only allocated 127 recovery slaves (requested 128) Thu Jun 09 12:17:06 2016 Parallel Media Recovery started with 127 slaves Thu Jun 09 12:17:12 2016 Waiting for all non-current ORLs to be archived... Thu Jun 09 12:17:12 2016 Wed Apr 27 14:56:52 2016 MRP0: Background Media Recovery process shutdown (mydb) Wed Apr 27 14:56:53 2016 Managed Standby Recovery Canceled (mydb) Completed: alter database recover managed standby database cancel alter database recover managed standby database parallel 16 USING ARCHIVED LOGFILE disconnect <== 使用using archived log Wed Apr 27 14:57:29 2016 Attempt to start background Managed Standby Recovery process (mydb) Starting background process MRP0 Wed Apr 27 14:57:29 2016 MRP0 started with pid=27, OS id=23908 Wed Apr 27 14:57:29 2016 MRP0: Background Managed Standby Recovery process started (mydb) Started logmerger process Wed Apr 27 14:57:35 2016 Managed Standby Recovery not using Real Time Apply <==可以看到,不使用real time apply了! Wed Apr 27 14:57:38 2016 Parallel Media Recovery started with 16 slaves Wed Apr 27 14:57:38 2016 Waiting for all non-current ORLs to be archived... Wed Apr 27 14:57:38 2016 All non-current ORLs have been archived. Wed Apr 27 14:57:39 2016 Media Recovery Waiting for thread 1 sequence 2287 (in transit) Completed: alter database recover managed standby database parallel 16 USING ARCHIVED LOGFILE disconnect |
同时,在在线文档也发现了相关说明:
即using current logfile 已经过期,如果要启用real time apply,不再需要加这个语句。(所以我们无论加了using current logfile,还是不加,都是使用real time apply的。)
要使用非real time apply,就需要使用using archived log了。
综上:
在11g中,如要使用real time apply,需要加using current logfile,
在12c中,如果要不使用real time apply,需要加using archived log,using current logfile已经过期作废。
不带using语句,在11g中,默认是不使用real time apply,而在12c中是默认使用real time apply。