使用dblink导致scn发现改变

联系:手机(13429648788)  QQ(107644445)

链接:https://www.orasos.com/%e4%bd%bf%e7%94%a8dblink%e5%af%bc%e8%87%b4scn%e5%8f%91%e7%8e%b0%e6%94%b9%e5%8f%98.html

标题:使用dblink导致scn发现改变

作者:惜分飞©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

1.dblink目标端

[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jan 21 15:25:59 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER scn from dual;

       SCN
----------
  17454270

SQL> select file#,CHECKPOINT_CHANGE# scn from v$datafile;

     FILE#        SCN
---------- ----------
         1   17454265
         2   17454265
         3   17454265
         4   17454265
         5   17454265
         6   17454265
         7   17454265
         8   17454265
         9   17454265
        10   17454265
        11   17454265

     FILE#        SCN
---------- ----------
        13   17454265
        14   17454265

13 rows selected.

通过这里可以知道,该数据库目前的scn是小于18000000。

2.dblink操作

[oracle@node1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jan 21 15:49:39 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER scn from dual;

       SCN
----------
  20359364

SQL> select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER scn from dual@chf;

       SCN
----------
  20359367

通过这步操作发现目标端的scn发生改变,和原端库scn一致(因为先后关系,有小出入)

3.再次查看dblink目标端

SQL>  alter system checkpoint;

System altered.

SQL> select file#,CHECKPOINT_CHANGE# scn from v$datafile;

     FILE#        SCN
---------- ----------
         1   20359409
         2   20359409
         3   20359409
         4   20359409
         5   20359409
         6   20359409
         7   20359409
         8   20359409
         9   20359409
        10   20359409
        11   20359409

     FILE#        SCN
---------- ----------
        13   20359409
        14   20359409

13 rows selected.

通过checkpoint之后,发现目标库的scn已经发现改变(向前推荐),从而证明使用dblink,确实使得scn小的库和scn大的库一致。