Oracle Golden Gate 双向复制配置

    作者:课课家教育更新于: 2019-04-26 21:34:17

      OracleGoldenGate双向复制配置是什么,数据库层面应怎么配置。

      一、goldengate软件安装,建立安装目录后,在该目录下解压即可。(在源端和目标端都执行)

      注意:建议用oracle用户安装,设置oralce用户的环境变量:

      LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib:$ORACLE_GOLDENGATE:$ORACLE_HOME/lib

      LD_LIBRARY_PATH中必须有$ORACLE_HOME/lib才能执行./ggsci,否则回报缺少动态库文件的错误:

      但是这种情况下oracle数据库运行没有问题。

      [oracle@haozggoldengate]$./ggsci

      ./ggsci:errorwhileloadingsharedlibraries:libclntsh.so.11.1:cannotopensharedobjectfile:

      Nosuchfileordirectory

      原因是:goldengate在运行时需要oralce的动态库文件。所以需要把oracle的动态库文件放到共享库中,

      赋值给环境变量LD_LIBRARY_PATH,ogg的官方文档是这样描述:

      Makecertainthatthedatabaselibrariesareaddedtotheshared-libraryenvironmentvariablesofthesystem。

      --ogg官方文档上的安装步骤

      InstallingOracleGoldenGateonLinuxandUNIX

      FollowthesestepstoinstallOracleGoldenGateforOracleonaLinuxorUNIXsystem。

      InstallingtheOracleGoldenGatefiles

      1.ExtracttheOracleGoldenGatemediapack.zipfiletothesystemanddirectorywhereyou

      wantOracleGoldenGatetobeinstalled.

      2.Runthecommandshell.

      ./ggsci

      3、InGGSCI,issuethefollowingcommandtocreatetheOracleGoldenGateworkingdirectories.

      CREATESUBDIRS

      4、IssuethefollowingcommandtoexitGGSCI.

      EXIT

      二、创建goldengate用户(在源端和目标端都执行)

      说明:为goldengate软件创建数据库用户,为了不影响生产环境,此用户用来安装存放一些复制软件自身用到的procedure、table等,

      也就是搭建ddl复制环境用到的一些表,过程等。该用户需要有一定的权限。---ddlobjects都在这个用户下。

      OracleGoldenGateschema--ogg官网上的称呼

      注意:该用户在官网上也称之外复制用户:replicateuser

      1、创建oggschema

      SQL>createuseroggidentifiedbyogg;

      Usercreated.

      2、对其授权

      SQL>grantconnect,resource,dbatoogg;

      Grantsucceeded.

      SQL>GRANTEXECUTEONutl_fileTOogg;

      Grantsucceeded.

      SQL>!pwd

      /oracle/goldengate

      ===========配置思路是:先配置主端到灾备端的单向复制,然后再配置从灾备端到主端的单向复制,从而实现双向复制============

      三先执行从主端到灾备端的单向复制配置

      ------------------------------主端的配置---------------------------------------------------

      ---------------------------数据库层面的配置--------------------------------------------------

      1、检查附加日志情况

      Select

      SUPPLEMENTAL_LOG_DATA_MIN

      ,SUPPLEMENTAL_LOG_DATA_PK

      ,SUPPLEMENTAL_LOG_DATA_UI

      ,SUPPLEMENTAL_LOG_DATA_FK

      ,SUPPLEMENTAL_LOG_DATA_ALLfromv$database;

      正确状态如下:

      SUPPLEMESUPSUPSUPSUP

      --------------------

      YESNONONONO

      2、增加数据库附加日志及回退

      alterdatabaseaddsupplementallogdata;

      alterdatabaseaddsupplementallogdata(primarykey,unique,foreignkey)columns;

      ---rollback

      alterdatabasedropsupplementallogdata(primarykey,unique,foreignkey)columns;

      alterdatabasedropsupplementallogdata;

      3、开启数据库强制日志模式

      alterdatabaseforcelogging;

      ------------------------------安装ddl复制支持-----------------------------

      4、执行marker_setup.sql脚本。Thisscript.installssupportfortheOracleGoldenGateDDLmarkersystem

      SQL>@marker_setup.sql

      Markersetupscript

      YouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseobjects.

      NOTE:Theschemamustbecreatedpriortorunningthisscript.

      NOTE:StopallDDLreplicationbeforestartingthisinstallation.

      EnterOracleGoldenGateschemaname:ogg

      Markersetuptablescript.complete,runningverificationscript...

      PleaseenterthenameofaschemafortheGoldenGatedatabaseobjects:

      SettingschemanametoOGG

      MARKERTABLE

      -------------------------------

      OK

      MARKERSEQUENCE

      -------------------------------

      OK

      Script.complete.

      SQL>

      5、执行@ddl_setup.sql

      SQL>@ddl_setup.sql

      OracleGoldenGateDDLReplicationsetupscript

      VerifyingthatcurrentuserhasprivilegestoinstallDDLReplication...

      YouwillbepromptedforthenameofaschemafortheOracleGoldenGatedatabaseobjects.

      NOTE:ForanOracle10gsource,thesystemrecyclebinmustbedisabled.ForOracle11gandlater,itcanbeenabled.

      NOTE:Theschemamustbecreatedpriortorunningthisscript.

      NOTE:StopallDDLreplicationbeforestartingthisinstallation.

      EnterOracleGoldenGateschemaname:ogg

      Working,pleasewait...

      Spoolingtofileddl_setup_spool.txt

      CheckingforsessionsthatareholdinglocksonOracleGoldenGatemetadatatables...

      Checkcomplete.

      UsingOGGasaOracleGoldenGateschemaname.

      Working,pleasewait...

      DDLreplicationsetupscript.complete,runningverificationscript...

      PleaseenterthenameofaschemafortheGoldenGatedatabaseobjects:

      SettingschemanametoOGG

      CLEAR_TRACESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      CREATE_TRACESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      TRACE_PUT_LINESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      INITIAL_SETUPSTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLVERSIONSPECIFICPACKAGESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLREPLICATIONPACKAGESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLREPLICATIONPACKAGEBODYSTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLIGNORETABLE

      -----------------------------------

      OK

      DDLIGNORELOGTABLE

      -----------------------------------

      OK

      DDLAUXPACKAGESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLAUXPACKAGEBODYSTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      SYS.DDLCTXINFOPACKAGESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      SYS.DDLCTXINFOPACKAGEBODYSTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLHISTORYTABLE

      -----------------------------------

      OK

      DDLHISTORYTABLE(1)

      -----------------------------------

      OK

      DDLDUMPTABLES

      -----------------------------------

      OK

      DDLDUMPCOLUMNS

      -----------------------------------

      OK

      DDLDUMPLOGGROUPS

      -----------------------------------

      OK

      DDLDUMPPARTITIONS

      -----------------------------------

      OK

      DDLDUMPPRIMARYKEYS

      -----------------------------------

      OK

      DDLSEQUENCE

      -----------------------------------

      OK

      GGS_TEMP_COLS

      -----------------------------------

      OK

      GGS_TEMP_UK

      -----------------------------------

      OK

      DDLTRIGGERCODESTATUS:

      Line/posError

      -------------------------------------------------------------------------------------

      NoerrorsNoerrors

      DDLTRIGGERINSTALLSTATUS

      -----------------------------------

      OK

      DDLTRIGGERRUNNINGSTATUS

      ----------------------------------------------------------------------

      ENABLED

      STAYMETADATAINTRIGGER

      ----------------------------------------------------------------------

      OFF

      DDLTRIGGERSQLTRACING

      ----------------------------------------------------------------------

      0

      DDLTRIGGERTRACELEVEL

      ----------------------------------------------------------------------

      0

      LOCATIONOFDDLTRACEFILE

      ------------------------------------------------------------------------------------------------------------------------

      /oracle/diag/rdbms/ora11/ora11/trace/ggs_ddl_trace.log

      Analyzinginstallationstatus...

      STATUSOFDDLREPLICATION

      ------------------------------------------------------------------------------------------------------------------------

      SUCCESSFULinstallationofDDLReplicationsoftwarecomponents

      Script.complete.

      SQL>

      6、执行role_setup.sql。

      Thescript.dropsandcreatestherolethatisneededforDDLsynchronization,anditgrantsDMLpermissionson

      theOracleGoldenGateDDLobjects.

      SQL>@role_setup.sql

      GGSRolesetupscript

      Thisscript.willdropandrecreatetheroleGGS_GGSUSER_ROLE

      Touseadifferentrolename,quitthisscript.andthenedittheparams.sqlscript.tochangethegg_roleparametertothepreferredname.(Donotrunthescript.)

      YouwillbepromptedforthenameofaschemafortheGoldenGatedatabaseobjects.

      NOTE:Theschemamustbecreatedpriortorunningthisscript.

      NOTE:StopallDDLreplicationbeforestartingthisinstallation.

      EnterGoldenGateschemaname:ogg

      Wrotefilerole_setup_set.txt

      PL/SQLproceduresuccessfullycompleted.

      Rolesetupscript.complete

      GrantthisroletoeachuserassignedtotheExtract,GGSCI,andManagerprocesses,byusingthefollowingSQLcommand:

      GRANTGGS_GGSUSER_ROLETO

      whereistheuserassignedtotheGoldenGateprocesses.

      SQL>

      7、Granttherolethatwascreated(defaultnameisGGS_GGSUSER_ROLEtoallOracleGoldenGateExtractusers.

      SQL>GrantGGS_GGSUSER_ROLEtoogg;

      Grantsucceeded.

      SQL>

      找oracle视频教程学oracle上课课家教育,IT培训专家

课课家教育

未登录

1