GoldenGate downstream归档模式抽取介绍

1. 说明

前面我介绍了GoldenGate downstream的架构,并且实验了下实时抽取模式,参考:GoldenGate downstream方式实时抽取介绍
这里介绍一下downstream的归档模式。
使用downstream的归档模式抽取方式,可以在downstream库上对多个source库进行抽取。

2.环境准备

role host version db_name db_unique_name arch
source test1 12.1.0.2 t12c t12c yes
downstream test2 12.1.0.2 s12c s12c yes

3. 配置日志传输服务

3.1 准备tnsnames

  • 在source上配置日志传输服务到downstream库
  • 在source的tnsnames.ora文件中添加:

    S12C =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = test2)(PORT = 1621))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = s12c)
        )
      )
    

    3.2 重建口令文件

    downstream库重建口令文件,注意ignorecase参数

    $ orapwd password=ora_1234 file=orapws12c ignorecase=y
    

    3.3 downstream库配置归档参数

    SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/data/oracle/arch VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE)';
    SQL> alter system set log_archive_config = 'RECEIVE';
    

    这里任意库都可以向downstream传输归档,如果要指定某个库可以向downstream传输,可以设置

    SQL> alter system set log_archive_config = 'DG_CONFIG=(t12c,p12c,......)';
    

    如果在downstream库上不设置该参数,会导致如下错误:

    Fri Mar 03 16:49:53 2017
    ******************************************************************
    TT01: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
    ******************************************************************
    Fri Mar 03 16:49:53 2017
    ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=BOTH;
    Fri Mar 03 16:49:53 2017
    Errors in file /data/oracle/diag/rdbms/t12c/t12c/trace/t12c_arc1_7248.trc:
    ORA-16047: DGID mismatch between destination setting and target database
    Fri Mar 03 16:49:53 2017
    PING[ARC1]: Heartbeat failed to connect to standby 's12c'. Error is 16047.
    Fri Mar 03 16:49:53 2017
    Errors in file /data/oracle/diag/rdbms/t12c/t12c/trace/t12c_tt01_7752.trc:
    ORA-16047: DGID mismatch between destination setting and target database
    Fri Mar 03 16:49:53 2017
    Error 16047 for archive log file 3 to 's12c'
    Fri Mar 03 16:49:53 2017
    Errors in file /data/oracle/diag/rdbms/t12c/t12c/trace/t12c_tt01_7752.trc:
    ORA-16047: DGID mismatch between destination setting and target database
    Fri Mar 03 16:49:53 2017
    Errors in file /data/oracle/diag/rdbms/t12c/t12c/trace/t12c_tt01_7752.trc:
    ORA-16047: DGID mismatch between destination setting and target database
    Fri Mar 03 16:49:56 2017
    Thread 1 advanced to log sequence 34 (LGWR switch)
      Current log# 1 seq# 34 mem# 0: /data/oracle/oradata/t12c/redo01.log
    Fri Mar 03 16:49:56 2017
    Archived Log entry 4 added for thread 1 sequence 33 ID 0xb2779c38 dest 1:
    

    3.4 source库上配置归档参数

    SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(t12c,s12c)';
    SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=s12c ASYNC OPTIONAL NOREGISTER TEMPLATE=/data/oracle/arch/t12c_arch_%t_%s_%r.log VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) REOPEN=10 DB_UNIQUE_NAME=s12c';
    SQL> ALTER SYSTEM SET ARCHIVE_LAG_TARGET=900;
    

    4. OGG归档模式配置

    OGG抽取进程的配置与RTM方式基本一致,只需要将extract的参数

    TRANLOGOPTIONS INTEGRATEDPARAMS (downstream_real_time_mine Y)
    

    改为

    TRANLOGOPTIONS INTEGRATEDPARAMS (downstream_real_time_mine N)
    

    不再多说,可以自行测试

    关于紫砂壶

    感悟技术人生
    此条目发表在GoldenGate分类目录,贴了标签。将固定链接加入收藏夹。