重庆思庄Oracle、Redhat认证学习论坛

标题: Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFIL... [打印本页]

作者: wangxu    时间: 2023-2-25 08:48
标题: Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFIL...
1、在搭建19c rac-pdb  -----》单机pdb完成后,按照11g的方式启动实时日志应用,执行了这个语句alter database recover managed standby database using current logfile disconnect from session
在alert.log里面看到了2行警告信息:2023-02-25T01:40:22.956824+08:00
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
alter database recover managed standby database using current logfile disconnect from session
2023-02-25T01:40:22.961078+08:00
Attempt to start background Managed Standby Recovery process (orclcdbdg)
Starting background process MRP0
2023-02-25T01:40:22.972103+08:00
MRP0 started with pid=89, OS id=30539
2023-02-25T01:40:22.972931+08:00
Background Managed Standby Recovery process started (orclcdbdg)
2023-02-25T01:40:27.990534+08:00
Started logmerger process
2023-02-25T01:40:27.996229+08:00

IM on ADG: Start of Empty Journal

IM on ADG: End of Empty Journal
PR00 (PID:30547): Managed Standby Recovery starting Real Time Apply   《《《《这里可以看到开启了实时恢复

注意:看has been deprecated.说明这个参数可能被废弃了,但是oracle还是向下进行了兼容,实时恢复并没有受到影响

2、通过查询资料发现在12c之后是使用如下的语句来实现:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;                                         --启用实时恢复
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING ARCHIVED LOGFILE DISCONNECT;  --如果是使用archivelog 方式同步(也就说不启用实时恢复)
再看看上面和11g启动实时恢复有什么不一样呢?就是using current logfile这里舍弃了,其它一样,disconnect 和 disconnect from session都是放后台操作;

3、我发出如下语句再观察alert日志
SQL> alter database recover managed standby database cancel;
SQL> alter database recover managed standby database disconnect;


在alert.log里面看到了2行警告信息:
2023-02-25T08:38:29.138639+08:00
Managed Standby Recovery Canceled (orclcdbdg)
Completed: alter database recover managed standby database cancel    <<取消恢复



2023-02-25T08:39:01.411460+08:00
alter database recover managed standby database disconnect             <<执行的启用实时恢复的语句
2023-02-25T08:39:01.413854+08:00
Attempt to start background Managed Standby Recovery process (orclcdbdg)
Starting background process MRP0
2023-02-25T08:39:01.425400+08:00
MRP0 started with pid=89, OS id=26801
2023-02-25T08:39:01.426250+08:00
Background Managed Standby Recovery process started (orclcdbdg)
2023-02-25T08:39:06.445084+08:00
Started logmerger process
2023-02-25T08:39:06.455955+08:00

IM on ADG: Start of Empty Journal

IM on ADG: End of Empty Journal
PR00 (PID:26807): Managed Standby Recovery starting Real Time Apply《《《《这里可以看到开启了实时恢复


4、总结
12c后可以看出命令更简单了,不需要向以前那样输入那么多就自动启动实时恢复功能;


11g 必须加using current logfile,才能启动实时恢复;不加就是使用archivelog日志恢复;
12c后,不需要加using current logfile就能启动实时恢复,如果要启动archivelog日志恢复是单独的语句:using archived logfile disconnect;






欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2