Oracle 12c dataguard查看主备库同步情况的新变化

导读

本文介绍Oracle 12c dataguard在维护方面的新变化

前提:主库备库的同步是正常的。

1、主库上查看archive Log list

bash 复制代码
SYS@cdb1> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /oradata/arch
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SYS@cdb1>

2、备库上查看archive log list

bash 复制代码
SYS@cdb1dg> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /oradata/arch
Oldest online log sequence     0
Next log sequence to archive   0
Current log sequence           0
SYS@cdb1dg>

主库和备库同步正常,可以正常切换,切换后,发现新的备库的archive Log list显示全部是0 。

3、解决方法

查看官方文档《Archive Log List Showing 0 At Standby, But Standby Is Completely In Sync With Primary! (文档 ID 2041137.1)》,根据官方文档提示,Oracle12c版本中的dataguard不需要用archive log list查看,要用下面的SQL来查看。

bash 复制代码
##主库查看:

SYS@cdb1> select thread#, max(sequence#) 
  2  from v$archived_log a, v$database b
  3  where a.resetlogs_change# = b.resetlogs_change#
  4  group by thread# order by 1;

   THREAD# max(sequence#)
---------- --------------------------
         1                        130


SYS@cdb1> select thread#, max(sequence#) 
  2  from v$archived_log a, v$database b
  3  where a.resetlogs_change# = b.resetlogs_change#
  4  and a.applied in ('YES','IN-MEMORY')
  5  group by thread# order by 1;

   THREAD# max(sequence#)
---------- ------------------------
         1                      130

SYS@cdb1>
bash 复制代码
##备库查看:

SYS@cdb1dg> select thread#, max(sequence#) 
  2  from v$archived_log a, v$database b
  3  where a.resetlogs_change# = b.resetlogs_change#
  4  group by thread# order by 1;

   THREAD# max(sequence#)
---------- --------------------------
         1                        130

SYS@cdb1dg> select thread#, max(sequence#) 
  2  from v$archived_log a, v$database b
  3  where a.resetlogs_change# = b.resetlogs_change#
  4  and a.applied in ('YES','IN-MEMORY')
  5  group by thread# order by 1;

   THREAD# max(sequence#)
---------- ------------------------
         1                      130

SYS@cdb1dg>

通过v a r c h i v e d l o g 与 v archived_log与v archivedlog与vdatabase视图联合查询即可查看到主备库是否同步了。

相关推荐
先吃饱再说10 小时前
存储的进化:从 MySQL 到浏览器缓存,数据到底住在哪?
数据库
Nturmoils10 小时前
字段太多看不全,ksql 的展开模式和输出控制怎么用
数据库·后端
Databend12 小时前
Agent 轨迹分析与归因的数据工程实践
大数据·数据库·agent
这个DBA有点耶12 小时前
SQL改写进阶:标量子查询的“隐形代价”与消除实战
数据库·mysql·架构
smallyoung14 小时前
数据库乐观锁深度解析:MySQL、PostgreSQL 实战 + Spring Boot 集成指南
数据库·mysql·postgresql
parade岁月14 小时前
MySQL JOIN解析:朴实无华但食之有味
数据库·后端
用户31693538118314 小时前
MySQL服务无法启动问题解决全记录
数据库
vivo互联网技术18 小时前
从 10 分钟到 1 秒:ES 深度分页任意跳页的三轮优化实战
服务器·数据库·redis·elasticsearch·深度分页
倔强的石头_1 天前
《Kingbase护城河》——猎捕慢查询:执行计划的微观解析与索引调优实战
数据库
SelectDB1 天前
Apache Doris Python UDF:让 SQL 直接调用 Python 生态,支撑 Agent 时代复杂业务逻辑
大数据·数据库·python