IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> 在同一台机器上部署OGG并测试 -> 正文阅读

[大数据]在同一台机器上部署OGG并测试

OGG ,部署在同一台机器上。IP地址是192.168.2.100?
源端:orcl
目标端: test?
ogg版本?

[oracle@redhat762100 ogg19c]$ ./ggsci -v

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.



[oracle@redhat762100 ogg19c]$ 

将bb.t 同步到bb.t
配置测试内容:
1 将bb.t 同步到bb.t ,两个表是相同的schema,相同的结构
2 将bb.t1同步到zbb.t1,两个表属于不同的schema,结构相同,但是目标端表,多了一个update_time字段,该字段记录同步时间?

----- 配置测试1 ?
-- 源端配置

view params mgr -- 配置mgr进程

PORT 7809
DYNAMICPORTLIST  7800-8000
AUTORESTART EXTRACT *, RETRIES 5, WAITMINUTES 7
LAGREPORTHOURS 1
PURGEOLDEXTRACTS ./dirdat/ext1/*, USECHECKPOINTS, MINKEEPDAYS 3     
LAGINFOMINUTES 30     
LAGCRITICALMINUTES 45     

-- 源端加入要同步的表?

add  trandata bb.t

-- 配置抽取进程

view params ext1?

extract ext1
SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "orcl")
userid ogg, password oracle
warnlongtrans 4h, checkinterval 10m    
dynamicresolution      
exttrail ./dirdat/ext1/ee     
table bb.t  ;
add extract ext1,tranlog,begin now
add exttrail ./dirdat/ext1/ee,extract ext1,megabytes 200   -- 注意这里不要使用绝对路径,否则报错 

-- 配置投递进程? ?view params pump1?

extract PUMP1

SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "orcl")
rmthost 192.168.2.100, mgrport 7809
rmttrail ./dirdat/pump1/pp
userid ogg, password oracle 

table bb.t ;
add extract pump1, exttrailsource ./dirdat/ext1/ee, begin now 
ADD RMTTRAIL ./dirdat/pump1/pp, EXTRACT pump1, MEGABYTES 200

-- 目标端配置复制进程??view params rep1?

replicat rep1
SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "test")
userid ogg, password oracle
assumetargetdefs
discardfile ./dirdat/rep_l_discard,append
--discardfile ./dirrpt/repdb1_repaix.dsc,purge
REPORTROLLOVER AT 05:30 ON Friday
map bb.t,target bb.t;
add replicat rep1,exttrail ./dirdat/pump1/pp, checkpointtable ogg.checkpoint
start replicat repdb1 

-- 查看进程状态

GGSCI (redhat762100 as ogg@orcl) 52> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT1        00:00:00      00:00:01    
EXTRACT     RUNNING     PUMP1       00:00:00      00:00:06    
REPLICAT    RUNNING     REP1        00:00:00      00:00:02    
REPLICAT    STOPPED     REPTAB1     00:00:00      03:11:37    
REPLICAT    STOPPED     REPTAB2     00:00:00      2708:59:59  

----------------- 配置测试2 ?,新增加同步进程,使表结构不一样

源端:orcl
目标端: test?

将bb.t1 同步到zbb.t1?
-- 源端加入要同步的表?

add  trandata bb.t1

源端表

BB@orcl>desc bb.t1
 Name                                                              Null?    Type
 ----------------------------------------------------------------- -------- --------------------------------------------
 ID                                                                         NUMBER
 NAME                                                                       VARCHAR2(10)

BB@orcl>
目标端表 ,和源端的表字段相同,但是多了一个update_date字段
SYS@test>desc zbb.t1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(30)

SYS@test>alter table zbb.t1 add update_date date default sysdate;

Table altered.

SYS@test>desc zbb.t1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(30)
 UPDATE_DATE                                        DATE

SYS@test>

-- 源端配置抽取进程 ext2?

先add ?trandata bb.t1?

view params ext2?

extract ext2
SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "orcl")
userid ogg, password oracle
warnlongtrans 4h, checkinterval 10m    
dynamicresolution      
exttrail ./dirdat/ext2/ee     
table bb.t1 ,TOKENS (UPDATE_DATE = @GETENV ('GGHEADER', 'COMMITTIMESTAMP')) ;    -- 注意要单引号 
add extract ext2,tranlog,begin now
add exttrail ./dirdat/ext2/ee,extract ext2,megabytes 200   -- 注意这里不要使用绝对路径,否则报错 

-- 源端配置投递进程? ?view params pump2?

extract PUMP2

SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "orcl")
rmthost 192.168.2.100, mgrport 7809
rmttrail ./dirdat/pump2/pp
userid ogg, password oracle 

table bb.t1 ,TOKENS (UPDATE_DATE = @GETENV ('GGHEADER', 'COMMITTIMESTAMP')) ;  -- 这里也要单引号 
add extract pump2, exttrailsource ./dirdat/ext2/ee, begin now 
ADD RMTTRAIL ./dirdat/pump2/pp, EXTRACT pump2, MEGABYTES 200

-- 源端定义defgen ?

view params defgen_t1 ?-- 这个文件在dirprm文件夹中 ,就是defgen_t1.prm?

defsfile ./dirdat/defen_t1/defgen_t1.def    -- 写这个,说明是生成的defsfile文件的路径 
userid ogg,password oracle
table bb.t1;

-- 源端生成defgen文件,将生成的文件,copy到目标端的dirdef目录下(拷贝过程略)?

defgen paramfile /u01/ogg19c/dirprm/defgen_t1.prm

[oracle@redhat762100 ogg19c]$ ./defgen paramfile /u01/ogg19c/dirprm/defgen_t1.prm

***********************************************************************
        Oracle GoldenGate Table Definition Generator for Oracle
      Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054
   Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 15:32:20
 
Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.

                    Starting at 2022-06-25 15:03:16
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Thu Oct 4 20:48:51 UTC 2018, Release 3.10.0-957.el7.x86_64
Node: redhat762100
Machine: x86_64
                         soft limit   hard limit
Address Space Size   :    unlimited    unlimited
Heap Size            :    unlimited    unlimited
File Size            :    unlimited    unlimited
CPU Time             :    unlimited    unlimited

Process id: 37169

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************
defsfile ./dirdat/defen_t1/defgen_t1.def
userid ogg,password ***
table bb.t1;
Retrieving definition for BB.T1.

2022-06-25 15:03:20  WARNING OGG-06439  No unique key is defined for table T1. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.


Definitions generated for 1 table in ./dirdat/defen_t1/defgen_t1.def.

[oracle@redhat762100 ogg19c]$ 

-- 目标端配置复制进程

replicat rep2
Sourcedefs  /u01/ogg19c/dirdef/defgen_t1.def       -- 使用到上面生成的文件 (将上面生成的文件,copy到合适的目录)
SETENV (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
SETENV (ORACLE_HOME = "/u01/app/oracle")
SETENV (ORACLE_SID = "test")
userid ogg, password oracle
--assumetargetdefs
discardfile ./dirdat/rep_2_discard,append
--discardfile ./dirrpt/repdb1_repaix.dsc,purge
REPORTROLLOVER AT 05:30 ON Friday
map bb.t1,target zbb.t COLMAP (USEDEFAULTS, UPDATE_DATE= @TOKEN ('TKN-COMMITTIME'));
add replicat rep2,exttrail ./dirdat/pump2/pp, checkpointtable ogg.checkpoint
start replicat rep2 

-- 查看进程,各个进程正常。

GGSCI (redhat762100 as ogg@test) 24> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT1        00:00:00      00:00:09    
EXTRACT     RUNNING     EXT2        00:00:00      00:00:09    
EXTRACT     RUNNING     PUMP1       00:00:00      00:00:09    
EXTRACT     RUNNING     PUMP2       00:00:00      00:00:08    
REPLICAT    RUNNING     REP1        00:00:00      00:00:05    
REPLICAT    RUNNING     REP2        00:00:00      00:00:05    
REPLICAT    STOPPED     REPTAB1     00:00:00      04:32:38    
REPLICAT    STOPPED     REPTAB2     00:00:00      2710:20:59  


GGSCI (redhat762100 as ogg@test) 25> 

过程中碰到的问题及原因:
问题1 :
OGG-00041 ?Oracle GoldenGate Capture for Oracle, pump1.prm: ?Data source not specified.
OGG-00041 ? ?Data source not specified.
原因:
edit params 参数里面不全 ,没有指定extract的名称


问题2?

OGG-01298 ?Oracle GoldenGate Capture for Oracle, ext2.prm: ?Column function diagnostic message: could not find column "GGHEADER".

原因:
单引号和双引号的问题 ,ogg11g和ogg19c,注意使用的是单引号还是双引号

问题3?
GGSCI (redhat762100 as ogg@orcl) 102> info all

Program ? ? Status ? ? ?Group ? ? ? Lag at Chkpt ?Time Since Chkpt

MANAGER ? ? RUNNING ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
EXTRACT ? ? RUNNING ? ? EXT1 ? ? ? ?00:00:00 ? ? ?00:00:05 ? ?
EXTRACT ? ? RUNNING ? ? EXT2 ? ? ? ?00:00:00 ? ? ?00:00:05 ? ?
EXTRACT ? ? RUNNING ? ? PUMP1 ? ? ? 00:00:00 ? ? ?00:00:04 ? ?
EXTRACT ? ? RUNNING ? ? PUMP2 ? ? ? 00:00:00 ? ? ?00:00:04 ? ?
REPLICAT ? ?RUNNING ? ? REP1 ? ? ? ?00:00:00 ? ? ?00:00:00 ? ?
REPLICAT ? ?ABENDED ? ? REP2 ? ? ? ?00:00:00 ? ? ?00:01:50 ? ?
REPLICAT ? ?STOPPED ? ? REPTAB1 ? ? 00:00:00 ? ? ?04:16:21 ? ?
REPLICAT ? ?STOPPED ? ? REPTAB2 ? ? 00:00:00 ? ? ?2710:04:42 ?

原因,表zbb.t1有主键(not null约束,还和zbb.t2有外键约束),和zbb.t2有外键约束,
alter table zbb.t1 disable constraint T1_pk;
alter table zbb.t2 disable constraint T2_FK_CASCADE;


?
END?

?

  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2022-06-29 19:08:56  更:2022-06-29 19:11:47 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/24 23:25:27-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码