• GoldenGate中使用 exp/imp 进行初始化


    使用数据泵工具 exp/imp 进行初始化步骤大致如下:
    1. 配置同步的 Change Extract 和 Change Replicat 进程。
    2. 启动 Change Extract 进程,捕捉改变的数据。
    3. 用带有 flashback_scn 的 exp/imp 或者 exp/imp 迁移数据。
    4. 迁移结束后启动 Change Replicat, 完成数据同步。

    一、准备工作
    在目标端数据库 truncate 要初始化同步的表 send.t1:
    $sqlplus /nolog
    SQL>conn send/send
    SQL>truncate table t1;
    SQL>select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual;

    二、添加 Change Extract/Change Replicat 进程
    这里沿用之前配置好的源端的 ext0, pmp01 以及目标端的 rep01 进程。
    注意:目标端的抽取进程和传输进程要处于 RUNNING, 而复制进程要处于 stop 状态。
    检查源端的进程状态:
    GGSCI (udbs01) 11> info all
    检查目标端的进程状态:
    GGSCI (udbs01) 9> info all
    发现目标端的 rep01 复制进程为 RUNNING 状态,必须先停止 rep01 进程
    GGSCI (udbs01) 10> stop replicat rep01

    三、用带 flashback_scn 的 exp/imp 完成初始化
    1. 在源端数据库查询当前的 SCN
    SQL>show parameter db_name;
    SQL>select current_scn from v$database;
    2. 在源端导出 send.t1 表的数据
    $ exp system/oracleU@oracle tables=send.t_ file=/home/oracle/t.dmp FLASHBACK_SCN=
     log=/home/oracle/t.log
    3. 源端删除 send.t1 表的部分数据
    SQL>deelct from t where rowwnum<500;
    SQL>commit;
    SQL>select current_scn from v$database;
    SQL>seelct count(*) from t1;
    4. 将源端 t1 表的 dump 文件 scp 到目标端
    $ scp t1.dmp udbs02:/home/oracle
    5. 在目标端使用 imp 倒入 t1.dump 文件
    $ imp system/oracle_4U@orclb file=/home/oracle/t1.dmp log=/home/oracle/t1.log fromuser=send touser=send ignore=y
    6. 在目标端用 SCN 启动 Replicat 进程
    GGSCI (udbs02) 12>start replicat rep01, aftercsn 1286162
    GGSCI (udbs02) 13> info all
    GGSCI (udbs02) 14>info replicat rep01

    四、数据验证
    在源端:
    $ sqlplus send/send@orcla
    SQL>seelct count(*) from t1;
    在目标端:
    $ sqlplus send/send@orclb
    SQL>seelct count(*) from t1;

  • 相关阅读:
    瞅一瞅JUC提供的限流工具Semaphore
    Android学习笔记 43. RX思维的魅力
    多线程03:线程传参详解
    燕之屋通过港交所聆讯:苦战IPO十余年,黄健等人提前精准套现
    如何制定测试团队度量体系
    MyBatis的映射器语法
    Docker部署Tomcat及Web应用
    Spring源码深度解析(六):Spring事务原理详解
    ATF启动(四):BL31
    【毕业设计】基于单片机的无接触测温枪 - MLX90614 红外测温仪 嵌入式 物联网 stm32
  • 原文地址:https://blog.csdn.net/qq_50730941/article/details/126273032