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视图联合查询即可查看到主备库是否同步了。

相关推荐
GreatSQL1 小时前
MySQL迁移至GreatSQL后,timestamp字段插入报错解析
数据库
expect7g2 小时前
COW、MOR、MOW
大数据·数据库·后端
DemonAvenger4 小时前
MySQL海量数据快速导入导出技巧:从实战到优化
数据库·mysql·性能优化
lunz_fly199219 小时前
Oracle清理:如何安全删除trace, alert和archivelog文件?
oracle
薛定谔的算法20 小时前
phoneGPT:构建专业领域的检索增强型智能问答系统
前端·数据库·后端
Databend1 天前
Databend 亮相 RustChinaConf 2025,分享基于 Rust 构建商业化数仓平台的探索
数据库
得物技术1 天前
破解gh-ost变更导致MySQL表膨胀之谜|得物技术
数据库·后端·mysql
Raymond运维1 天前
MariaDB源码编译安装(二)
运维·数据库·mariadb
沢田纲吉1 天前
🗄️ MySQL 表操作全面指南
数据库·后端·mysql
RestCloud2 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api