OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档

OGG12C异构同步mysql5.5到oracle11.2.0.4(windows mysql实时同步数据到linux oracle)详细文档

有一个需求,将一台Windows服务器上的Mysql数据实时同步到Linux下Oracle数据库中,现在笔者有一个安装配置好的Oracle=>Oracle支持DDL的异构同步环境,现在要做的测试是将Windows中的Mysql库表同步到现在已经正常同步的Oracle=>Oracle支持DDL的异构环境的目标端。
至于OGG12C的Oracle=>Oracle支持DDL的异构环境这个环境的完整配置文档将会后续有时间发布出来并将连接放到此处。

一、环境规划

环境配置规划如下:

实验环境 源端 目标端
操作系统 Windows 10 64位 Redhat 6.5 64位
IP 192.168.1.122 192.168.1.10
数据库 Mysql 5.5 Oracle11.2.0.4
GoldenGate Oracle GoldenGate 12.2.0.2.2 for MySQL on Windows (64 bit) (66 MB) Oracle GoldenGate 12.2.0.2.2 for Oracle on Linux x86-64 (584 MB)
dirdat目录 E:\mysql\ogg12\dirdat /u01/app/oracle/ogg12/dirdat

二、Mysql库配置(源端)

1、下载连接:

下载网址

2、win10安装mysql5.5

OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第1张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第2张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第3张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第4张图片
安装目录这里选择:E:\mysql
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第5张图片
安装完成,选择 Launch the MySQL Instance Configuration Wizard 点击 Finish:
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第6张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第7张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第8张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第9张图片
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第10张图片
然后点击执行,等四个选项都打了勾,就说明成功了:
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第11张图片
安装过程中如果在最后一步卡住了,可能之前有安装的mysql,请卸载干净再重装。

3、Mysql配置文件修改

编辑配置文件:
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第12张图片
主要变动的地方为:

