Professional Documents
Culture Documents
Oracle GoldenGate Heterogeneous MySQL-ORACLE
Oracle GoldenGate Heterogeneous MySQL-ORACLE
Heterogeneous Replication
Oracle GoldenGate Replication between
MySQL 5.5 to Oracle 12c
Contents
______________________________________________________________________
________________________________________
1. Overview
2. Environment
3. Install GoldenGate 12C for MySQL
4. Install GoldenGate 12C for Oracle 12.1.0.1.0
a) On Source MySQL
b) On Target Oracle 12c
INSERT OPERATION
UPDATE OPERATION
DELETE OPERATION
______________________________________________________________________
_______________________________________
1. Overview
2. Environment
Source (MySQL):
a) On Source (MySQL)
Enter password:
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights
reserved.
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
mysql>
+-----------+--------+
| host | user |
+-----------+--------+
| localhost | CHITTI |
+-----------+--------+
mysql>
mysql>
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| CHITTI |
| mysql |
+--------------------+
mysql>
mysql>
Enter password:
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights
reserved.
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
Database changed
mysql>
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| CHITTI |
+------------+
mysql>
+------------------+
| USER() |
+------------------+
| CHITTI@localhost |
+------------------+
mysql>
-> ENGINE=InnoDB;
mysql>
+------------------+
| Tables_in_CHITTI |
+------------------+
| trans_type |
+------------------+
1 rows in set (0.00 sec)
mysql>
+------------+
| trans_type |
+------------+
| 0 |
+------------+
mysql>
Connected to:
NAME OPEN_MODE
--------- --------------------
User created.
Grant succeeded.
Connected.
trans_id smallint,
trans varchar2(5),
using index
);
Table created.
SQL>
TRANS_TYPE TABLE
1 rows selected.
SQL>
COUNT(*)
----------
SQL>
a) Set Environment
. mysql.env
#!/bin/bash
GG=/u01/app/oracle/product/mysqlogg ; export GG
LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server/libjvm.so:/u01/app/
oracle/product/mysqlogg ; export LD_LIBRARY_PATH
b) Login to ggsci
MANAGER STOPPED
c) Configure Manager
PORT 15100
DYNAMICPORTLIST 15110-15120
PURGEOLDEXTRACTS ./dirdat/eo, USECHECKPOINTS, MINKEEPFILES 10
PORT 15100
DYNAMICPORTLIST 15110-15120
EXTRACT added.
EXTTRAIL added.
GGSCI (rac1.rajasekhar.com) 8>
EXTRACT E_MYSQL
EXTTRAIL ./dirdat/eo
STATOPTIONS RESETREPORTSTATS
REPORT AT 00:01
REPORTROLLOVER AT 00:01
TABLE CHITTI.trans_type;
EXTRACT E_MYSQL
EXTTRAIL ./dirdat/eo
STATOPTIONS RESETREPORTSTATS
REPORT AT 00:01
REPORTROLLOVER AT 00:01
TABLE CHITTI.trans_type;
-- CREATE DATA PUMP FOR ORACLE 12C AND REMOTE EXTRACT TRAIL OF 50MB
EXTRACT added.
GGSCI (rac1.rajasekhar.com) 26> ADD RMTTRAIL ./dirdat/ra, EXTRACT
P_MYSQL, MEGABYTES 50
RMTTRAIL added.
EXTRACT P_MYSQL
RMTTRAIL ./dirdat/ra
PASSTHRU
REPORTCOUNT EVERY 60 SECONDS, RATE
TABLE CHITTI.*;
EXTRACT P_MYSQL
RMTTRAIL ./dirdat/ra
PASSTHRU
login as root
cd /home/oracle
. mysql.env
cd /u01/app/oracle/product/mysqlogg/dirprm/
vi defgen_chitti.prm
DEFSFILE ./dirdef/chittidefs.sql
TABLE CHITTI.*;
[root@rac1 dirprm]# cat defgen_chitti.prm
DEFSFILE ./dirdef/chittidefs.sql
TABLE CHITTI.*;
[root@rac1 dirprm]#
cd /u01/app/oracle/product/mysqlogg
*******************************************************************
****
*******************************************************************
****
Linux
Node: rac1.rajasekhar.com
Machine: x86_64
*******************************************************************
****
*******************************************************************
****
DEFSFILE ./dirdef/chittidefs.sql
TABLE CHITTI.*;
[root@rac1 mysqlogg]#
[root@rac1 dirdef]# pwd
/u01/app/oracle/product/mysqlogg/dirdef
[root@rac1 dirdef]#
a) Set Environment
. 12c.env
#!/bin/bash
GG=/u01/app/oracle/product/12cogg ; export GG
b) Login to Database
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights
reserved.
c) Configure Manager
MANAGER STOPPED
PORT 15000
DYNAMICPORTLIST 15010-15020
PORT 15000
DYNAMICPORTLIST 15010-15020
GGSCHEMA OGGUSER
CHECKPOINTTABLE OGGUSER.CHECKPOINT
GGSCHEMA OGGUSER
CHECKPOINTTABLE OGGUSER.CHECKPOINT
For the GLOBALS configuration to take effect, you must exit the
session in which the changes were made. Execute the following
command to exit GGSCI.
[oracle@rac1 12cogg]$
REPLICAT added.
SOURCEDEFS ./dirdef/chittidefs.sql
STATOPTIONS RESETREPORTSTATS
REPLICAT R_MYSQL
SOURCEDEFS ./dirdef/chittidefs.sql
USERID ogguser, PASSWORD oracle
STATOPTIONS RESETREPORTSTATS
MANAGER STOPPED
EXTRACT STOPPED E_MYSQL 00:00:00 02:11:01
Manager started.
MANAGER RUNNING
MANAGER STOPPED
REPLICAT STOPPED R_MYSQL 00:00:00 00:47:04
Manager started.
MANAGER RUNNING
REPLICAT RUNNING R_MYSQL 00:00:00 00:00:04
INSERT OPERATION
Enter password:
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights
reserved.
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
Database changed
+------------------+
| user() |
+------------------+
| CHITTI@localhost |
+------------------+
mysql>
mysql> INSERT INTO trans_type values(1,'SUGI');
mysql> COMMIT;
mysql>
GGSCI (rac1.rajasekhar.com) 15> stats E_MYSQL total
Output to ./dirdat/eo:
Output to ./dirdat/ra:
End of Statistics.
+----------+-------+
| trans_id | trans |
+----------+-------+
| 1 | SUGI |
| 2 | TEJU |
| 3 | RAJ |
| 4 | SOMU |
| 5 | SREER |
+----------+-------+
TRANS_ID TRANS
---------- -----
1 SUGI
2 TEJU
3 RAJ
4 SOMU
5 SREER
SQL>
UPDATE OPERATION
b1) Execute update on the Source Oracle Database MySQL
+----------+-------+
| trans_id | trans |
+----------+-------+
| 1 | SUGI |
| 2 | TEJU |
| 3 | RAJ |
| 4 | SOMU |
| 5 | SREER |
+----------+-------+
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
+----------+-------+
| trans_id | trans |
+----------+-------+
| 1 | SUGI |
| 2 | TEJU |
| 3 | RAJ |
| 4 | SOMU |
| 5 | SELVA |
+----------+-------+
mysql>
Output to ./dirdat/eo:
End of Statistics.
GGSCI (rac1.rajasekhar.com) 20> stats P_MYSQL total
Output to ./dirdat/ra:
End of Statistics.
GGSCI (rac1.rajasekhar.com) 21>
End of Statistics.
TRANS_ID TRANS
---------- -----
1 SUGI
2 TEJU
3 RAJ
4 SOMU
5 SELVA <------
SQL>
DELETE OPERATION
+----------+-------+
| trans_id | trans |
+----------+-------+
| 1 | SUGI |
| 2 | TEJU |
| 3 | RAJ |
| 4 | SOMU |
| 5 | SELVA |
+----------+-------+
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
+----------+-------+
| trans_id | trans |
+----------+-------+
| 1 | SUGI |
| 2 | TEJU |
| 3 | RAJ |
| 4 | SOMU |
+----------+-------+
mysql>
Output to ./dirdat/eo:
End of Statistics.
Output to ./dirdat/ra:
End of Statistics.
GGSCI (rac1.rajasekhar.com) 23>
TRANS_ID TRANS
---------- -----
1 SUGI
2 TEJU
3 RAJ
4 SOMU
SQL>
Process ID 13305