加入收藏 | 设为首页 | 会员中心 | 我要投稿 威海站长网 (https://www.0631zz.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

ogg异构oracle-mysql

发布时间:2020-12-24 11:32:49 所属栏目:站长百科 来源:网络整理
导读:/* 参数文件里,TABLE参数中有cols和COLSEXCEPT 项 前者用来选择要capture的字段,后者指定要排除的字段 但是官方文档上有一句 Do not exclude key columns,and do not use COLSEXCEPT to exclude columns that contain unsupported data types. */ scott.bo

GGSCI (nosql2) 1> create subdirs
Creating subdirectories under current directory /usr/local
Parameter files /usr/local/dirprm: already exists
Report files /usr/local/dirrpt: created
Checkpoint files /usr/local/dirchk: created
Process status files /usr/local/dirpcs: created
SQL script files /usr/local/dirsql: created
Database definitions files /usr/local/dirdef: created
Extract data files /usr/local/dirdat: created
Temporary files /usr/local/dirtmp: created
Stdout files /usr/local/dirout: created

源端配置大致分为如下三个步骤:配置mgr,配置抽取进程,配置投递进程
在源端先创建一张表,记得带主键:
create table ah4(id int,name varchar(10),primary key(id));

1.登陆ogg,配置全局设置
./ggsci
dblogin userid ggs password ggs

--查看远端全局变量
view params ./globals
ggschema ggs

2.配置mgr
GGSCI (ora11g) 3> edit param mgr

PORT 7809
DYNAMICPORTLIST 7810-7909
--AUTOSTART ER *
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints,minkeepdays 3
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45

PS:
MANAGER进程参数配置说明:
PORT:指定服务监听端口;这里以7809为例,默认端口为7809
DYNAMICPORTLIST:动态端口:可以制定最大256个可用端口的动态列表,当指定的端口不可用时,管理进程将会从列表中选择一个可用的端口,源端和目标段的Collector、Replicat、GGSCI进程通信也会使用这些端口;
COMMENT:注释行,也可以用--来代替;
AUTOSTART:指定在管理进程启动时自动启动哪些进程;
AUTORESTART:自动重启参数设置:本处设置表示每3分钟尝试重新启动所有EXTRACT进程,共尝试5次;
PURGEOLDEXTRACTS:定期清理trail文件设置:本处设置表示对于超过3天的trail文件进行删除。
LAGREPORT、LAGINFO、LAGCRITICAL:
定义数据延迟的预警机制:本处设置表示MGR进程每隔1小时检查EXTRACT的延迟情况,如果超过了30分钟就把延迟作为信息记录到错误日志中,如果延迟超过了45分钟,则把它作为警告写到错误日志中。

3.启动mgr,并查看状态
start mgr
info all
4.添加并查看需要复制的表:
add trandata hr.ah4
add trandata hr.ah5

info trandata hr.*

Logging of supplemental redo log data is enabled for table HR.AH1.
Columns supplementally logged for table HR.AH1: ID.
Logging of supplemental redo log data is enabled for table HR.AH2.
Columns supplementally logged for table HR.AH2: ID.
Logging of supplemental redo log data is enabled for table HR.AH3.
Columns supplementally logged for table HR.AH3: ID.
Logging of supplemental redo log data is enabled for table HR.AH4.
Columns supplementally logged for table HR.AH4: ID.
Logging of supplemental redo log data is disabled for table HR.COUNTRIES.
Logging of supplemental redo log data is disabled for table HR.DEPARTMENTS.
Logging of supplemental redo log data is disabled for table HR.EMPLOYEES.
Logging of supplemental redo log data is disabled for table HR.JOBS.
Logging of supplemental redo log data is disabled for table HR.JOB_HISTORY.
Logging of supplemental redo log data is disabled for table HR.LOCATIONS.
Logging of supplemental redo log data is disabled for table HR.REGIONS.
Logging of supplemental redo log data is disabled for table HR.SURE1.

5.配置抽取进程
edit params ext3

extract ext3
dynamicresolution
userid ggs,password ggs
exttrail /home/oracle/app/oracle/ogg/dirdat/xs
table hr.ah4;
table hr.ah5;

add extract ext3,tranlog,begin now
add exttrail /home/oracle/app/oracle/ogg/dirdat/xs,extract ext3

--跟踪文件配置关键字长度<=2
--添加多线程
edit params ext4
extract ext4
dynamicresolution
userid ggs,password ggs
exttrail /home/oracle/app/oracle/ogg/dirdat/xs4
table hr.ah4;
table hr.ah5;

add extract ext4,begin now
add exttrail /home/oracle/app/oracle/ogg/dirdat/x4,extract ext4

edit params ext5
extract ext5
dynamicresolution
userid ggs,password ggs
exttrail /home/oracle/app/oracle/ogg/dirdat/xs4
table hr.ah4;
table hr.ah5;

add extract ext5,begin now
add exttrail /home/oracle/app/oracle/ogg/dirdat/x5,extract ext5

PS:
ext的模板可以是:
EXTRACT extmb
setenv (NLS_LANG = "AMERICAN_AMERICA.UTF8")
SETENV (ORACLE_HOME = "/u01/oracle/product/11.2.0/db_1")
SETENV (ORACLE_SID = "orcl")
USERID ggs,PASSWORD ggs
--GETTRUNCATES
REPORTCOUNT EVERY 1 MINUTES,RATE
DISCARDFILE ./dirrpt/extmb.dsc,APPEND,MEGABYTES 1024
--THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 60000 IOLATENS 60000
DBOPTIONS ALLOWUNUSEDCOLUMN
WARNLONGTRANS 2h,CHECKINTERVAL 3m
EXTTRAIL ./dirdat/mb
--TRANLOGOPTIONS EXCLUDEUSER USERNAME
FETCHOPTIONS NOUSESNAPSHOT
TRANLOGOPTIONS CONVERTUCS2CLOBS
TABLE hr.emp;
SETENV:配置系统环境变量
USERID/ PASSWORD: 指定OGG连接数据库的用户名和密码,这里使用3.4部分中创建的数据库用户OGG;
COMMENT:注释行,也可以用--来代替;
TABLE:定义需复制的表,后面需以;结尾
TABLEEXCLUDE:定义需要排除的表,如果在TABLE参数中使用了通配符,可以使用该参数指定排除掉得表。
GETUPDATEAFTERS|IGNOREUPDATEAFTERS:
是否在队列中写入后影像,缺省复制
GETUPDATEBEFORES| IGNOREUPDATEBEFORES:
是否在队列中写入前影像,缺省不复制
GETUPDATES|IGNOREUPDATES:
是否复制UPDATE操作,缺省复制
GETDELETES|IGNOREDELETES:
是否复制DELETE操作,缺省复制
GETINSERTS|IGNOREINSERTS:
是否复制INSERT操作,缺省复制
GETTRUNCATES|IGNORETRUNDATES:
是否复制TRUNCATE操作,缺省不复制;

6.配置投递进程

edit params push3

extract push3
passthru
dynamicresolution
userid ggs,password ggs
rmthost 192.168.92.61,mgrport 7809
rmttrail /usr/local/dirdat/xs
table hr.ah4;
table hr.ah5;

GGSCI (ora11g) 18> add extract push3,exttrailsource /home/oracle/app/oracle/ogg/dirdat/xs
GGSCI (ora11g) 19> add rmttrail /usr/local/dirdat/xs,extract push3

--配置多线程
edit params push4

extract push4
passthru
dynamicresolution
userid ggs,mgrport 7809
rmttrail /usr/local/dirdat/xs4
table hr.ah4;
table hr.ah5;

add extract push4,exttrailsource /home/oracle/app/oracle/ogg/dirdat/x4
add rmttrail /usr/local/dirdat/x4,extract push4

(编辑:威海站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读