这篇文章主要讲解了“怎么部署SharePlex环境”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么部署SharePlex环境”吧!

目标在 Linux 系统下安装 Oracle;利用 SharePlex 实现数据同步;可复制 DML 和 DDL 操作

一、环境描述
源端目标端操作系统linux 7.6linux 7.6IP192.168.66.111192.168.66.112数据库版本19.3.0.0.019.3.0.0.0二、数据库准备

创建shareplex专用表空间

createtablespacesplex_tbsdatafile'/oradata/datafile/splex_tbs01.dbf'size1G;

数据库开归档

开启补充日志

alterdatabaseaddsupplementallogdata(primarykey,uniqueindex)columns;二、SharePlex 安装(源 & 目标)

解压安装
使用oracle用户解压,安装。

node1-orcl[oracle]/home/oracle>./SharePlex-9.2.1-b39-ONEOFF-rhel-amd64-m64.tpmUnpacking..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SharePlexinstallationprogram:SharePlexVersion:9.2.1Buildplatform:rhel-amd64Targetplatform:lin-amd64Pleaseentertheproductdirectorylocation?/home/oracle/splex/softPleaseenterthevariabledatadirectorylocation?/home/oracle/splex/dataPleasespecifytheSharePlexAdmingroup(selectanumber):1.[oinstall]2.dgdba3.kmdba4.backupdba5.dba6.oper?5PleaseentertheTCP/IPportnumberforSharePlexcommunications?[2100]PreparingtoinstallSharePlexv.9.2.1:User:oracleAdminGroup:dbaProductDirectory:/home/oracle/splex/softVariableDataDirectory:/home/oracle/splex/dataProceedwithinstallation?[yes]Installing......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Settingfileownerships......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Settingfilepermissions......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DoyouhaveavalidSharePlexv.9.2.1license?[yes]PleaseentertheLicensekey?序列号Pleaseenterthecustomernameassociatedwiththislicensekey?CHINAMINISTRYOFRAILWAYSharePlexv.9.2.1licensevalidationsuccessful:CustomerName:CHINAMINISTRYOFRAILWAYLicenseKey:序列号ProductName:SharePlexforOracle-RACLicenseKeyType:"PerpetualKey"NOTE:Youcanupgradethislicensekeyoraddlicensekeysforadditionalmachinesbyexecutingutility/home/oracle/splex/soft/install/splex_add_key.Installationlogsavedto:/home/oracle/.shareplex/INSTALL-SharePlex-9.2.1-1911290513.logSharePlexv.9.2.1installationsuccessful.

ora_setup配置
配置shareplex,配置时如果需要自定义复制的源与目标端的ORACLE_SID,则需要配置tnsnames.ora别名,且/etc/oratab中必须有对应于自定义的tnsnames别名的ORACLE_SID。

node1-orcl[oracle]/home/oracle/splex/soft/bin>./ora_setupWelcometotheOracleSharePlexsetupprocessforport2100.ThisprocesscreatestablesanduseraccountsneededtorunOracleSharePlexreplication.WilltheSharePlexinstallbeusingaBEQUEATHconnection?(Entering'n'impliesaSQL*netconnection)[y]:Pleasenotethefollowing:**Inresponsetoprompts,acarriagereturnwillchoosethedefaultgiveninbrackets.Ifthereisnodefault,areplymustbeentered.**Toexittheprogramwhiletheprogramiswaitingforinput,usetheCTRL-Ckeysequence.ThissequencescanbeenteredbyholdingdowntheCONTROLkeyandpressingtheCkey.EntertheOracleSIDforwhichSharePlexshouldbeinstalled[orcl]:InordertocreatetheSharePlextablesanduseraccount,wemustconnecttothedatabaseasaDBAuserEnteraDBAuserfororcl:systemEnterpasswordfortheDBAaccount,whichwillnotecho:connecting--Thismaytakeafewseconds.validatingusernameandpassword...Thismaytakeafewseconds.SharePlexobjectswillneedtobecreatedunderaspecialaccount.Youcanpickanexistinguserorcreateanewone.WouldyouliketocreateanewSharePlexuser?[y]:Enterusernamefornewuser[splex/splex]:Warning:Thisuserisnowbeinggrantedunlimitedtablespace.Thisprivilegewillremainineffectuntilitisexplicitlychanged.Grantingselectonsys.user$tosplexSPLEX_ROLE_BOTHalreadyexists;continuingsetup...DoyouwanttoenablereplicationoftableswithTDE?[n]:ToenablereplicationoftableswithTDEinthefuture,pleasererunora_setup.SetupwillnowinstallSharePlexobjects.Thesearetheexistingtablespaces.SYSTEMSYSAUXUNDOTBS1TEMPUSERSSPLEX_TBSEnterthedefaulttablespaceforusebySharePlex[USERS]:SPLEX_TBSEnterthetemporarytablespaceforusebySharePlex[TEMP]:EntertheindextablespaceforusebySharePlex[]:SPLEX_TBSCreatingSharePlexobjects[Installationtype:Fresh]...CreatingSharePlexOracle-timezone-regionmap...Done.CreatingConflictResolutionPackage...Done.CreatingSharePlexDataequatorpackage...LoadingComparePackagefrom"/home/oracle/splex/soft/util/sp_deq_pkg.plb"...Done.Note:TheSharePlexobjectthatsupportsreplicationofSDO_GEOMETRYcannotbeinstalledbecausetheOracleSpatialandGraphfeatureisnotinstalled.DoyouwanttocontinuewiththesetupwithoutsupportforSDO_GEOMETRY?[n]:yWillthecurrentsetupforsid:[orcl]beusedassource(includingcasesassourceforfailoverormaster-mastersetups)?[y]:SetupofSharePlexobjectssuccessful...ChangingSharePlexconnectiondatabase...Setupoforclcompletedsuccessfully--ThedatasourceidentifierintheSharePlexconfigurationis'o.orcl'--

