ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 使用flashback 同步logical dataguard数据库

使用flashback 同步logical dataguard数据库

原创 Linux操作系统 作者:lijiebin 时间:2010-01-11 10:17:46 0 删除 编辑

我们在使用logical dataguard 时候,standby 机器容易出现问题

我们经常采用

insert  into test1 select * from test1@db_link as of scn xxx;

这个xxx是applied_scn 还是applied_scn+1 呢

大部分情况applied_scn 和applied_scn+1 的数据是一致的,但是比较繁忙的系统,这两部分数据则不一致

做个试验来证明:

主库:

SQL> select count(*) from test1;

  COUNT(*)
----------
     10000

从库:

SQL> select count(*) from test1;

  COUNT(*)
----------
      3508

当前applied_scn

SQL>  select applied_scn from v$logstdby_progress;

APPLIED_SCN
-----------
    4677895

 

SQL>  select count(*) from test1@devdb  as of scn 4677895;

  COUNT(*)
----------
      3507

SQL>  select count(*) from test1@devdb  as of scn 4677896;

  COUNT(*)
----------
      3508

 

我们开始的scn 应该为applied_scn+1,而不是applied_scn

从库:

SQL> truncate table test1;

Table truncated.

SQL> insert into test1 select * from test1@devdb  as of scn 4677896;

3508 rows created.

开启apply

 alter database start  logical standby apply immediate;

SQL> select count(*) from test1;

  COUNT(*)
----------
     10000

两边数据完全一致,所以我们要同步到scn+1

 

 

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8135069/viewspace-624830/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle 锁的研究二
下一篇: mysql 升级
请登录后发表评论 登录
全部评论

注册时间:2008-01-10

  • 博文量
    145
  • 访问量
    177218