Oracle数据同步之SharePlex安装测试

2020-10-09 00:00:00 路径 数据 文件 进程 复制

1 SharePlex 软件路径和数据路径

 软件路径productdir:程序文件和库文件

数据路径vardir:工作路径,包括:队列文件、日志文件、与当前复制环境相关的组件。

注意:不要删除、重命名或者编辑SharePlex默认安装的文件和目录,有隐藏文件是数据

复制必须的文件。即使空文件也必须保留,这些文件是SharePlex进程需要的。


sp_cop进程:该进程协调Share_Plex的复制进程,如Capture,Read,Export,Import,Post进程,SharePlex队列,

                       该进程初始化所有的后台进程,维护复制网络中与其他系统的通信功能。

                       该进程很少与用户交互,除了启动和关闭外,该进程一旦运行就成为后台进程。

sp_ctrl进程:启动,关闭以及监控SharePlex


SharePlex复制相关进程,源库read,capture,export,    目标库:import post

后续三个重要步骤


1 安装SharePlex软件

这个需要设置两个目录productdirvardir,需要用户名和序列号

2配置数据库,执行ora_setup脚本,根据提示输入即可,这个在源和目标都要执行。


3 迁移数据


导出数据

[oracle@sp11 ~]$ expdp system/oracle1234 directory=dir1 dumpfile=sales1.dmp tables=scott.sales,scott.customers flashback_scn=1783585;


Export: Release 12.2.0.1.0 - Production on Tue Sep 29 10:28:20 2020


Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.


UDE-28002: operation generated ORACLE error 28002

ORA-28002: the password will expire within 7 days


Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/******** directory=dir1 dumpfile=sales1.dmp tables=scott.sales,scott.customers flashback_scn=1783585 

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

. . exported "SCOTT"."CUSTOMERS":"PA"                    5.921 KB       2 rows

. . exported "SCOTT"."CUSTOMERS":"PB"                    5.921 KB       2 rows

. . exported "SCOTT"."SALES":"PA"                        5.921 KB       2 rows

. . exported "SCOTT"."SALES":"PB"                        5.921 KB       2 rows

Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:

  /home/oracle/sales1.dmp

Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Tue Sep 29 10:29:27 2020 elapsed 0 00:01:05


导入数据


[oracle@sp22 ~]$ impdp system/oracle directory=dir1 dumpfile=sales1.dmp


Import: Release 12.2.0.1.0 - Production on Mon Oct 5 02:01:24 2020


Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.


UDI-28002: operation generated ORACLE error 28002

ORA-28002: the password will expire within 7 days


Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** directory=dir1 dumpfile=sales1.dmp 

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported "SCOTT"."CUSTOMERS":"PA"                    5.921 KB       2 rows

. . imported "SCOTT"."CUSTOMERS":"PB"                    5.921 KB       2 rows

. . imported "SCOTT"."SALES":"PA"                        5.921 KB       2 rows

. . imported "SCOTT"."SALES":"PB"                        5.921 KB       2 rows

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

 Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Mon Oct 5 02:01:55 2020 elapsed 0 00:00:29


4 激活配置文件 

activate config myconfig


myconfig内容如下: 

Datasource:o.prod

SCOTT.sales SCOTT.sales sp22@o.prods

SCOTT.CUSTOMERS SCOTT.CUSTOMERS sp22@o.prods


sp_ctrl (sp11:3500)> show config


Tables Replicating with Key:


  "SCOTT"."CUSTOMERS"   KEY: CUST_ID

  "SCOTT"."SALES"   KEY: SALES_ID


File Name  :myconfig

Datasource :prod

Activated  :29-Sep-20 10:27:05

Actid      :5


Total Objects                 :2

Total Objects Replicating     :2

Total Objects Not Replicating :0


View config summary in /splex/vardir921/log/prod_config_log


激活配置文件后,会自动启动源和目标库的响应后台进程,并开始次同步数据。


源:

sp_ctrl (sp11:3500)> show


Process    Source                               Target                 State                   PID

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

Export     sp11                                 sp22                   Running               20582

Capture    o.prod                                                      Running               14584

Read       o.prod                                                      Running               14591

目标库:

sp_ctrl (sp22:3500)> show


Process    Source                               Target                 State                   PID

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

Import     sp11                                 sp22                   Running               14013

Post       o.prod-sp11                          o.prods                Running               14407


相关文章