oracle+GoldenGate学习笔记 下载本文

内容发布更新时间 : 2024/12/25 3:20:55星期一 下面是文章的全部内容请认真阅读。

OK,MGR进程和REP进程运行正常

至此,两台DB的GoldenGate都已经配置完成。

3.3 测试DML操作

首先往SourceDB中插入一行

C:\\Documents and Settings\\Administrator>sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 8 15:33:47 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Enter user-name: sajet/tech@hitron

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options

SQL> insert into sajet.sys_emp values (10000786,'TEST1','TEST1','','TEST','10000 27','','Y','',0,'',0,'','') 2 ;

1 row created. SQL> commit 2 ;

Commit complete.

看看TargetDB中是否有同样的记录存在呢 SQL> connect sajet/tech@goldenga Connected.

SQL> select count (*) from sajet.sys_emp 2 where emp_id=10000786;

COUNT(*) ---------- 1

同步过来了。

我们可以看看EXT1进程的相关统计信息

11

GGSCI (sajet-project) 189> stats ext1

Sending STATS request to EXTRACT EXT1 ...

Start of Statistics at 2010-03-08 15:47:51.

DDL replication statistics (for all trails):

*** Total statistics since extract started ***

Operations 40.00 Mapped operations 28.00 Unmapped operations 0.00 Other operations 12.00 Excluded operations 0.00

Output to d:\\ggs\\dirdat\\r1:

Extracting from GOLDENGATE.GGS_MARKER to GOLDENGATE.GGS_MARKER:

*** Total statistics since 2010-03-05 09:51:51 ***

No database operations have been performed.

*** Daily statistics since 2010-03-08 00:00:00 ***

No database operations have been performed.

*** Hourly statistics since 2010-03-08 15:00:00 ***

No database operations have been performed.

*** Latest statistics since 2010-03-05 09:51:51 ***

No database operations have been performed.

Extracting from SAJET.GOLDEGATETEST to SAJET.GOLDEGATETEST:

*** Total statistics since 2010-03-05 09:51:51 ***

Total inserts 3.00 Total updates 0.00 Total deletes 0.00 Total truncates 2.00 Total discards 0.00

12

Total operations 5.00

*** Daily statistics since 2010-03-08 00:00:00 ***

No database operations have been performed.

*** Hourly statistics since 2010-03-08 15:00:00 ***

No database operations have been performed.

*** Latest statistics since 2010-03-05 09:51:51 ***

Total inserts 3.00 Total updates 0.00 Total deletes 0.00 Total truncates 2.00 Total discards 0.00 Total operations 5.00

Extracting from SAJET.SYS_EMP to SAJET.SYS_EMP:

*** Total statistics since 2010-03-05 09:51:51 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Daily statistics since 2010-03-08 00:00:00 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Hourly statistics since 2010-03-08 15:00:00 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Latest statistics since 2010-03-05 09:51:51 ***

Total inserts 2.00 Total updates 0.00

13

Total deletes 0.00 Total discards 0.00 Total operations 2.00

Extracting from SAJET.MLOG$_SYS_EMP to SAJET.MLOG$_SYS_EMP:

*** Total statistics since 2010-03-05 09:51:51 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Daily statistics since 2010-03-08 00:00:00 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Hourly statistics since 2010-03-08 15:00:00 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

*** Latest statistics since 2010-03-05 09:51:51 ***

Total inserts 2.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 2.00

End of Statistics.

相信以上的内容大家都看的懂吧。

其他的DML操作在此省略。

14

4.GoldenGate Support DDL安装

1.选择一个Schema存放支持DDL的对象,本文选择GoldenGate 2.编辑Globals参数文件 3.关掉Oracle Recycle bin

On Oracle10gand up, system recycle bin must be disabled.

To turn off the recycle bin:

●Oracle10gRelease 2 and later: Set the RECYCLEBIN initialization parameter to OFF.

●Oracle10gRelease 1: Set the _RECYCLEBIN initialization parameter to FALSE.

4.在命令行,切换到GGS目录 5.运行SQLPLUS

6. run marker_setup.sql, enter GoldenGate schema(goldengate) 7. run ddl_setup.sql enter schema:goldengate

choose installation mode: INITIALSETUP

8. run role_setup.sql

9. grant role(GGS_GGSUSER_ROLE) to all GoldenGate Extract users; 10. run ddl_enable.sql

两端都安装完成.

具体如下:

GGSCI (PONY) 23> edit param globals 填入如下内容后保存

GGSCHEMA goldengate

D:\\ggs>sqlplus/ as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 3月 3 10:12:06 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

连接到:

15