Chinaunix首页 | 论坛 | 博客
  • 博客访问: 509354
  • 博文数量: 101
  • 博客积分: 1635
  • 博客等级: 上尉
  • 技术积分: 1282
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-05 01:51
文章分类

全部博文(101)

文章存档

2019年(2)

2018年(16)

2013年(14)

2012年(69)

我的朋友

分类: Oracle

2013-03-11 10:23:20

GGSCI (WebServer) 3> add trandata scott.*

2013-03-08 11:02:33  WARNING OGG-00869  No unique key is defined for table 'BONUS'.
All viable columns will be used to represent the key, but may not guarantee
uniqueness.  KEYCOLS may be used to
define the key.

Logging of supplemental redo data enabled
for table SCOTT.BONUS.

Logging of supplemental redo data enabled
for table SCOTT.DEPT.
Logging of supplemental redo data enabled
for table SCOTT.EMP.

2013-03-08 11:02:34  WARNING OGG-00869  No unique key is defined for table
'SALGRADE'. All viable columns will be used to represent the key, but may not
guarantee uniqueness.  KEYCOLS may be
used to define the key.

Logging of supplemental redo data enabled
for table SCOTT.SALGRADE.

GGSCI (WebServer) 4> info trandata scott.*

Logging of supplemental redo log data is
enabled for table SCOTT.BONUS.

Columns supplementally logged for table
SCOTT.BONUS: ENAME, JOB, SAL, COMM.

Logging of supplemental redo log data is
enabled for table SCOTT.DEPT.
Columns supplementally logged for table
SCOTT.DEPT: DEPTNO.

Logging of supplemental redo log data is
enabled for table SCOTT.EMP.

Columns supplementally logged for table
SCOTT.EMP: EMPNO.
Logging of supplemental redo log data is
enabled for table SCOTT.SALGRADE.

Columns supplementally logged for table
SCOTT.SALGRADE: GRADE, LOSAL, HISAL.

1) 在源端和目标端配置MGR

GGSCI (WebServer) 5> edit params mgr

PORT 7809

PURGEOLDEXTRACTS ./dirdat,USECHECKPOINTS

GGSCI (WebServer) 6> start mgr

Manager started.

GGSCI (WebServer) 7> info mgr

Manager is running (IP port
WebServer.7809).

3)在源端配置extract进程

GGSCI (WebServer) 9> EDIT PARAMS EINI_1

EXTRACT EINI_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD ogg

RMTHOST 192.168.55.34,MGRPORT 7809

RMTTASK REPLICAT, GROUP RINI_1

TABLE scott.*;

GGSCI (WebServer) 3> start eini_1

Sending START request to MANAGER ...

EXTRACT EINI_1 starting

GGSCI (WebServer) 4> info eini_1

EXTRACT   
EINI_1    Last Started 2013-03-08
11:26   Status RUNNING
Checkpoint Lag       Not Available

Log Read Checkpoint  Table SCOTT.SALGRADE

013-03-08 11:26:08  Record 5

Task                 SOURCEISTABLE

2) 在目标端配置replicat进程GGSCI (htdb)
6> ADD REPLICAT RINI_1,SPECIALRUN

REPLICAT added.

GGSCI (htdb)
7> EDIT PARAMS RINI_1

REPLICAT RINI_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

ASSUMETARGETDEFS

USERID ogg, PASSWOR ogg

DISCARDFILE ./dirrpt/RINIaa.dsc,PURGE

MAP scott.*,TARGET scott.*;

3) 启动源端的extract进程
在启动源端的extract进程之前,先把目标的数据表的信息清除

SQL> conn scott/scott;

Connected.
SQL> select table_name from user_tables;

TABLE_NAME------------------------------

DEPT 
EMP

BONUS

SALGRADE

DEMO

SQL> truncate table emp;

Table truncated.

SQL> truncate table dept;

truncate table dept

               *

ERROR at line 1:

ORA-02266:
unique/primary keys in table referenced by enabled foreign keys

SQL> delete from dept;

4 rows deleted.

SQL> commit;

Commit complete.

SQL> delete from BONUS;

0 rows deleted.

SQL> delete from SALGRADE;

5 rows deleted.
SQL> commit;

