Sei sulla pagina 1di 16

12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook

Oracle GoldenGate 11g Handbook


Recent

Topics

PREV NEXT
Highlights
Chapter 9: Oracle

Chapter 11: Introd


Settings

Keyboard Shortcuts

Feedback

Sign Out

Settings

10 days left in your trial. Subscribe.


Feedback

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

People who finished this also enjoyed:

BOOK SECTION BOOK SECTION BOOK SECTION

Chapter 10: ACFS Performing a Configuring


Design and healthcheck of a GoldenGate for HA
Deployment live GoldenGate from: Oracle GoldenGate
from: Database Cloud configuration 11g Implementer's guide
Storage: The Essential from: Oracle GoldenGate by John P Jeffries
Guide to Oracle 11g Complete Cookbook by Ankur Gupta Released: February 2011
Automatic Storage Management by Released: September 2013 12 MINS
Certification / Databases
Prasad Bagal... 6 MINS
Released: August 2013 Certification / Databases
49 MINS
Certification / Databases

BOOK SECTION BOOK SECTION BOOK SECTION

CHAPTER 11: Chapter 10: Featured Object


Large Objects System and Classes
from: Pro Oracle Storage from: CATIA V5 Macro
Database 11g Administrators: Programming with Visual
Administration by Darl Manage Basic Script by Dieter
Kuhn Infrastructure with Ziethen
Released: December 2010 Released: March 2013
Cloud Control
38 MINS 145 MINS
Certification / Databases from: Oracle Enterprise Manager Cloud
Control 12c Deep Dive by Edward
Whalen...
Released: August 2013
54 MINS
Certification / Databases

https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 15/16
12/28/2014 Chapter10:GoldenGateforMySQLOracleGoldenGate11gHandbook

BOOK SECTION BOOK SECTION BOOK SECTION

The EU Privacy Creating CHAPTER 13: High


and Electronic heterogeneous Availability, Backup, and
Communications replication Recovery
Regulations (Simple) from: Expert Oracle Enterprise Manager
from: Essential Law for from: Instant Oracle 12c by Pete Sharman...
Marketers by Ardi Kolah GoldenGate by Tony Bruzzese Released: June 2013
Released: January 2013 Released: July 2013 89 MINS
25 MINS 6 MINS Certification / Databases
Business / Business Communication Certification / Databases

BOOK SECTION

Basic Principles
from: Audio Engineer's Reference Book,
2nd Edition by Michael Talbot-Smith
Released: February 2013
82 MINS
Digital Media

Recommended / Queue / Recent / Topics / Settings / Blog(http://blog.safaribooksonline.com) /


Support(http://msupport.safaribooksonline.com/?prod=flow) / Feedback / Sign Out
2014 Safari(http://www.safaribooksonline.com/).
Terms of Service / Privacy Policy

https://www.safaribooksonline.com/library/view/oraclegoldengate11g/9780071790888/ch10.html 16/16

Potrebbero piacerti anche