[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:/Mysql/"

#Path to the database root
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=gbk

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
#log-bin = E:/mysql/logbinlog.log
#log-bin-index = E:/mysql/binlog.index
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
#log-bin=mysql-bin
log-bin = "E:\mysql\logbin.log" # 自定义目录,日志保存路径
log-bin-index = "E:\mysql\logindex.index" # 自定义目录,日志保存路径
binlog_cache_size=32m
max_binlog_cache_size=512m
max_binlog_size=512m
# binary logging format - mixed recommended
#binlog_format=mixed
  binlog_format=row   --OGG同步必须指定日志为row
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100

重启mysql

C:\WINDOWS\system32>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
C:\WINDOWS\system32>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

去mysql验证一下:

C:\WINDOWS\system32>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.56-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  show variables like "%log%";
+-----------------------------------------+---------------------------------------------------------------------+
| Variable_name                           | Value                                                               |
+-----------------------------------------+---------------------------------------------------------------------+
| back_log                                | 50                                                                  |
| binlog_cache_size                       | 33554432                                                            |
| binlog_direct_non_transactional_updates | OFF                                                                 |
| binlog_format                           | ROW                                                                 |
| binlog_stmt_cache_size                  | 32768                                                               |
| expire_logs_days                        | 0                                                                   |
| general_log                             | OFF                                                                 |
| general_log_file                        | C:\ProgramData\MySQL\MySQL Server 5.5\Data\DESKTOP-NA0RQBF.log      |
| innodb_flush_log_at_trx_commit          | 1                                                                   |
| innodb_locks_unsafe_for_binlog          | OFF                                                                 |
| innodb_log_buffer_size                  | 1048576                                                             |
| innodb_log_file_size                    | 10485760                                                            |
| innodb_log_files_in_group               | 2                                                                   |
| innodb_log_group_home_dir               | .\                                                                  |
| innodb_mirrored_log_groups              | 1                                                                   |
| log                                     | OFF                                                                 |
| log_bin                                 | ON                                                                  |
| log_bin_trust_function_creators         | OFF                                                                 |
| log_error                               | C:\ProgramData\MySQL\MySQL Server 5.5\Data\DESKTOP-NA0RQBF.err      |
| log_output                              | FILE                                                                |
| log_queries_not_using_indexes           | OFF                                                                 |
| log_slave_updates                       | OFF                                                                 |
| log_slow_queries                        | OFF                                                                 |
| log_warnings                            | 1                                                                   |
| max_binlog_cache_size                   | 536870912                                                           |
| max_binlog_size                         | 536870912                                                           |
| max_binlog_stmt_cache_size              | 18446744073709547520                                                |
| max_relay_log_size                      | 0                                                                   |
| relay_log                               |                                                                     |
| relay_log_index                         |                                                                     |
| relay_log_info_file                     | relay-log.info                                                      |
| relay_log_purge                         | ON                                                                  |
| relay_log_recovery                      | OFF                                                                 |
| relay_log_space_limit                   | 0                                                                   |
| slow_query_log                          | OFF                                                                 |
| slow_query_log_file                     | C:\ProgramData\MySQL\MySQL Server 5.5\Data\DESKTOP-NA0RQBF-slow.log |
| sql_log_bin                             | ON                                                                  |
| sql_log_off                             | OFF                                                                 |
| sync_binlog                             | 0                                                                   |
| sync_relay_log                          | 0                                                                   |
| sync_relay_log_info                     | 0                                                                   |
+-----------------------------------------+---------------------------------------------------------------------+
41 rows in set (0.00 sec)

4、创建测试用库和表

在源端创建测试表

mysql> create database oracle;
Query OK, 1 row affected (0.00 sec)

mysql> use oracle;
Database changed
mysql> create user 'scott' identified by 'tiger';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON oracle.* TO 'scott';
Query OK, 0 rows affected (0.00 sec)
创建测试表
CREATE TABLE student(
id int PRIMARY KEY,
name varchar(20),
loc varchar2(20)
);

三、OGG配置

1、源端windows ogg初始化

下载解压缩后的文件放到了E:\mysql\ogg12
OGG12异构同步mysql到oracle(windows mysql实时同步数据到linux oracle)详细文档_第13张图片
通过管理员打开cmd命令行执行初始化:

C:\WINDOWS\system32>E:
E:\>cd mysql/ogg12
--安装ogg服务器
E:\mysql\ogg12>install addservice addevents
Oracle GoldenGate messages installed successfully.
Service 'GGSMGR' created.
Install program terminated normally.
--初始化
E:\mysql\ogg12>ggsci.exe

Oracle GoldenGate Command Interpreter for MySQL
Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419
Windows x64 (optimized), MySQL Enterprise on Jun 30 2017 06:15:27
Operating system character set identified as GBK.

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

GGSCI (DESKTOP-NA0RQBF) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER STOPPED
GGSCI (DESKTOP-NA0RQBF) 3> create subdirs
Creating subdirectories under current directory E:\mysql\ogg12
Parameter files E:\mysql\ogg12\dirprm: created
Report files E:\mysql\ogg12\dirrpt: created
Checkpoint files E:\mysql\ogg12\dirchk: created
Process status files E:\mysql\ogg12\dirpcs: created
SQL script files E:\mysql\ogg12\dirsql: created
Database definitions files E:\mysql\ogg12\dirdef: created
Extract data files E:\mysql\ogg12\dirdat: created
Temporary files E:\mysql\ogg12\dirtmp: created
Credential store files E:\mysql\ogg12\dircrd: created
Masterkey wallet files E:\mysql\ogg12\dirwlt: created
Dump files E:\mysql\ogg12\dirdmp: created

2、编辑mgr进程
登录scott账号,输入dblogin sourcedb 数据库名@IP地址:端口号 userid 用户名 password 密码 (此处为源端数据库),编辑mgr进程,写入配置,如下操作:

 GGSCI (DESKTOP-NA0RQBF) 2> dblogin sourcedb [email protected]:3306 userid scott password  tiger
Successfully logged into database.
GGSCI (DESKTOP-NA0RQBF) 9> edit params mgr
    PORT 7809
    DYNAMICPORTLIST 7810-7860
    AUTORESTART ER *, RETRIES 3, WAITMINUTES 5
    PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPDAYS 7
    lagreporthours 1
    laginfominutes 30
    lagcriticalminutes 60

启动mgr进程

GGSCI (DESKTOP-NA0RQBF DBLOGIN as scott) 4> start mgr
Manager started.
会弹出另一个日志窗口:
***********************************************************************
                  Oracle GoldenGate Manager for MySQL
      Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419
   Windows x64 (optimized), MySQL Enterprise on Jun 30 2017 06:08:27

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


                    Starting at 2019-04-22 14:09:02
***********************************************************************

Operating System Version:
Microsoft Windows 8 , on x64
Version 6.2 (Build 9200)

Process id: 12704

Parameters...

PORT 7809
DYNAMICPORTLIST 7810-7860
AUTORESTART ER *, RETRIES 3, WAITMINUTES 5
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPDAYS 7
lagreporthours 1
laginfominutes 30
lagcriticalminutes 60


***********************************************************************
**                     Run Time Messages                             **
***********************************************************************


2019-04-22 14:09:02  WARNING OGG-01877  Missing explicit accessrule for server collector.

2019-04-22 14:09:02  INFO    OGG-00960  Access granted (rule #26).

2019-04-22 14:09:02  INFO    OGG-00983  Manager started (port 7809).

3、配置extract进程

输入edit params e_m将会弹出文本编辑器并写入:

GGSCI (DESKTOP-NA0RQBF) 10> edit params e_m
EXTRACT e_m
setenv (MYSQL_HOME=E:\mysql)
TRANLOGOPTIONS ALTLOGDEST E:\mysql\logindex.index
SOURCEDB oracle@localhost:3306, USERID scott, PASSWORD tiger
DISCARDROLLOVER ON FRIDAY
DISCARDFILE E:\mysql\ogg12\dirrpt\e_m.dsc, APPEND, MEGABYTES 1024
REPORTCOUNT EVERY 30 MINUTES, RATE
EXTTRAIL E:\mysql\ogg12\dirdat\mq,FORMAT RELEASE 12.2
DYNAMICRESOLUTION
NUMFILES 5000
TABLE oracle.student;

添加抽取进程:

add extract e_m,tranlog,begin now
add exttrail E:\mysql\ogg12\dirdat\mq,extract e_m

启动抽取进程:

GGSCI (DESKTOP-NA0RQBF) 11> start e_m

Sending START request to MANAGER ...
EXTRACT E_M starting
GGSCI (DESKTOP-NA0RQBF) 14> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     E_M         00:00:00      00:00:02

4、配置Pump进程

编辑投递进程,如下操作:

GGSCI (DESKTOP-NA0RQBF) 15> edit params p_m
extract p_m
sourcedb [email protected]:3306 userid scott password tiger
PASSTHRU
numfiles 20000
rmthost 192.168.1.10,mgrport 7809,compress
rmttrail /u01/app/oracle/ogg12/dirdat/mq,FORMAT RELEASE 12.2
dynamicresolution
table oracle.*;

添加投递进程

add extract p_m,exttrailsource E:\mysql\ogg12\dirdat\mq

add rmttrail /u01/app/oracle/ogg12/dirdat/mq,extract p_m,megabytes 500

启动投递进程

GGSCI (DESKTOP-NA0RQBF) 16> start p_m

Sending START request to MANAGER ...
EXTRACT P_M starting

GGSCI (DESKTOP-NA0RQBF) 18> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     E_M         00:00:00      00:00:03
EXTRACT     RUNNING     P_M         00:00:00      00:00:02

5、验证extract&Pump进程

源端mysql库insert一条数据:

mysql> insert into student values(1,'sdf sd sd sda','bb');
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
Commit_date:10:26:55

mysql> select * from student;
+----+---------------+------+
| id | name          | loc  |
+----+---------------+------+
|  1 | sdf sd sd sda | bb   |
+----+---------------+------+
1 row in set (0.00 sec)

可以通过查询抽取投递进程信息发现数据已经被捕获并写到trail文件并投递到目标linux服务器指定的目录了,这里为了直观监控这一活动,直接去linux看trail文件内容(这里目标端oracle安装ogg软件的过程文章开头说了,有时间放上来):

[oracle@ogg dirdat]$ pwd
/u01/app/oracle/ogg12/dirdat
[oracle@ogg dirdat]$ ls
mq000000004  mq000000005  mq000000006  mq000000007  mq000000008  sc000000013

上面之所以有这么多mq开头的trail文件是因为笔者自己写文章时抽取和投递进程启动时出了几次问题,解决了之后写的这篇文章,而trail文件笔者没删。这里只看最新的mq000000008trail文件内容。
为了方便,写个logdump模板:

[oracle@ogg ogg12]$ pwd
/u01/app/oracle/ogg12
[oracle@ogg ogg12]$ vim loginit_mq 

cd ./dirdat
open mq000000008
ghdr on
detail on
detail data
usertoken on
usertoken detail
ggstoken on
ggstoken detail
headertoken on
headertoken detail
reclen 0
pos last
pos rev
logtrail
pos

通过logdump查看trail文件最新同步过来的一条记录:

[oracle@ogg ogg12]$ pwd
/u01/app/oracle/ogg12
[oracle@ogg ogg12]$ ./logdump 

Oracle GoldenGate Log File Dump Utility for Oracle
Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419

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


 
Logdump 97 >obey loginit_mq    
*** Unable to open OBEY file /u01/app/oracle/ogg12/loginit῟mq 
 
Logdump 98 >obey loginit_mq
cd ./dirdat
open mq000000006
Current LogTrail is /u01/app/oracle/ogg12/dirdat/mq000000006 
ghdr on
detail on
detail data
usertoken on
usertoken detail
ggstoken on
ggstoken detail
headertoken on
headertoken detail
reclen 0
Reclen set to 0 
pos last
Reading forward from RBA 6030 
pos rev
Reading in reverse from RBA 6030 
logtrail
Current LogTrail is /u01/app/oracle/ogg12/dirdat/mq000000006 
pos
Current position is RBA 6030   Reverse 
Logdump 99 >exit 
[oracle@ogg ogg12]$ vim loginit_mq 
[oracle@ogg ogg12]$ pwd
/u01/app/oracle/ogg12
[oracle@ogg ogg12]$ 
[oracle@ogg ogg12]$ 
[oracle@ogg ogg12]$ pwd
/u01/app/oracle/ogg12
[oracle@ogg ogg12]$ ./logdump 

Oracle GoldenGate Log File Dump Utility for Oracle
Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419

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


 
Logdump 99 >obey loginit_mq
cd ./dirdat
open mq000000008
Current LogTrail is /u01/app/oracle/ogg12/dirdat/mq000000008 
ghdr on
detail on
detail data
usertoken on
usertoken detail
ggstoken on
ggstoken detail
headertoken on
headertoken detail
reclen 0
Reclen set to 0 
pos last
Reading forward from RBA 2494 
pos rev
Reading in reverse from RBA 2494 
logtrail
Current LogTrail is /u01/app/oracle/ogg12/dirdat/mq000000008 
pos
Current position is RBA 2494   Reverse 
Logdump 100 >pos last 
Reading in reverse from RBA 2494 
Logdump 101 >pos rev 
Reading in reverse from RBA 2494 
Logdump 102 >n 
TokenID x47 'G' Record Header    Info x01  Length  179 
TokenID x48 'H' GHDR             Info x00  Length   36 
 450c 0041 0029 05ff 02f2 ad70 e41e caa2 0000 0000 | E..A.).....p........  
 0000 0004 0000 27f2 0352 0000 0001 0001           | ......'..R......  
TokenID x44 'D' Data             Info x00  Length   41 
TokenID x54 'T' GGS Tokens       Info x00  Length   82 
TokenID x5a 'Z' Record Trailer   Info x01  Length  179 
___________________________________________________________________ 
Hdr-Ind    :     E  (x45)     Partition  :     .  (x0c)  
UndoFlag   :     .  (x00)     BeforeAfter:     A  (x41)  
RecLength  :    41  (x0029)   IO Time    : 2019/04/24 10:26:55.000.226   
IOType     :     5  (x05)     OrigNode   :   255  (xff) 
TransInd   :     .  (x03)     FormatType :     R  (x52) 
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00) 
AuditRBA   :      10226       AuditPos   : 4 
Continued  :     N  (x00)     RecCount   :     1  (x01) 

