GoldenGate: MySQL to Oracle Heterogeneous Unidirectional Replication

Share via:

MySQL  to Oracle Heterogeneous  GoldenGate Unidirectional Replication

In this article we will see    MySQL to Oracle GoldenGate Unidirectional Replication.

Prerequisites for Replication:

1.Create two VM’s on your machine

2.Install MySQL on Source Sever.

3.Install Oracle Software and Create database on target.

4.Make sure two Vm’s are pinging each other.

Node Details :

MySQL(SOURCE)

The MySQL database name is ggadmin, and uses the innodb engine.

The MySQL server name is mysql1.

GG2(TARGET)

192.168.0.40   gg2.orcl.com   gg2

Database Name :ORCl

Instance Name : orcl

Download Goldengate Binaries 

Download GoldenGate binaries from Oracle.com using below link(Oracle)

https://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html

Make sure that you are using the correct OS version of binaries.

MySQL SOURCE ;

Starting on the MySQL database server, mysql1, install the GoldenGate software.

Start the MySQL 

Check MySQL is riunning or not

Check MySQL server status

Connect to MySQL and check the databases.

set the Bash_profile

Run the bash_profile

Edit my.cnf  file and add the following parameters

Now copy GoldenGate software into /opt

Unzip the S/W file

untar the file

Run the ./ggsci command and create sub directories

Check manager sunning or not , If not start the Mgr after specifying the port

Connect as Root user  and create users

Create database

Connect to oggdb1 and create objects

Create unique index on dept table

Verify that the MySQL ODBC connector is installed. As the root Linux user, run the following package manager query command:

login as root on OS:

If it doesn’t  exist, as root, create the /usr/local/etc/odbc.ini file. Add (or verify) the following in the file:

vi /usr/local/etc/odbc.ini

Connect to GGSCI on the Oracle server and create the initial load extract. Since these are small tables, we will use GoldenGate to do the initial load. If these were large tables, we would need to use a different, faster loading method such as load data infile. Also, note that the parameters point to the target (MySQL) database.

Login as oggadm1

Note : In case of Issues with login with mysql please follow below steps

Edit extmysql file

Add extract process

Add extrail file to extract process

Start Extract process

Add extract process for datapump(dpmysql)

Add remote trail file

Edit Datapump param file

Start dpmysql

Connect to mysql prompt and insert record into dept table

Connect  ggsci of mysql and cheek stats

ORACLE TARGET :

In Target side keep ready with Oracle Software installation and Oracle database Creation.

Steps to Install Oracle GoldenGate

Download GoldenGate Binaries 

Download GoldenGate binaries from Oracle.com using below link

https://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html

Make sure that you are using the correct OS version of binaries.

Setting bash_profile

Export the path in the bash profile

vi  .bash_profile

Run the bash_profile file

Check instance info :

Create directory for GoldenGate  home :

Create directory for gghome

Copy the downloaded file to /opt location  Using Winscp

Unzip GoldenGate Software :

Check file in /opt dir :

Now do runinstaller as Oracle user :

On step 1 choose version of your oracle software 

Click on Next

Browse  location for GG_HOME

Start Manager with any port number(Default 7809)

Click on Next

Check summary

Click on Install

Installation process and extracts files into target directory

Finally GG will successfully installed on GG1

Click on Close 

Goto GGS_HOME and connect to ./ggsci

Give info all to check manager process is running or not

Open New terminal for SQL prompt  On GG1 :

Connect to database and create user and tables

Enable the parameter for GoldenGate replication

Create admin for GoldeGate

Now execute below Package for additional privs

Add supplemental logdata on columns

GGSCI Prompt :

Login as ggamdin user 

Add Replicat process

Edit repmysql param file

Start the replicate process

check the stats repmysql

INSERT STATEMENT :

MySQL Source :

Oracle Target :

UPDATE STATEMENT :

MySQL Source :

Oracle Target :

DELETE STATEMENT :

MySQL Source 

Oracle Target :

Make changes and verify that they are being replicated, use the same method we used for Oracle.

Debugging notes: The file ggserr.log is in the GoldenGate home directory. It can be helpful to tail the file during the entire process on both the Oracle and MySQL server to identify any errors.

 

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

One thought on “GoldenGate: MySQL to Oracle Heterogeneous Unidirectional Replication

Add Comment