OGG数据仓库以及单向复制(二)

  1. Configure Extract(提取)      Process in Source system

配置capture(捕获)参数

  1. Edit extract process parameter

GGSCI (gc2) 21> EDIT PARAMS EORA_1          配置capture参数文件

-- Change Capture parameter file to capture

-- EMP_OGG and DEPT_OGG changes

EXTRACT EORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD ogg

EXTTRAIL /u01/app/ogg/dirdat/aa             跟踪提取文件放在/u01/app/ogg/dirdat目录下文件名以aa为前缀的文件中:例aa000000

TABLE scott.TCUSTMER;                                   capture(捕获)要监视的表名,capture可以监视多张表也可以值监视一张表

TABLE scott.TCUSTORD;

Please note that “aa” is prefix for local trail file.

Execute the following commands in

RMTTRAIL /u01/app/ogg/dirdat/pa

TABLE scott.TCUSTMER;

TABLE scott.TCUSTORD;

Add data pump Extract group

GGSCI (gc2) 29> ADD EXTRACT PORA_1, EXTTRAILSOURCE /u01/app/ogg/dirdat/aa

告诉PORA_1要传送哪个路径下的跟踪信息

EXTRACT added.

Verify results:

GGSCI (gc2) 30> INFO EXTRACT PORA_1

EXTRACT    PORA_1    Initialized   2014-08-11 19:08   Status STOPPED

Checkpoint Lag       00:00:00 (updated 00:00:23 ago)

Log Read Checkpoint  File /u01/app/ogg/dirdat/aa000000

First Record  RBA 0

  1. Add GoldenGate remote(远程)      trail in Source      system

在源数据库端配置远程的路径及文件

GGSCI (gc2) 31> ADD RMTTRAIL /u01/app/ogg/dirdat/pa, EXTRACT PORA_1, MEGABYTES 5

表示把捕获到的信息传送到远程的哪个目录的文件中

RMTTRAIL added.

Start data pump process:

GGSCI (gc2) 32> START EXTRACT PORA_1  启动传送,一直运行

Sending START request to MANAGER ...

EXTRACT PORA_1 starting

Verify the results:

GGSCI (gc2) 33>  INFO EXTRACT PORA_1

EXTRACT    PORA_1    Last Started 2014-08-11 19:11   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:00 ago)

Log Read Checkpoint  File /u01/app/ogg/dirdat/aa000000

First Record  RBA 906

Now Goldengate will generate remote tail file “pa000000” under dirdat in Target system:

[oracle@gc2 ~]$ ll /u01/app/ogg/dirdat/

total 4

-rw-rw-rw- 1 oracle oinstall 906 Aug 11 18:57 aa000000

  1. Configure replicat(复制)      process in target      system-----------------------------------------

在目标端配置怎么接收,怎么处理传过来的信息

  1. Create GLOBALS parameter in target system

Edit GLOBALS(upper case) parameter file to indicate checkpoint table

GGSCI (oraclelinux54.cuug.net) 5> EDIT PARAMS ./GLOBALS

CHECKPOINTTABLE ogg.ggschkpt   用到ogg下的checkpoint表

Verify:

[oracle@oraclelinux54.cuug.net:/u01/app/ogg]$ll GLOBALS

-rw-rw-rw- 1 oracle oinstall 29 Aug 11 07:14 GLOBALS

For GLOBALS configuration take effect, we must exit GGSCI session:

GGSCI (oraclelinux54.cuug.net) 6> exit

Add replicat checkpoint table in target system:

GGSCI (oraclelinux54.cuug.net) 1> DBLOGIN USERID ogg, PASSWORD ogg      登入到目标数据库

Successfully logged into database.

GGSCI (oraclelinux54.cuug.net) 2> ADD CHECKPOINTTABLE     把检查点信息放到这个表当中,专门存放checkpoint的表

Successfully created checkpoint table OGG.

sys@TDB112>conn ogg/ogg

ogg@TDB112>select * from tab;

TNAME                                                                                      TABTYPE                CLUSTERID

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

GGSCHKPT                                                                                      TABLE

  1. Edit Delivery process parameter

Add Replicat group:

GGSCI (oraclelinux54.cuug.net) 4>ADD REPLICAT RORA_1, EXTTRAIL/u01/app/ogg/dirdat/pa

表示从哪里提取传送过来的信息

REPLICAT added.

Edit replicat process RORA_1 parameter:

GGSCI (oraclelinux54.cuug.net) 7> EDIT PARAM RORA_1

--

-- Change Delivery parameter file to apply

-- EMP_OGG and DEPT_OGG Changes

--

REPLICAT RORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD ogg

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE

MAP scott.tcustmer, TARGET scott.tcustmer;      源数据库中的哪个表,目标数据库中的哪个表接收

MAP scott.tcustord, TARGET scott.tcustord;

Note: In the MAP statement, the first owner/schema is for the source and the second for the target.

Start Replicat process:

GGSCI (oraclelinux54.cuug.net) 8>  START REPLICAT RORA_1

Sending START request to MANAGER ...

REPLICAT RORA_1 starting

Verify:

GGSCI (oraclelinux54.cuug.net) 9>  INFO REPLICAT RORA_1

REPLICAT   RORA_1    Initialized   2014-08-11 07:20   Status STOPPED

Checkpoint Lag       00:00:00 (updated 00:07:19 ago)

Log Read Checkpoint  File /u01/app/ogg/dirdat/pa000000

First Record  RBA 0

  1. Verify if DML can be duplicated correctly

  1. Insert      operation

Insert data in source system:

SQL> conn scott/tiger

SQL> insert into tcustmer values ('abbb','beijing','shanghao' ,'ch');

1 row created.

SQL> commit;

Commit complete.

SQL>  select * from tcustmer;

CUST NAME                           CITY                 ST

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

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

abb  beijing                        shanghao             ch

Check the result in target system:

SQL> select * from tcustmer;

CUST NAME                           CITY                 ST

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

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

abb  beijing                        shanghao             ch

上一篇:[PKUWC 2018]随机算法


下一篇:centos6.5下oracle11g下OGG单向复制