2019/04/24 10:26:55.000.226 Insert               Len    41 RBA 2315 
Name: oracle.student  (TDR Index: 1) 
After  Image:                                             Partition 12   G  s   
 0000 0006 0000 0000 0001 0001 0011 0000 000d 7364 | ..................sd  
 6620 7364 2073 6420 7364 6100 0200 0600 0000 0262 | f sd sd sda........b  
 62                                                | b  
Column     0 (x0000), Len     6 (x0006)  
 0000 0000 0001                                    | ......  
Column     1 (x0001), Len    17 (x0011)  
 0000 000d 7364 6620 7364 2073 6420 7364 61        | ....sdf sd sd sda  
Column     2 (x0002), Len     6 (x0006)  
 0000 0002 6262                                    | ....bb  
  
GGS tokens: 
TokenID x4c 'L' LOGCSN           Info x00  Length   37 
 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 | 00000000000000000000  
 343a 3030 3030 3030 3030 3030 3130 3235 33        | 4:000000000010253  
TokenID x36 '6' TRANID           Info x00  Length   37 
 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 | 00000000000000000000  
 343a 3030 3030 3030 3030 3030 3130 3132 31        | 4:000000000010121 

发现那会10:26做的insert操作已经通过抽取进程从mysql抽取并投递到了linux这边,验证完成,没问题,接了下来就开始准备怎么去应用到oracle了。

