导读
本文介绍Oracle 12c dataguard在维护方面的新变化
前提:主库备库的同步是正常的。
1、主库上查看archive Log list
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
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来查看。
##主库查看:
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>
##备库查看:
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视图联合查询即可查看到主备库是否同步了。