ma.keane 发表于 2013-9-13 09:42:35

不同表之间的数据同步

如果想将A数据库中TAB1表中的列(C1,C2)的新增或者变更数据实时的同步到B数据库中的TAB2表中的列(C3,C4)上,用OGG可以实现吗,不行用ETL工具可以实现嘛!

关键是实时,或者写触发器?


求助各位!

Maclean Liu(刘相兵 发表于 2013-9-13 09:59:40

表的map  for example:MAP US03.T52 TARGET US01.T53;

col 的map for example:COLMAP (usedefaults,
salary = sal)

Maclean Liu(刘相兵 发表于 2013-9-13 23:45:34

FOR EXAMPLE:

GGSCI (targetserver) > edit params RHREMD1
Replicat RHREMD1
-------------------------------------------------------------------
-- Replicat for HR Schema
-------------------------------------------------------------------
USERID 'GGER', PASSWORD "AACAAAAAAAAAAADAVHTDKHHCSCPIKAFB", ENCRYPTKEY default
AssumeTargetDefs
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardFile dirrpt/RHREMD1.dsc, Append
DiscardRollover at 02:00 ON SUNDAY
Map HR.EMPLOYEES, Target HR.EMPLOYEES,COLMAP (USEDEFAULTS), FILTER (@RANGE (1,3));
Map HR.JOBS, Target HR.JOBS,COLMAP (USEDEFAULTS), FILTER (@RANGE (1,3));
Map HR.JOB_HISTORY, Target HR.JOB_HISTORY,COLMAP (USEDEFAULTS),
FILTER (@RANGE (1,3));
Map HR.LOCATIONS, Target HR.LOCATIONS,COLMAP (USEDEFAULTS), FILTER (@RANGE (1,3));
Map HR.DEPARTMENTS, Target HR.DEPARTMENTS,COLMAP (USEDEFAULTS),
FILTER (@RANGE (1,3));
Map HR.COUNTRIES, Target HR.COUNTRIES,COLMAP (USEDEFAULTS), FILTER (@RANGE (1,3));
Map HR.REGIONS, Target HR.REGIONS,COLMAP (USEDEFAULTS), FILTER (@RANGE (1,3));

Maclean Liu(刘相兵 发表于 2013-9-13 23:47:14

Column Mapping: Overview

Oracle GoldenGate provides the capability to map columns from one table to another.

Data can be transformed between dissimilar database tables.

Use COLMAP to map target columns from your source columns.

Oracle GoldenGate automatically matches source to target column names with USEDEFAULTS.

Mapping can be applied when either extracting or replicating data.


MAP HR.CONTACT, TARGET HR.PHONE,
COLMAP (USEDEFAULTS,
NAME = CUST_NAME,
PHONE_NUMBER = @STRCAT( "(", AREA_CODE, ")",
PH_PREFIX, "-", PH_NUMBER ) );

Column Mapping: Building History
This example uses special values to build a history of operations data:
INSERTALLRECORDS
MAP SALES.ACCOUNT, TARGET REPORT.ACCTHISTORY,
COLMAP (USEDEFAULTS,
TRAN_TIME = @GETENV("GGHEADER","COMMITTIMESTAMP"),
OP_TYPE = @GETENV("GGHEADER", "OPTYPE"),
BEFORE_AFTER_IND =
@GETENV("GGHEADER", "BEFOREAFTERINDICATOR"),
);
页: [1]
查看完整版本: 不同表之间的数据同步