6、配置Defgen文件

创建表的定义文件(.def)

GGSCI (DESKTOP-NA0RQBF) 105> edit params defgen
defsfile E:\mysql\ogg12\dirdef\stu.def
sourcedb [email protected]:3306 userid scott, password tiger
table oracle.*;

生成:

E:\mysql\ogg12>defgen paramfile E:/mysql/ogg12/dirprm/defgen.prm

***********************************************************************
        Oracle GoldenGate Table Definition Generator for MySQL
      Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419
   Windows x64 (optimized), MySQL Enterprise on Jun 30 2017 07:07:13

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


                    Starting at 2019-04-23 13:43:54
***********************************************************************

Operating System Version:
Microsoft Windows 8 , on x64
Version 6.2 (Build 9200)

Process id: 20324

***********************************************************************
** Running with the following parameters **
***********************************************************************
defsfile E:\mysql\ogg12\dirdef\stu.def
sourcedb [email protected]:3306 userid scott, password ***
table oracle.*;
Expanding wildcard table specification oracle.*:

Retrieving definition for oracle.student.


Definitions generated for 1 table in E:\mysql\ogg12\dirdef\stu.def.

将def传到oracle,接下来配置应用进程

7、配置replicat进程

编辑应用进程:

GGSCI (ogg) 6> edit params r_m