sp_cop -u 2300 & 启动
可以使用该参数指定 shareplex 启动到指定的 IP 上,可以使用 netstat -an | grep <port_number>
启动 -u可以启动shareplex实例到指定端口,可以复制多个库。

node1-orcl[oracle]/home/oracle/splex/soft/bin>./sp_cop&[1]2672node1-orcl[oracle]/home/oracle/splex/soft/bin>********************************************************SharePlexforOracleStartup*Copyright2018QuestSoftwareInc.*ALLRIGHTSRESERVED.*ProtectedbyU.S.Patents:7,461,103and7,065,538*Version:9.2.1.39-m64-ONEOFF-SPO17172-SPO17624C-SPO17384-SPO17377-oracle*VarDir:/home/oracle/splex/data*Port:2100**IMPORTANTSECURITYNOTICE:**YOUHAVENOTYETSELECTEDTHENETWORKSECURITYMODEL.*PLEASERUN:**sp_security--setup**TOSELECTYOURNETWORKSECURITYMODEL.*******************************************************

状态验证

node1-orcl[oracle]/home/oracle/splex/soft/bin>./sp_ctrl********************************************************SharePlexCommandUtility*Copyright2018QuestSoftwareInc.*ALLRIGHTSRESERVED.*ProtectedbyU.S.Patents:7,461,103and7,065,538*******************************************************sp_ctrl(node1:2100)>statusBriefStatusfornode1ProcessStatePIDRunningSince-------------------------------------------------------------------------CopRunning267229-Nov-1905:18:20Cmd&CtrlRunning269629-Nov-1905:18:34Therearenoactiveconfigurationfiles三、同步配置

创建配置文件(源数据库)

sp_ctrl控制台
SharePlex日常操作都在sp_ctrl控制台中进行,启动命令为:/<prodir>/bin/sp_ctrl,一般启动之后首先进入控制台执行sp_ctrl > stop post,停止。

sp_ctrl(node2:2100)>stoppost

config 配置文件
Config配置文件为复制链路需要复制对象以及链路映射文件。

列出config文件

sp_ctrl(node1:2100)>listconfig#列出config文件FileNameStateDatasource---------------------------------------------------------------------------ORA_configInactiveo.SOURCE_SIDLastModifiedAt:26-Nov-1909:13Size:151

复制修改配置文件

sp_ctrl(node1:2100)>copyconfigORA_configtotest_config#复制config文件sp_ctrl(node1:2100)>editconfigtest_config#修改config文件datasource:o.orcl#sourcetablestargettablesroutingmap#splex.demo_srcsplex.demo_desttarget_system:进程名@o.target_sidexpandhr.%hr.%192.168.66.112:splex_hr@o.orcl

splex.demo_src --源库的用户名.表名,可以使用%通配符,全匹配半匹配等。priv%not(table_name)排除表。

splex.demo_dest --目标库的用户名.表名

target_system@o.target_sid --目标库的IP或hosts文件中映射名@为目标端的sid或别名。

hr.test hr.test 192.168.204.151:scott_tab@o.honor1 --IP或主机名后加冒号,可以为该表复制单独起一个队列。

mary.cust2!key(c1,c2) mary.cust2 proda@o.sid --自定义pk

config 生效

sp_ctrl(node1:2100)>activateconfigtest_config

验证Capture、Read和Export进程是否被创建

sp_ctrl(node1:2100)>showProcessSourceTargetStatePID----------------------------------------------------------------------------------------------Captureo.orclRunning60407Reado.orclRunning60423Exportnode1node2Running60438sp_ctrl(node1:2100)>showcapturedetailHost:node1Systemtime:28-Nov-1910:17:58OperationsSourceStatusCapturedSince-----------------------------------------------------o.orclRunning028-Nov-1909:34:52Oraclecurrentredolog:25Capturecurrentredolog:25Capturelogoffset:10206852Lastchangeprocessed:OperationonSHAREPLEXinternaltableat11/28/1910:17:55Capturestate:ProcessingActivationid:2Errorcount:0Operationscaptured:0Transactionscaptured:0Concurrentsessions:0HWMconcurrentsessions:2Checkpointsperformed:23Totaloperationsprocessed:3948Totaltransactionscompleted:3948TotalKbytesread:0Redorecordsinprogress:0Redorecordsprocessed:18556Redorecordsignored:14608Redorecords-lastHRID:N/Asp_ctrl(node1:2100)>showexportHost:node1Queue:node1KbytesTargetStatusExportedSinceTotalBacklog---------------------------------------------------------------------------node2Running1228-Nov-1909:34:5600sp_ctrl(node1:2100)>

同步数据

开启同步(目标端)

设置恢复的起点(源端需要有数据流入)

sp_ctrl(node2:2100)>reconcilequeuesplex_hrforo.orcl-o.orclscn1573836

开启同步

sp_ctrl(node2:2100)>startpost

感谢各位的阅读,以上就是“怎么部署SharePlex环境”的内容了,经过本文的学习后,相信大家对怎么部署SharePlex环境这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!