使用flashback 同步logical dataguard数据库

我们在使用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博客 ” ,链接:http://blog.itpub.net/8135069/viewspace-624830/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8135069/viewspace-624830/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值