replicat r_m
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
sourcedefs /u01/app/oracle/ogg12/dirdef/stu.def
userid ogg,password ogg
reportcount every 30 minutes,rate
reperror default,abend
numfiles 20000
checkpointsecs 40
discardfile /u01/app/oracle/ogg12/dirrpt/r_m.dsc,append,megabytes 1000
dynamicresolution
map oracle.student,target oracle.student,keycols(ID),colmap(
usedefaults,
etltime=@DATENOW()
);
~  

添加应用进程:

 add replicat r_m,exttrail /u01/app/oracle/ogg12/dirdat/mq checkpointtable ogg.checkpoint

接下来在oracle库创建oracle用户及student表:

create user oracle identified by oracle;
grant dba to oracle;
CREATE TABLE student(
id int PRIMARY KEY,
name varchar(20),
loc varchar2(20),
etltime timestamp
);

启动应用进程,因为笔者前面已经有了几个trail文件了,所以我这里是指定的trail文件号和rba启动:

 alter replicat r_m extseqno 6  extrba 0
 start r_m

读者可以直接通过下面方式启动:

start r_m

进程起来没问题:

GGSCI (ogg) 7> start r_m

Sending START request to MANAGER ...
REPLICAT R_M starting
GGSCI (ogg) 20> view report r_m
部分日志如下:
2019-04-24 10:45:19  INFO    OGG-02243  Opened trail file /u01/app/oracle/ogg12/dirdat/mq000000008 at 2019-04-24 10:45:19.047722.

2019-04-24 10:45:19  WARNING OGG-02761  Source definitions file, /u01/app/oracle/ogg12/dirdef/stu.def, is ignored because trail file /u01/app/oracle/ogg12/dirdat/mq000000008 contains table 
definitions.

2019-04-24 10:45:19  INFO    OGG-06505  MAP resolved (entry oracle.student): map "oracle"."student",target oracle.student,keycols(ID),colmap( usedefaults, etltime=@DATENOW() ).

2019-04-24 10:45:20  INFO    OGG-02756  The definition for table oracle.student is obtained from the trail file.
Using the following default columns with matching names:
  ID=id, NAME=name, LOC=loc

2019-04-24 10:45:20  INFO    OGG-06510  Using the following key columns for target table ORACLE.STUDENT: ID.


2019-04-24 10:45:20  INFO    OGG-03010  Performing implicit conversion of column data from character set windows-936 to zhs16gbk.

应用进程起来了,没问题,看日志数据已经应用,去oracle查询:

