版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
以下演示部分采用RHELLINUX系统,数据库采用ORACLE主机updba上soctt用户下数据同步到主机upgg上scottupdba,upgg服务器上scott数据一致<<数据迁移>>课程中也讲述过很多种迁移技巧。大家也可以用goldengate数据迁移的办法。[oracle@updba~]$sqlplus SQL*Plus:Release11.2.0.3.0ProductiononSatJun1618:59:402012Copyright(c)1982,2011, AllrightsConnectedOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,[oracle@updba~]$[oracle@upgg~]$sqlplus SQL*Plus:Release11.2.0.3.0ProductiononSatJun1619:04:542012Copyright(c)1982,2011, AllrightsConnectedOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,[oracle@upgg~]$安装上gg2.1--2.7部分在 与upgg服务器上均操建立运行goldengate这里采用oracle软件运行用户oracle,注意修改ORACLE_SID,ORACLE_HOME,LD_LIBRARY_PATH变量#.bash_profile#Getthealiasesandfunctionsif[-f~/.bashrc];then.#UserspecificenvironmentandstartupprogramsexportORACLE_BASE=/u01/oracleexportORACLE_HOME=/u01/oracle/11gexportexportPATH初始化建立gg管理用 本例中为SQL>createtablespace ggdatadatafile'$ORACLE_BASE/oradata/$ORACLE_SID/ggdata01.dbf'size200m;Tablespacecreated.SQL>create ggmidentifiedbyoracledefaulttablespaceggdata;Usercreated.SQL>grantconnect,resourcetoggm;Grantsucceeded.SQL>grantdbatoggm;Grantsucceeded.配置managerupdba[oracle@upgg~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights GGSCI )1>editparamsport~"dirprm/mgr.prm"1L,10CGGSCI( )2>startmgrManagerstarted.GGSCI )3>infoManagerisrunning(IP GGSCI )配置DML同[oracle@updba~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI(u )1>infomgrManagerisrunning(IPport GGSCI(u )2>addextractescott,tranlog,beginnow,threads1EXTRACTadded.GGSCI )3>infoextract 2012-06-16 StatusCheckpointLag 00:00:00(updated00:00:12ago)LogReadCheckpoint OracleRedoLogs Thread1,Seqno0,RBASCN0.0GGSCI(u )4>editparamsescottextractescottuseridggm,passwordoraclermthostupgg,mgrport7809rmttrail./dirdat/establescott.dept;tablescott.emp;tablescott.bonus;~"dirprm/escott.prm"[New]8L,165CGGSCI(u )5>addrmttrail./dirdat/es,extractescottRMTTRAILadded.GGSCI(u )6>informttrail./dirdat/esExtractTrail:./dirdat/esSeqno:RBA:FileSize:GGSCI )7>infoextract 2012-06-16 StatusCheckpointLag 00:00:00(updated00:02:32ago)LogReadCheckpoint OracleRedoLogs Thread1,Seqno0,RBASCN0.0RemoteTrail Max Extract Not 06-1619:14Current Reportfile /u01/goldengate/112101/dirrpt/ESCOTT.rpt(doesnotyetexist)Parameterfile Checkpointfile Processfile Stdoutfile Errorlog GGSCI )[oracle@upgg~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI( )1>infomgrManagerisrunning(IPport GGSCI( )2>editparams./GLOBALSGGSCHEMAGGM~"./GLOBALS"2L,40CwrittenGGSCI )3>[oracle@upgg~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr232012Copyright(C)1995,2012,Oracleand/oritsaffiliates.All GGSCI( )1>dbloginuseridggm,passwordoracleSuccessfullyloggedintodatabase.GGSCI( )2>addcheckpointtableckptabSuccessfullycreatedcheckpointtableckptab.GGSCI )3>[oracle@upgg~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI( )1>addreplicatrscott,exttrail./dirdat/esREPLICATadded.GGSCI( )2>editparamsrscottreplicatrscottuseridggm,passwordmapscott.dept,targetscott.dept;mapscott.emp,targetscott.emp;mapscott.bonus,targetscott.bonus;~"dirprm/rscott.prm"[New]9L,259CwrittenGGSCI( )3>[oracle@upgg~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI( )1>startreplicatrscottSendingSTARTrequesttoMANAGER...REPLICATRSCOTTstartingGGSCI )2>inforeplicat StatusCheckpointLag 00:00:00(updated00:00:02ago)LogReadCheckpoint File./dirdat/es000000First GGSCI )[oracle@updba~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI(u )1>startextractescottSendingSTARTrequesttoMANAGER...EXTRACTESCOTTstartingGGSCI )2>infoextract CheckpointLag 00:00:00(updated00:23:53ago)LogReadCheckpoint OracleRedoLogs Thread1,Seqno28,SCN0.0GGSCI )DML操作之前SQL>selectsalfromempwhere
SQL>selectsalfromempwhereDML操作SQL>updateempsetsal=sal+1;14rowsupdated.SQL>insertintosalgradevalues(6,10000,15000);1rowcreated.SQL>commit;SQL>selectsalfromempwhereSQL>select*from 1234566rows可以看到DML已经同步localtrail方式同步[oracle@upgg~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI( )2>stopreplicatrscottSendingSTOPrequesttoREPLICATRSCOTT...Requestprocessed.GGSCI )3>deletereplicatOracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights GGSCI(u )1>stop SendingSTOPrequesttoEXTRACTESCOTT...Requestprocessed.GGSCI ) extract[oracle@updba~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI )GGSCI(u )2>addextractescott,tranlog,beginnowEXTRACTadded.GGSCI(u )3>addexttrail./dirdat/lt,extractescottEXTTRAILadded.GGSCI(u )4>addextractdpump,exttrailsource./dirdat/ltEXTRACTadded.GGSCI(u )5>editparamsescottextractescottuseridggm,passwordexttrail./dirdat/lttablescott.dept;tablescott.emp;tablescott.bonus;~~"dirprm/escott.prm"7L,139CGGSCI(u )6>addrmttrail./dirdat/rt,extractdpumpRMTTRAILadded.GGSCI(u )7>editparamsdpumpextractdpumpuseridggm,passwordrmttrail./dirdat/rttablescott.dept;tablescott.emp;tablescott.bonus;~~"dirprm/dpump.prm"[New]9L,174CwrittenGGSCI(u )8>[oracle@upgg~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI( )1>addreplicatrscott,exttrail./dirdat/rtREPLICATadded.GGSCI( )2>editparamsrscottreplicatrscottuseridggm,passwordoraclemapscott.emp,targetmapscott.bonus,targetscott.bonus;~"dirprm/rscott.prm"7L,204CGGSCI )[oracle@updba~]$OracleGoldenGateCommandInterpreterforLinux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights GGSCI )1>infoManagerisrunning(IPport GGSCI(u )2>viewparamsescottextractescottexttrail./dirdat/lttablescott.dept;tablescott.emp;tablescott.bonus;GGSCI(u )3>startextractescottSendingSTARTrequesttoMANAGER...EXTRACTESCOTTGGSCI )4>infoextract LastStarted2012-06-16 CheckpointLag 00:01:05(updated00:00:08ago)LogReadCheckpoint OracleRedoLogs2012-06-1621:12:26 Seqno29,RBASCN0. GGSCI )5>viewparamsextractuseridggm,passwordoraclermthostupgg,mgrport7809rmttrail./dirdat/rttablescott.dept;tablescott.emp;tablescott.bonus;GGSCI(u )6>startextractdpumpSendingSTARTrequesttoMANAGER...GGSCI )7>infoextract LastStarted2012-06-16 StatusCheckpointLag 00:00:00(updated00:00:00ago)LogReadCheckpoint File./dirdat/lt000000First [oracle@upgg~]$OracleGoldenGateCommandInterpreterfor Linux,x64,64bit(optimized),Oracle11gonApr23201208:32:14Copyright(C)1995,2012,Oracleand/oritsaffiliates.Allrights.GGSCI )1>infoManagerisrunning(IP GGSCI( )2>viewparamsrscottreplicatrscottuseridggm,passwordmapscott.emp,targetmapscott.bonus,targetscott.bonus;GGSCI( )3>startreplicatrscottSendingSTARTrequesttoMANAGER...GGSCI )4>inforeplicat StatusCheckpointLag 00:00:00(updated00:00:04ago)LogReadCheckpoint File./dirdat/rt000000 GGSCI )SQL>select*from 1234566rowsSQL>selectsalfromempwheredeptno=10;SQL>select*from 1234566rowsSQL>selectsalfromempwheredeptno=10;SQL>update 14rowsupdated.SQL>deletesalgradewheregrade=6;1rowdeleted.SQL>commit;SQL>select*from 12345SQL>selectsalfromempwheredeptno=10;可以看到DML操作已经同步了DDL同updba,upgg上如下打开DDL支持[oracle@updba~]$cd$GG_HOME[oracle@updba112101]$sqlplus SQL*Plus:Release11.2.0.3.0ProductiononSatJun1621:33:442012Copyright(c)1982,2011,Oracle. Allrights.ConnectedOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,SQL>startmarker_setup.sqlMarkersetupYouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseobjects.NOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisEnterOracleGoldenGateschemaMarkersetuptablescriptcomplete,runningverificationPleaseenterthenameofaschemafortheGoldenGatedatabaseSettingschemanametoScriptcomplete.SQL>startddl_setupOracleGoldenGateDDLReplicationsetupYouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseNOTE:ForanOracle10gsource,thesystemrecyclebinmustbedisabled.ForOracle11gandlater,itcanbeNOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisEnterOracleGoldenGateschemaname:ggmWorking,pleasewait...SpoolingtofileCheckingforsessionsthatareholdinglocksonOracleGoldenGatemetadatatables...Checkcomplete.UsingGGMasaOracleGoldenGateschemaname.Working,pleasewait...DDLreplicationsetupscriptcomplete,runningverificationscript...PleaseenterthenameofaschemafortheGoldenGatedatabaseobjects:SettingschemanametoGGMCLEAR_TRACE No No No No No NoINITIAL_SETUP No NoDDLVERSIONSPECIFICPACKAGE No No No NoDDLREPLICATIONPACKAGEBODY No NoDDLIGNORE PACKAGE No NoDDLAUXPACKAGEBODY No No PACKAGE No No PACKAGEBODY No NoDDLDUMPLOGGROUPSDDLTRIGGERCODE No NoDDLTRIGGERRUNNINGSTATUS0LOCATIONOFDDLTRACEyzinginstallationstatus...STATUSOFDDLSUCCESSFULinstallationofDDLReplicationsoftwarecomponentsScriptcomplete.SQL>startGGSRolesetupThisscriptwilldropandrecreatetheroleTouseadifferentrolename,quitthisscriptandthenedittheparams.sqlscripttochangethegg_roleparametertothepreferredname.(Donotrunthescript.)YouwillbepromptedforthenameofaschemafortheGoldenGatedatabaseobjects.NOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisEnterGoldenGateschemaname:ggmWrotefilerole_setup_set.txtPL/SQLproceduresuccessfullyRolesetupscriptGrantthisroletoeachuserassignedtotheExtract,GGSCI,andManagerprocesses,byusingthefollowingSQLGRANTGGS_GGSUSER_ROLETOwhere<loggedUser>istheuserassignedtotheGoldenGateprocesses.SQL>grantggs_ggsuser_roletoggm;Grantsucceeded.SQL>startddl_enableTriggerSQL>startddl_pinPL/SQLproceduresuccessfullyPL/SQLproceduresuccessfullyPL/SQLproceduresuccessfullycompleted.[oracle@upgg~]$cd [oracle@upgg112101]$sqlplus/ SQL*Plus:Release11.2.0.3.0ProductiononSatJun1621:47:172012Copyright(c)1982,2011,Oracle. Allrights.ConnectedOracleDatabase11gEnterpriseEditionRelease11.2.0.3.0-64bitProductionWiththePartitioning,OracleLabelSecurity,OLAP,DataMining,SQL>startmarker_setupMarkersetupYouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseobjects.NOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisinstallation.EnterOracleGoldenGateschemaname:ggmMarkersetuptablescriptcomplete,runningverificationPleaseenterthenameofaschemafortheGoldenGatedatabaseSettingschemanametoScriptcomplete.SQL>startddl_setupOracleGoldenGateDDLReplicationsetupYouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseNOTE:ForanOracle10gsource,thesystemrecyclebinmustbedisabled.ForOracle11gandlater,itcanbeNOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisEnterOracleGoldenGateschemaname:ggmWorking,pleasewait...SpoolingtofileCheckingforsessionsthatareholdinglocksonOracleGoldenGatemetadatatables...Checkcomplete.UsingGGMasaOracleGoldenGateschemaname.Working,pleasewait...DDLreplicationsetupscriptcomplete,runningverificationscript...PleaseenterthenameofaschemafortheGoldenGatedatabaseobjects:SettingschemanametoGGMCLEAR_TRACESTATUS: No No No No No NoINITIAL_SETUP No NoDDLVERSIONSPECIFICPACKAGE No No No NoDDLREPLICATIONPACKAGEBODY No NoDDLIGNORE PACKAGE No NoDDLAUXPACKAGEBODY No No PACKAGE No No PACKAGEBODY No NoDDLDUMPDDLDUMPLOGGROUPSDDLTRIGGERCODE No NoDDLTRIGGERRUNNINGSTATUS0LOCATIONOFDDLTRACEyzinginstallationstatus...STATUSOFDDLSUCCESSFULinstallationofDDLReplicationsoftwarecomponentsScriptcomplete.SQL>startGGSRolesetupThisscriptwilldropandrecreatetheroleTouseadifferentrolename,quitthisscriptandthenedittheparams.sqlscripttochangethegg_roleparametertothepreferredname.(Donotrunthescript.)YouwillbepromptedforthenameofaschemafortheGoldenGatedatabaseobjects.NOTE:Theschemamustbecreatedpriortorunningthisscript.NOTE:StopallDDLreplicationbeforestartingthisEnterGoldenGateschemaname:ggmWrotefilerole_setup_set.txtPL/SQLproceduresuccessfullyRolesetupscriptGrantthisroletoeachuserassignedtotheExtract,GGSCI,andManagerprocesses,byusingthefollowingSQLGRANTGGS_GGSUSER_ROLETOwhere<loggedUser>istheuserassignedtotheGoldenGateSQL>grantggs_ggsuser_roleto Grantsucceeded.Triggeraltered.SQL>startddl_
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 茶叶加盟运营管理方案
- 重庆财经学院《结构力学》2022-2023学年第一学期期末试卷
- 茶业基础课程设计思路
- 重庆财经学院《电子编辑与排版》2021-2022学年期末试卷
- 碑林区厂房防水施工方案
- 白改黑农村道路施工方案
- 玻镁板铝塑板施工方案
- 炒面豆课程设计
- 潮汕旅游文化研究报告
- 二年级数学计算题专项练习
- (高清版)JTGT D81-2017 公路交通安全设施设计细则
- 2024年小学生科技素养比赛题库及答案(共180题)
- 车床加工Mastercam9.1数控车床加工教程(非常详细)
- 酒店前厅服务与管理实训总结
- 《研学旅行课程设计》课件-学习情境二 研之有义-研学课程整体设计
- 2024-2025年上半学期(三年级)教科版上册科学期中试卷【A4可打印】
- 滑雪国职公共理论知识考试题库及答案
- 2024年江西九江市交通航运发展集团有限公司招聘笔试参考题库含答案解析
- 慢性应激对心理健康的长期影响
- 2024年静脉治疗行标相关知识理论考核试题
- 秘书学概论秘书职能环境
评论
0/150
提交评论