Sie sind auf Seite 1von 8

testDatabase Migration from MySql to Oracle 11g Using Golden Gate

This Document describes the basic method to migrate database from Mysql(supported version 5.1.15 and later ) to Oracle 11g using Golden Gate. This exercise has been carried out only for demo purpose and the data size is small.Intention of this exercise is to show data movement between MySql and Oracle using golden gate.

MySql Side Download and install the supported mysql version through msi(This download was for windows env).Configure and set the ports accordingly (port 3306 in my case).Once installed follow the below steps to login into mysql and create your tables for test purpose. C:\mysql u root p Password:*****(that was given during configuration) Mysql>show databasesmysql> show databases; +--------------------+ | Database +--------------------+ | information_schema | | mysql | |

| performance_schema | | test |;

I have used the default test database for the exercise. Version of mysqlmysql> select version(); +-----------+ | version() |

+-----------+ | 5.5.8-log | +-----------+ 1 row in set (0.02 sec)

Mysql>use database test; Mysql>create table ars(id int,data char(100)); Insert multiple values in the table.

Golden Gate installation and configuration for Mysql Download V23460-01.zip from Oracle Site. Follow the instructions to unzip the File. Unzip the file to d:\ggmysql Once done enter the user interface for GG D:\ggmysql\GGSCI Configure the following parameters To configure Manager 1. From the Oracle GoldenGate directory, run the ggsci program to open the Oracle GoldenGate Software Command Interface, commonly known as GGSCI. 2. In GGSCI, issue the following command to edit the Manager parameter file. EDIT PARAMS MGRD:\ggmysql>install addservice 3. Add the following parameter to specify the Manager port number. PORT <port_number> Type D:\ggmysql>install addservice Above command will register the manager with the given name and start the service Start manager and stop Managers are the command used for starting and stopping manager. Sample MGR.prm file on mysql side After the Manager has been configured lets configure the extract process and extrail process on mysql side.

1.2. Configure MySQL.INI

log-bin="C:/Program Files/MySQL/MySQL Server 5.1/log/test.bin" max_binlog_size=4096 binlog_format=row

1.3 Restart MySQL

2. OGG for MySQL 2.1 Configure extract

GGSCI> add extract exta, tranlogs, begin now GGSCI> add exttrail ./dirdat/ea, extract exta GGSCI> edit params exta

extract exta dboptions host localhost, connectionport 3306 sourcedb test, userid root, password mysql exttrail ./dirdat/ea table test.*;

GGSCI> start exta

2.2 Configure pump

GGSCI> add extract pump, exttrailsource ./dirdat/ea GGSCI> add rmttrail ./dirdat/ra, extract pump GGSCI> edit params pump Sample Pump File : extract pump rmthost localhost, mgrport 7809 passthru table test.*; Now Generate a defgen file which will contain the data definitions for the tables. defgen paramfile D:\ggmysql\dirprm\defgen.prm After this command successfully executes copy the file D:\ggmysql\dirdef\mysql.def to Target side in our case d:\ogg_source\dirdef\mysql.def Mysql.def will be used by the replication process on the target to Map the data. Golden Gate Configuration on the Oracle Side. Install Oracle 11g. Install V22233-01.zip Unzip the folder in d:\ogg_src\ Open the Golden Gate console from the command prompt Configure the manager as described above on a different port. D:\ogg_source>GGSCI Configure the replicat Process as below Add replicat repmysql
ADD REPLICAT rep, EXTTRAIL

./dirdat/ra, NODBCHECKPOINT

Edit params repmysql and insert the below in the repmysql.prm file ************************************************** --name the replicat process REPLICAT repmysql --helpful if more than one instnace on the box --SETENV (ORACLE_SID="ORA10GR2") USERID test@taqvi, PASSWORD source

--use the sourcedefs file to read the trail SOURCEDEFS .\dirdef\mysql.def --throw error records to discard file DISCARDFILE .\dirrpt\ggs_rep.dsc, purge --on encountering an error when applying data to the target db --set a global response to all errors which is --log the error ro the discard file but continue processing REPERROR default, discard REPORTCOUNT EVERY 1 MINUTES, RATE --increase the thruput of replicat processing by arranging --similar SQL statements into arrays and applying them --at an accelerated rate BATCHSQL --ignore truncates is default GETTRUNCATES --simple like-to-like mapping MAP test.*, TARGET test.*; --from here forward treat all updates & deletes as inserts INSERTALLRECORDS

Make sure that the def file is present in d:\ogg_source\dirdef\mysql.def.

Replication Process.

To migrate the existing data from mysql follow the steps below: 1> Make Sure the Replication process is not started on the target side. 2> Start the extract process on the source for the tables as defined in the defgen file.
3> Once the extract process is started enter info extract exta to check the copy

status .data will be dumped to trail file as described in the exta process group(in my case in dirdat/ea).info exta to check the last checkpoint time.

4> Make sure the same file also copied to the target directory as described in the

pump process above.In my case rmttrail ./dirdat/ra all the extract files generated should also be visible on the remote site.

Notes: Before starting the replicat process on Target(oracle) make sure that data structures have been created in exactly the same way as in source. Make sure user name and password for the replicat process to connect to Oracle database is correct.

Process to Start the replicat process on Target:

Make sure HANDCOLLISIONS parameter is set in the repmysql.prm file. Start replicat repmysql Info repmysql ( Note the time that was noted as in the extract process on source to make sure that all records has been processed). Once all records has been processed issue the following command send repmysql,NOHANDLECOLLISIONS and later on edit the repmysql file. Check for the records that have been replicated in the target(oracle) database.

Common Debugging Files: Ggerr.log This file is the error log generated for each golden gate session. D:\ggmysql\dirrpt folder will contain log files for replication process ,discard file if any record has been discarded.

Limitations:

Oracle GoldenGate supports InnoDB storage engine for a source MySQL database. To preserve transaction boundaries for a MySQL target, create or alter the target tables to the InnoDB transactional database engine instead of the MyISAM engine. MyISAM will cause Replicat records to be applied as they are received, which does not guarantee transaction integrity even with auto-commit turned off. You cannot roll back a transaction with MyISAM.

Sample output: mysql> select count(1) from taqvi2; +----------+ | count(1) | +----------+ | 10 |

+----------+ 1 row in set (0.00 sec)

mysql> SQL> select count (*) from taqvi2;

COUNT(*) ---------10

SQL>

Das könnte Ihnen auch gefallen