SQL> select * from student;

    ID NAME		    LOC 		 ETLTIME
------ -------------------- -------------------- ------------------------------
     1 sdf sd sd sda	    bb			 24-APR-19 10.45.20.000000 AM

数据已经过来,同步成功。
因为笔者现在是做测试,同步的mysql表直接新建然后同步insert操作,而生产环境下一般还要涉及历史数据的初始化,oracle我用数据泵初始化,至于mysql,还要研究一下。

四、安装过程中曾遇到的问题

1、OGG-01411

具体报错如下:

2019-04-22 17:45:55  INFO    OGG-01478  Output file E:\mysql\ogg12\dirdat\mq is using format RELEASE 12.2.

Source Context :
  SourceModule            : [er.extrout]
  SourceID                : [er/extrout.c]
  SourceFunction          : [open_targ_ext_file]
  SourceLine              : [1569]
  ThreadBacktrace         : [13] elements
                          : [E:\mysql\ogg12\gglog.dll(??1CContextItem@@UEAA@XZ+0x2a96) [0x00007FF881BCF6B6]]
                          : [E:\mysql\ogg12\gglog.dll(?CreateMessage@CMessageFactory@@QEAAPEAVCMessage@@PEAVCSourceContext@@IZZ+0x561) [0x00007FF881BCFD01]]
                          : [E:\mysql\ogg12\gglog.dll(?_MSG_ERR_TRAIL_FORMAT_MISMATCH@@YAPEAVCMessage@@PEAVCSourceContext@@PEBD11W4MessageDisposition@CMessageFactory@@@Z+0x4f) [0x00007FF881B761FF]]
                          : [E:\mysql\ogg12\extract.exe(<_MSG_ERR_TRAIL_FORMAT_MISMATCH@@YAPEAVCMessage@@PEAVCSourceContext@@PEBD11W4MessageDisposition@CMessageFactory@@@Z+0x4f) [0x00007FF7D035A3B2]]
                          : [E:\mysql\ogg12\extract.exe(<_MSG_ERR_TRAIL_FORMAT_MISMATCH@@YAPEAVCMessage@@PEAVCSourceContext@@PEBD11W4MessageDisposition@CMessageFactory@@@Z+0x4f) [0x00007FF7D035A564]]
                          : [E:\mysql\ogg12\extract.exe(ERCALLBACK+0x441b5) [0x00007FF7D03DDB35]]
                          : [E:\mysql\ogg12\extract.exe(_ggTryDebugHook+0x8943) [0x00007FF7D04ABC53]]
                          : [E:\mysql\ogg12\extract.exe(_ggTryDebugHook+0x7d2b) [0x00007FF7D04AB03B]]
                          : [E:\mysql\ogg12\extract.exe(_ggTryDebugHook+0x87e3) [0x00007FF7D04ABAF3]]
                          : [E:\mysql\ogg12\extract.exe(ERCALLBACK+0x4448b) [0x00007FF7D03DDE0B]]
                          : [E:\mysql\ogg12\extract.exe(VAMMessage+0x376aa) [0x00007FF7D05D0A6A]]
                          : [C:\WINDOWS\System32\KERNEL32.DLL(BaseThreadInitThunk+0x14) [0x00007FF8AF2B7BD4]]
                          : [C:\WINDOWS\SYSTEM32\ntdll.dll(RtlUserThreadStart+0x21) [0x00007FF8B04ACE71]]

2019-04-22 17:45:55  ERROR   OGG-01416  File E:\mysql\ogg12\dirdat\mq000000000, with format RELEASE 9.0/9.5, does not match current format specification of RELEASE 12.2. Modify the parameter file to specify format RELEASE 9.0/9.5 or issue ETROLLOVER prior to restart.

2019-04-22 17:45:55  ERROR   OGG-01668  PROCESS ABENDING.

原因和解决方法:

Description:	Cannot convert input file {0} with format {1} to output file {2} with format {3}

Cause:	
The output trail of the data pump has a different format (version) than the input trail of the data pump. The input and output trail formats must be identical for a data pump.

Action:	
The FORMAT RELEASE option of EXTFILE or EXTTRAIL and RMTFILE or RMTTRAIL must be the same when associated with a data pump. For more information, see the Oracle GoldenGate reference documentation.

你可能感兴趣的:(Oracle,GoldenGate)