oracle goldengate使用测试(四)

2014-11-24 14:23:44 · 作者: · 浏览: 2
gg]$ ./ggsci

add checkpoint table to the destination database

GGSCI (db2) 1> edit params ./GLOBAL

and put following lines to the global parameter file:

GGSCHEMA ggate

CHECKPOINTTABLE ggate.checkpoint

~

GGSCI (db2) 2> dblogin userid ggate

Password:

Successfully logged into database.

GGSCI (db2) 3> add checkpointtable ggate.checkpoint

Successfully created checkpoint table GGATE.CHECKPOINT.

Create replicat group:

GGSCI (db2) 4> add replicat rep1, exttrail /u01/app/oracle/product/gg/dirdat/lt,checkpointtable ggate.checkpoint

REPLICAT added.

create parameter file for replicat:

GGSCI (db2) 5> edit params rep1

And put following lines in the parameter file:

--Replicat group --

replicat rep1

--source and target definitions

ASSUMETARGETDEFS

--target database login --

userid ggate, password qwerty

--file for dicarded transaction --

discardfile /u01/app/oracle/product/gg/discard/rep1_discard.txt, append, megabytes 10

--ddl support

DDL

--Specify table mapping ---

map sender.*, target receiver.*;

Start extract and replicat:

Source:

GGSCI (db1) 14> start extract ext1

Destination:

GGSCI (db2) 15> start replicat rep1

Check all processes.

Source:

GGSCI (db1) 8> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

EXTRACT RUNNING EXT1 00:00:00 00:00:05

Destination:

GGSCI (db1) 8> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

REPLICAT RUNNING REP1 00:00:00 00:00:00

Our replication has been successfully created.

6. Checking

Now we can check our replication. We will create some tables in the sender schema on the source, insert some rows, and check how it will replicate to destination side.

Source database:

SQL> create table sender.test_tab_1 (id number,rnd_str varchar2(12));

SQL> insert into sender.test_tab_1 values (1,'test_1');

SQL>commit;

Destination database:

SQL> select * from receiver.test_tab_1;

ID RND_STR

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

1 test_1

Our GoldenGate DDL and DML replication is now working. The table was created on the destination side and data were replicated.

In the next post in this series, I will show how to modify our replication.

add replicat rep1, exttrail ./dirdat/lt,checkpointtable ggate.checkpoint

add extract ext2, tranlog, begin now

add exttrail ./dirdat/qt, extract ext2

edit params ext2

SETENV (NLS_LANG = "SIMPLIFIED CHINESE_CHINA.AL32UTF8")

--extract group--

extract ext2

--connection to database--

userid ggate, password qwerty

--tranlogoptions asmuser sys@+ASM,asmpassword nopassword

--hostname and port for trail--

rmthost 172.16.90.170, mgrport 7809

--path and name for trail--

rmttrail ./dirdat/qt

--DDL support

DDL include mapped objname sender.*;

--DML

--dynamicresolution

--gettruncates

table sender.*;

start extract ext1

edit params ./GLOBAL

GGSCHEMA ggate

CHECKPOINTTABLE ggate.checkpoint

dblogin userid ggate

add checkpointtable ggate.checkpoint

add replicat rep1, exttrail ./dirdat/qt,checkpointtable ggate.checkpoint

edit params rep1

SETENV (NLS_LANG = "SIMPLIFIED CHINESE_CHINA.AL32UTF8")

--Replicat group --

replicat rep1

--source and target definitions

ASSUMETARGETDEFS

--target database login--

userid ggate, password qwerty

--file for dicarded transaction --

discardfile ./discard/rep1_discard.txt, append, megabytes 10

--ddl support

DDL

--Specify table mapping ---

--REPERROR (1403