Chapter 10 - GoldenGate For MySQL - Oracle GoldenGate 11g Handbook
Chapter 10 - GoldenGate For MySQL - Oracle GoldenGate 11g Handbook
Topics
PREV NEXT
Highlights
Chapter 9: Oracle
Chapter 11: Introd
Settings
Keyboard Shortcuts
Feedback
Sign Out
Settings
CHAPTER
Sign Out
10
GoldenGateforMySQL
O
neofthemajorfeaturesofGoldenGatethatsetsitaboveother
replicationproductsisitssuperiorsupportforheterogeneous
replication.Inthischapterwewillbuildontheskillsusedto
replicatedatafromOracletoOracletoenablereplicationfromOracleto
MySQL,andreversetheprocessbycapturingdataonMySQLand
deliveringthedatatoOracle.
MySQLandGoldenGatearebothactivelydeveloped,sowhichversion
youareusingforGoldenGateandMySQLwilldeterminewhichfeatures
areavailable.Forthischapterwewillbeusingversions11.2for
GoldenGateand5.5forMySQLwiththeInnoDBstorageengineoption.
InthischapterwewillcoversettingupGoldenGateforMySQL.First,an
OracledatabasewillbeusedasasourceandtheMySQLdatabasewillbe
thetarget.Next,wewillreversetheprocessandcapturetransactions
fromMySQLandreplicatethechangestoanOracledatabase.
InstallingGoldenGateforMySQL
InthissectionwewilldiscusstheinstallationofGoldenGateforMySQL.
TheprocessisnotunlikeinstallingGoldenGateforOracle,soyoushould
feelrightathome,havingreadaboutthatprocessinChapter3.Inthis
sectionwewilldiscusspreparingtoinstallGoldenGateforMySQL,and
thenwewilldiscussactuallyperformingtheinstall.
PreparingfortheInstallationofGoldenGateonaMySQL
DatabaseServer
InthissectionGoldenGatebinarieswillbeinstalledandinitially
configured.YouwillfindtheGoldenGateinstallationforMySQLthe
sameasforotherUNIXlikeoperatingsystems.Evenbeforeyoustart
installingOracleGoldenGateforMySQL,youshouldchecktheOracle
certificationmatrixforGoldenGatetoensurethattheplatformyouare
runningMySQLoniscertified.Wehavediscussedthisprocessin
Chapter2,soyoushouldbefamiliarwithhowtocheckthecertification.
Atthetimeofthiswriting,thefollowingrequirementsexistedtorun
OracleGoldenGateonMySQL:
OracleLinux5.5Serverorhigher
MySQL5.5orhigherdatabaseandclientinstalledandrunning
withtheInnoDBstorageengine
Oracle11.2orhigherdatabaseinstalledandrunning
Enjoy Safari? Subscribe Today
Afteryouhavecheckedthecompatibilityrequirements,youarereadyto
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 1/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
startinstallingGoldenGateandthenbegintoreplicatedatafromOracle
toMySQL.
InstallingGoldenGateforMySQLonaMySQLDatabaseServer
YoucanfindGoldenGateforMySQLonOraclesEDeliverywebsite,as
discussedinChapter3.InsteadofselectingGoldenGateforOracle,you
willselectGoldenGateforyourversionofMySQL.Onceyouhave
downloadedthesoftware,theinstallstepsarethesameasinstallingfor
Oracle,namelyunzippinganduntarringthefile.Thiswasall
demonstratedearlierinthisbookinChapter3.
OnceyouhaveinstalledGoldenGate,youwillwanttotesttheinstallby
startingtheGGSCIinterfaceandcreatingthesubdirectoriesasshownin
Chapter3.AswiththeOracleversionofGoldenGate,theOSuserthatyou
willusetostartGGSCIwillneedtohaveaccesstotheMySQLclient
libraries.Forthisexercise,theGoldenGateprocesseswillrunasthe
sameOSuserastheMySQLdatabasetoensurethatGoldenGatehasthe
correctfilepermissionsfortheMySQLclientlibrariesandlaterto
ensureaccesstotheMySQLtransactionlog.
Next,weneedtocreateaparameterfilefortheGoldenGateManager
process.ThisissimilartowhatwedidinChapter5whenweconfigured
theManagerprocess.Hereisanexample:
OracletoMySQLGoldenGateReplication
WiththeGoldenGatesoftwareinstalledandaManagerprocessrunning,
wearereadytocontinuetosetupGoldenGateforourMySQLdatabase.
InthissectionwewillbeconfiguringanOracledatabaseasthesource
databaseandaMySQLdatabaseasthetargetdatabaseforGoldenGate
replication.Beforewecandoanyofthat,weneedtofirstgetourMySQL
databaseallsetup.Inthischapterweassumethatyouhavesomebasic
experienceadministeringaMySQLdatabase.Thereforewewillskip
basicprocessessuchasinstallingMySQL,usingMySQLutilities,andthe
like.
SettingUptheMySQLDatabase
BeforewecanstartconfiguringreplicationbetweenOracleandMySQL,
wewillneedtologintotheMySQLserverandthencreateadatabase
calledMYDBforthedestinationtables.
Whenreplicatingfromsimilardatabases,suchasreplicatingfromOracle
databasestoOracledatabases,creatingthedestinationschemacanbe
trivial.However,inspiteofthefactthatbothOracleandMySQLare
ANSIcompliant,theyaretwodifferentkindsofdatabases,andtherefore
wewilloftenfindDDLdifferencesbetweenthetablesonthesourceand
targetservers.Asaresult,weneedtotranslatetheDDLbetweenthetwo
databasessoOracleGoldenGatewillknowwhattodowiththetrailfile
informationthatitwantstoapply.
ThefirstthingweneedtodoistotranslateOracleDDLintoMySQL.
BetweenOracleandMySQLtherearesomedatatypedifferencesfor
example,MySQLdoesntsupportOraclesyntaxfordefiningnumeric
datatypes.Weneedtodealwiththesedifferences.
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 2/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
Inourcase,wehavesometablesthatwerecreatedinOracle,andnow
weneedtocreatetheminMySQL.TheOracleDDLisnotcompatible
withMySQL,andthereforewewillneedtoadjusttheDDLinordertobe
abletorecreatethetableinMySQL.HereisourinitialOracletable
DDL:
TheequivalentMySQLDDLwouldlooklikethis:
NotethattheNUMBERdatatypeinOracleisreplacedbyanINTdata
typeinMySQL.AlsonotethattheDDLtodefinetheprimarykeyin
MySQLisdifferentthanthatforOracle.Asyoumighthaveguessed,this
conversionofDDLcantakesometimeandeffort,asyouwillhaveto
performthisconversionforeachtablethatyouwanttoreplicateto.Ifyou
haveadatamodelingtoolthatyoumaintainyourdatabaseschemaDDL
in,youmaybeabletogetthattooltogenerateDDLforMySQL,rather
thanhavingtorecreatetheDDLonyourown.
YoucanconfirmthatthetablesarecreatedintheMySQLdatabaseby
usingtheMySQLcommandshowtablestatus,asseenhere(notethat
wehaveadjustedtheoutputyourdisplaywillprovidequiteabitmore
information):
PaycloseattentiontotheEnginecolumn.Ifyoufindthatanyofthe
tablesintheschemashowanenginelistedasMyISAM,youwillneedto
convertthemtoInnoDBorrecreatethem.GoldenGatedoesnotsupport
tablesusingtheMyISAMengine.Ifyoutrytoreplicatetoatableusing
theMyISAMengine,youwillseethefollowingerrorwhenreplicating
thetable:
OnceyouhaverecreatedthetablesintheMySQLschema,youwillnot
wanttoforgetaboutthecreationofotherschemaobjectssuchasindexes
andconstraints.
CreatingtheGoldenGateSchemaonMySQL
RecallthatwecreatedaGoldenGateadministrationschemainOracle.
WeneedtodothesamethingwithourMySQLdatabase.Westrongly
recommendthatyoucreatethisuserasonethatisdedicatedto
GoldenGateadministrativeoperations,andnothingelse.
WhencreatingtheMySQLGoldenGateschema,youwillneedtogrant
thefollowingrightsforaReplicatprocess:
Insert,Update,andDeleteprivilegesonallreplicatedtables
CreateTableprivilege
Executeprivilege
Togranttherequiredprivileges,logontotheMySQLcommandprompt
withanaccountthathastherightstocreateanewuser,andassign
privilegestotheGoldenGateuser.Hereisanexample:
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 3/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
PerformingtheInitialLoadfromOracletoMySQL
Next,weneedtoperformtheinitialloadofdata,populatingtheMySQL
schemathatwehavecreated.Wehavecoveredhowtoconfigure
GoldenGateonOracletoreplicatethecontentsofagivenschema
throughtheExtractprocesstothetargetdatabase.PleaserefertoChapter
5formoreinformationonthisprocess.
Therearesomesubtledifferenceswewanttopointoutbetweenwhatyou
doinChapter5andwhatyouwilldowhenpopulatingtheMySQLtarget
database.First,theparameterfilethatyouwillcreatewilllooklikethe
parameterfilescreatedforreplicationonanOracleGoldenGate
database.Theonlythingyouneedtochangewillbetomakesurethatthe
RMTHOSTparameterispointingtotheMySQLdatabaseserver,and
thattheportaddressiscorrect.RecallfromChapter5thattheRMTASK
parameterwillcausethereplicatautomatically,sowedonthavetoworry
aboutthatpartoftheprocess.
ItisreallykindofnicebecausetheconfigurationoftheExtractprocess
whenmovingdatatoMySQLisprettymuchthesameasitiswhen
movingittoOracle.Inthesecodeexamples,wehavecreatedtheExtract
process.Wehavealsoprovidedyouwiththecontentoftheextract
parameterfile:
CreatingtheDefinitionFile
OnethingthatisdifferentfromtypicalOracletoOraclereplicationisthe
conversionofthedatatypesbetweenOracleandMySQL.Justaswehad
toconverttheDDLwiththecreatetablecommandearlier,wewillneed
tohaveGoldenGateconvertthedatainthetrailfilessothatitwillapply
properly.Asaresultweneedtocreateadefinitionfile.Weintroduced
youtotheconceptofthedefinitionfileandthedefgenutilityinChapter
8.Thedefinitionfilecontainsmetadataaboutthetablesbeing
replicated,includingcolumnnamesanddatatypes.Thedefgenutilityis
usedtocreatethedefinitionfile.
TheparameterfilethatwewillcreateisliketheotherGoldenGate
parameterfiles.ItissimplyanASCIIfilethatyoucreatewithyour
favoriteeditorlikevi.Wewillcreatetheparameterfileinthedirprm
directoryundertheOracleGoldenGateHomedirectory.Hereisan
exampleofadefinitionfilethatwewillcalldefgen.prm:
Thisparameterfilehasafewinterestingandnewparametersinit.First,
thereistheDEFSFILEparameter,whichpointstothedefinitionfilethat
willbecreatedwhenwerunthedefgenutility,usingthisparameterfile,
tocreateourobjectdefinitionsfile.TheUSERID,PASSWORD,and
TABLEparametersarethesameaswehaveusedinpreviousparameter
files.WediscussedtheseparametersextensivelyinChapter5,soreferto
Chapter5ifyouwantmoreinformationonthem.
Nowthatwehavecreatedourparameterfile,wearereadytorunthe
defgencommandlineutilitytogeneratethedefinitionfile.SeeChapter
8formoredetailonthedefgenutilityingeneral.Tocreatethedefinition
file,wecallthedefgenutility,passingtoitthenameoftheparameterfile
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 4/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
wejustcreated.Hereisanexample(notethatwehavesomewhatedited
thisexampleforsizeandredundancyconsiderationsyouroutputwould
belonger):
ThisfileneedstobecopiedtotheMySQLservertoenablethereplicatto
beabletoreadthedefinitionduringreplication.Asaresultwewillmove
thesoeobject.sqlfilefromtheOracleGoldenGateinstallationdirsql
directorytotheMySQLGoldengateinstallationdirsqldirectory.Once
thefilehasbeencopiedovertothedirectory,wearereadytopopulatethe
tables.WewillusethesameprocessthatweusedinChapter5,allowing
GoldenGatetodotheinitialpopulationofdatafromthesourceOracle
databasetothetargetMySQLdatabase.
InitialLoadingoftheMySQLSchema
Beforewecanstartnormalreplication,weneedtopopulatetheMySQL
databaseschemawiththedatathatisintheOracledatabaseschema.We
didthisinChapter5usingaspecialGoldenGateReplicatandExtract
process,andwewilldothesamethinghereaswell.
Tobeginwith,youwillwanttocreateaManagerprocessparameterfile
onboththeOracleserverandtheMySQLserver.Thereareexamplesof
thisinChapter5.AswementioninChapter5,youshouldensurethatthe
managerportisthesameastheMGRPORTdefinedintheextract
parameterfile.SeeChapter5foranexampleofthecreationofa
Managerprocessparameterfile.
HavingcreatedtheManagerprocessparameterfile,wewillcreatea
replicatparameterfile(ascoveredinChapter5)fortheReplicatprocess
(ontheMySQLnode).Theparameterfilewilllooklikethis:
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 5/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
Thisfileshouldlookfamiliar.FirstwenametheReplicatprocess.The
targetdbprovidestheconnectionstringtothetargetdatabase(aMySQL
database).IfyoureconnectingtoadatabaseonthelocalhostandtheOS
isLinuxorUNIX,thedirectoryusedforthesocketfilemustbein/tmpfor
GoldenGatetobeabletoconnecttotheMySQLdatabase.Refertothe
officialdocumentationforyouroperatingsystemandversionofMySQL
ifthisisnotthecase.
OurparameterfilealsocontainstheSOURCEDEFSparameter,which
definesthelocationofthedefinitionfilewecreatedearlierinthis
chapter.Finally,wehavetheMAPparameter,whichyoushouldbevery
familiarwithbynow.TheMAPparameterspecifiesthatalldatareceived
fromtheSOEschematablesshouldbereplicatedtothesametablenames
intheMYDBdatabase.Thisisoneofthepowerfulfeaturesof
GoldenGate,beingabletoreplicatedatabetweendissimilarschemas
(thoughtheheterogeneousreplicationfeaturesarealsoprettypowerful
stuff!).
Havingcreatedtheparameterfile,wethenaddtheReplicatprocesson
thetargetnode:
RecallthatinChapter5,thisspecialReplicatprocessrunsonlyonce,
ratherthanallthetimelikeanormalReplicatprocess.Alsorecallthat
thereisnoExtractprocessconfiguredforthiskindofReplicatprocess.
Letsreviewthestepswehavecompletedsofar.AManagerprocesshas
beendefinedonboththesourceandtargetsystems,andanextracthas
beencreatedfortheinitialload.WecreatedtheinitialschemainMySQL
andcreatedadefinitionfiletotranslatetheobjectsinOracletothosein
MySQL,andareplicathasbeencreatedtopopulatedatafromtheinitial
load.
Weshouldnowbereadytostarttheextractandloadtheinitialdatafrom
OracleintoMySQL.Todothis,ensurethattheManagerprocessis
runningonboththetargetandsourceinstanceofGoldenGateandstart
theextractonthesource.Donotstartthereplicatonthetarget.Ifyou
recall,theextracthasanRMTTASKparameter,whichwillstartthe
replicatonthetargetsystem.Hereisanexampleofrunningthisprocess:
Wecanseethestatusoftheconversionprocessduringthedataloadby
lookingattheggserr.logfile(maybeusingtailfonthefile)onthe
MySQLserver,asseeninthisexampleoutput:
Wecanseethattheconversionsareworkingjustasweexpected.
WeknowthattheExtractprocessshouldhavecausedtheReplicatprocess
tostartonthetargetserver,andweknowthattheExtractandReplicat
processeswillautomaticallystopwhentheinitialdatahasbeencopied
over.WecanchecktheprogressbytailingtheoutputfilesoftheExtract
andReplicatprocesses.Wecanalsochecktheprocessbycomparingrow
countsbetweenthetablesbeingloaded,orwecanrunthestats
commandfromtheGoldenGatecommandlinetodisplaythestatistics
associatedwiththeruns(seeChapter5formoreonallthesetechniques).
Sincethisdatatransferisaonetimejob,anormalGGSCIinfoall
commandwillnotshowtheextractorreplicat.Instead,runtheGGSCI
commandinfoallwiththeTASKSparameter(forexample,infoall,
tasks)toseethestatusoftheprocessasseenhere:
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 6/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
Dependingonhowmuchdatayouareloading,wewillwanttocheckthe
statusoftheloadprocessperiodically.Againwecanusetheinfoall,
taskscommandtoperformthischeck.Onceweseeastatusofstoppedfor
ourextract,weknowthattheprocesshascompleted.Hereisanexample
oftheoutputofacompletedprocess.Notewearerunningthecommand
onboththesourcedatabasenodeandthetargetdatabasenode:
CreatingtheOracleExtractProcessandtheMySQLReplicat
Process
NowthatwehavepopulatedtheMySQLschema,wecancreateanextract
ontheOracledatabaseserver,andareplicatontheMySQLserver.
Thesearetheprocessesthatwillperformtheongoingreplication
betweenourtwoservers.
First,letscreatetheextract.Asyoumightexpect,wefirstcreatea
parameterfileandthenaddtheextractmuchasyouhavealreadyseen
inChapter5.Firstwecreatetheparameterfile:
NextweaddtheextractjustaswedidinChapter5.Hereisanexample:
EventhoughthetargetisaMySQLdatabase,theextractsettingsarethe
sameasifthetargetwereanotherOracledatabase.Forbrevity,forthis
exercisewearenotusingaDataPumpprocess,butthecreationprocess
isjustasyouhavealreadyseeninChapter5.
WeneedtocreatetheremotetrailfilefortheExtractprocesstowriteto
ontheMySQLdatabaseserver.Again,thislooksquitelikethesame
processweusedwhendoingOracletoOraclereplicationinChapter5:
Now,ontheMySQLserverwecreatethereplicatparameterfile,much
liketheoneseeninthisexample:
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 7/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
Theparameterfileshouldlookveryfamiliar.Notethatweusedthe
HANDLECOLLISIONSparameterjustaswedidinChapter5.Thisway,
thesourcedatacancontinuetochangewhiletheinitialloadisbeing
executed.OncewestarttheReplicatprocess,theHANDLECOLLISIONS
parameterwillcauseGoldenGatetoignoreprimarykeyviolations
duringtheinitialreplicationprocesswherethechangesthatoccurred
duringtheinstantiationofthedatabaseareapplied(sincesome
transactionsmightoverlapandbeduplicatedduringthistime).Aswe
mentionedinChapter5,oncetheinitialloadiscompleteandthedelta
changessenttothetarget,youshouldnotuseHANDLECOLLISIONSfor
daytodayreplication.
WecannowaddthereplicatinGGSCIontheMySQLsidetoprocessour
daytodayreplicationasseenhere:
NowletsstarttheReplicatprocesswejustdefined:
Ofcourse,wealsohavetostarttheExtractprocessontheOracleside:
NowboththeExtractandReplicatprocessesarerunning.Wecan
monitorreplicationactivityonboththesourceandtargetbyrunningthe
statscommand.Hereisanexampleoftheresultofrunningthestats
commandontheExtractprocess(notethatwehaveremovedsomeofthe
outputforthesakeofbrevityandtosaveatreeortwo):
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 8/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
HereisanexampleofthestatisticsreportontheReplicatprocess,again
reformattedforbrevityandtreepreservation:
Fromthestatsoutput,youwillseethatmorerowshavebeenreplicated
thanextracted.Thereareseveralpossiblereasonsforthis.Thestats
commandonlyshowsstatisticssincetheExtractorReplicatprocess
started.Whenaprocessisrestarted,thestatisticsstartagainatzero.Soif
anExtractprocessisrestartedbuttheReplicatprocessisleftrunning,the
replicatstatisticswillshowmorerowsprocessedthantheextract.Also,if
theextractshowsmorerowsbeingprocessedthanareplicat,itcould
meantherearetransactionsinflighttransactionsthathavebeen
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 9/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
extractedbuthaventyetbeenprocessedbythereplicat.Unlessyouare
verifyingreplicationandabletoexactlycontrolwhenasingle
transactionisreplicated,usingthestatscommandisnotagoodwayof
verifyingwhetherallthedataisbeingreplicated.
So,wehavecreatedanextractandreplicattoperformtheinitialload,
andcreatedadefinitionfilesincethesourceandtargetaredifferent
databaseplatforms.Wehavealsocreatedanotherextractandreplicatfor
ongoingreplication.Aftertheinitialloadwascompleted,westartedthe
ongoingextractandreplicatandviewedthestatisticsofthereplication
job.Thatwasalotofwork,butstill,thereismoretodo!Now,lets
replicatefromMySQLtoOracle!
ReplicatingfromMySQLtoOracle
Inthissectionwewillreversetheprocessandsenddatafromatableina
MySQLdatabasetoatableinanOracledatabase.Wewillcreateatable
toreplicate,generateadefinitionfile,verifythatGoldenGatehasthe
permissionstoreplicationfromMySQL,andcreateanextractand
replicate.
DefiningtheObjectsandGeneratingtheDefinitions
InthiscasewearejustgoingtoreplicateonetableintheMySQL
databasetoourOracledatabase.Thistablecontainspersonalcontact
informationandhasthefollowingdefinition:
KeepinginmindthattherearedifferencesbetweendatatypesinOracle
andMySQL,itsnosurprisethatthedefinitionofthetableontheOracle
sideisslightlydifferent.Forthisexercisewewillbeusingthesame
OracleschemaweusedwhenreplicatingfromOracle.HereistheOracle
DDLfortheobjectthatwewillbereplicating:
Theresaflyintheointmenthere.TheMySQLtableisusingan
automaticallyincrementingcolumntype(likelyasasouragatekey),
whichisnotsupportedbyOracle.WewanttomakesurethattheOracle
tablewillusethesamevaluethatGoldenGatereplicates,sonosequence
willbeused.So,inthiscasewedontneedasequenceontheOracleside
wewillsimplyreplicatethevalueasis.Also,theusernametheReplicat
processwillbeusingwillneedtobeabletologintothedatabaseand
haveSelect,Delete,UpdateandInsertprivilegesforthetablesyouare
replicating,justasifyouwereperformingOracletoOraclereplication.
SeeChapter5fordetails.
Also,paycarefulattentiontotheENGINEclausefortheMySQLtable(we
mentionedthisearlierbutthoughtitwasimportantenoughtomention
again).InordertobeabletoreplicatedatafromMySQL,thetablemust
useInnoDBforthestorageengine.Also,beawarethatselect
permissionsmustbegrantedfortheusernameGoldenGateisusingfor
theextract.GoldenGatewillalsoneedtoexecuteandreadpermissions
forthedirectorythatholdsyourMySQLconfigurationfile,my.cnf,and
readpermissionforthefileitself.CheckwithyourOSonwherethe
defaultlocationisforthefile.Inaddition,ensurethatyourLOGBINand
LOGBININDEXparametersaresettoalocationwhereyouwantthelog
filestobewritten,andsetBINLOG_FORMATtorow.Theparameter
LOGBINstoresthelocationwhereMySQLshouldstorethetransaction
log,andLOGBININDEXstoreswhichlogfileshavebeenused.
GoldenGateneedstoknowwherethelogsareinordertoreadthem.The
BINLOG_FORMATparameteraffectshowrecordsareformattedinthe
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 10/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
transactionlogfile.
WehavenowcreatedthetableonboththeOracleandMySQLdatabase.
WealsoknowthatweneedtocreateadefinitionfileontheMySQL
serverandtransferittotheOracleserver.Hereisanexampleofdoing
justthat:
AswedidearlierinthischapterwhenweweremovingdatafromOracle
toMySQL,wewillusethedefgenutilitytocreatethedefinitionfilefrom
theparameterfileandcopythefiletotheOracleserver.
InitialPopulationoftheOracleTablefromMySQLUsing
GoldenGate
WehavenowcreatedthetableinOraclethatwewillreplicateto,andwe
havecreatedthedatadefinitionsfilethatisneededbytheExtractand
Replicatprocesses.NowweneedtocreatetheExtractandReplicat
processestodotheinitialpopulationofthetableinOraclefromthedata
inMySQL.
Wewillberepeatingthestepsfromthebeginningofthechapterbut
switchingthetargetandsource.Anextractfortheinitialloadwillbe
created,adefinitionfilewillbemadeontheMySQLserver,andonthe
Oraclesideareplicatwillbecreatedfortheinitialload.
First,letscreatetheextractandtheparameterfileontheMySQLserver.
Thecommandsandoptionsarethesameasinthefirstexercise.Onlythe
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 11/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
connectionstringwaschangedtotheMySQLdatabase,aswellasthe
tablethatwillbeinitiallyloaded.Next,letscreatethedefinitions
parameterfile.Thisisdonebyusingthedefgenutilitytocreatethe
definitionsfileontheMySQLserver.Thentheresultingdefinitionsfile
willbecopiedtotheOracleserverwhichisthetargetserver:
RunthedefgenutilityandcopythecreatedfiletotheOracleserver.
OntheOracleserver,wewillcreateareplicatandparameterandthen
wewillbereadytoperformtheinitialload.
Withtheextract,replicat,anddefinitionfilecreated,allthatisleftisto
starttheextractontheMySQLserverandwaitfortheinitialloadto
finishjustasbefore.
ConfiguringReplicationBetweenMySQLandOracle
HavingpopulatedtheOracledatabasetablewiththedatafromMySQL,
wenowcancreatetheregularExtractandReplicatprocesses.Recallthat
wewillextractfromtheMySQLdatabaseandthenapplythetrailfileto
theOracledatabase.
FirstwewillcreatetheExtractprocessfileontheMySQLdatabase
serverside,asseenhere:
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 12/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
Anewparameter,ALTLOGDEST,isusedforMySQL.Thisparameter
stateswhereGoldenGateshouldfindthelogfilescreatedbyMySQL.
Wehavenowcreatedtheextractandweneedtoaddtheextractto
GoldenGateasseenhere:
Nowweneedtoaddtheremotetrailfiletotheprocess.Notethatthe
remotetrailfilewillresideontheOracleDatabaseserverandthatthis
commandisexecutedontheMySQLserverside:
NowthattheExtractprocesshasbeencreated,wewillcreatetheReplicat
processontheOracleserverside.Hereistheparameterfileforthe
replicat:
Ofcourse,weneedtoaddthereplicattoo:
AndnowwestarttheReplicatprocessontheOracleside:
Next,wecanstarttheextractandinsertdataintothetableandverify
thatthedataisreplicatedtotheOracledatabaseusingbothSQL*Plusand
runningthestatscommandfromtheGoldenGatecommandline.Onthe
MySQLserver,starttheExtractprocessandinsertarowinthetable.
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 13/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 14/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
PREV NEXT
Chapter 9: Oracle Chapter 11: Introd
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 15/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook
BOOK SECTION
Basic Principles
from: Audio Engineer's Reference Book,
2nd Edition by Michael Talbot-Smith
Released: February 2013
82 MINS
Digital Media
https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 16/16