Commit complete.

SQL> delete from DEMO;

0 rows deleted.

SQL> commit;

Commit complete.

SQL> select count(*) from dept;

 COUNT(*)

----------

 0

GGSCI (WebServer) > start extract eini_1

4)  测试数据是否同步过来在源端和目标看相关的表的记录是否一致

同步数据库数据

1、在源端配置extrac进程

gsci> EDIT PARAMS EORA_1
EXTRACT EORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg,PASSWORD ogg EXTTRAIL

./dirdat/aa

TABLE scott.*;

ggsci> ADD EXTRACT EORA_1,TRANLOG,BEGIN NOW

ggsci> ADD EXTTRAIL ./dirdat/aa,EXTRACT EORA_1,MEGABYTES 5

ggsci> START EXTRACT EORA_1

ggsci> INFO EXTRACT EORA_1

2、在源端配置pump进程

ggsci> EDIT PARAMS PORA_1

EXTRACT PORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

PASSTHRU

RMTHOST 192.168.55.34,MGRPORT 7809

RMTTRAIL
./dirdat/pa

TABLE scott.*;

ggsci> ADD EXTRACT PORA_1,EXTTRAILSOURCE ./dirdat/aa

ggsci> ADD RMTTRAIL ./dirdat/pa,EXTRACT PORA_1, MEGABYTES 5

ggsci> START EXTRACT PORA_1

ggsci> INFO EXTRACT PORA_1

3、在目标端配置replicat进程

GGSCI (htdb)
15> EDIT PARAMS ./GLOBALS

CHECKPOINTTABLE
ogg.checkpoint

GGSCI (htdb)
16> exit

[oracle@htdb
ggs]$./ggsci

Oracle
GoldenGate Command Interpreter for Oracle

Version
11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux, x64,
64bit (optimized), Oracle 10g on Apr 23 2012 07:30:46

Copyright (C)
1995, 2012, Oracle and/or its affiliates. All rights reserved.

GGSCI (htdb)
1> DBLOGIN USERID ogg,PASSWORD ogg

Successfully
logged into database.

GGSCI (htdb)
2> ADD CHECKPOINTTABLE

o checkpoint
table specified, using GLOBALS specification (ogg.checkpoint)...

Successfully
created checkpoint table ogg.checkpoint.

GGSCI (htdb)
3> ADD REPLICAT RORA_1,EXTTRAIL ./dirdat/pa

REPLICAT added.

GGSCI (htdb)
4> EDIT PARAMS RORA_1

REPLICAT RORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg,PASSWORD ogg

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE ./dirrpt/RORA_aa.DSC,PURGE

MAP scott.*,TARGET scott.*;

GGSCI (htdb)
5> START REPLICAT RORA_1

Sending START
request to MANAGER ...

REPLICAT RORA_1
starting

GGSCI (htdb)
6> info all

Program     Status     
Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          

REPLICAT    STOPPED    
REP1        00:00:00      25:25:00   
REPLICAT    RUNNING    
RORA_1      00:00:00      00:00:06   

4 测试数据是否可以正常同步

在源端insert,update,delete 数据看是否和源端一致,一致表示复制正常

在源端插入一条数据并且提交

SQL> select count(*) from dept;

COUNT(*)

----------

     4

SQL> select * from dept;

 DEPTNO DNAME          LOC



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

10 ACCOUNTING     NEW YORK

20 RESEARCH       DALLAS

30 SALES          CHICAGO
SQL> insert into dept values(50,'siyang','NANJING');

1 row created.

SQL> commit;

Commit complete.

在目标端查看

SQL> select count(*) from dept;

 COUNT(*)

----------

 4

SQL> select count(*) from dept;

COUNT(*)

----------

5

SQL> select * from dept;

DEPTNO DNAME          LOC



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

10 ACCOUNTING     NEW YORK

20 RESEARCH       DALLAS

30 SALES          CHICAGO

 40 OPERATIONS     BOSTON

50 siyang         NANJING

可以看出是正常的同步。



阅读(9129) | 评论(0) | 转发(0) |
0

上一篇:ogg的安装和配置(一)

下一篇:偶遇ora-0600

给主人留下些什么吧!~~