GG 数据初始化装载 说明 与 示例

来源:互联网 发布:qq软件群 编辑:程序博客网 时间:2024/05/21 10:39

 



原文连接地址 http://blog.csdn.net/tianlesoftware/article/details/6976551

 

中简单的描述了一下GG 的同步,就是先配置好GG,然后进行同步,但实际情况下,是Source 端的数据已经存在,这种情况下就要先进行initial data load,使Source 和 Target 的同步对象上Data 一致,然后在进行GG的online change synchronization。

 

       在GG的官方文档上对initial data load 有一章节进行说明,鉴于我之前的几篇Blog都是基于理论的多,所以以后的blog会偏重于理论加示例的方式进行。理论的知识还是要先看,没有理论,其他都是空谈。


 

 在目标端复制应用进程(图上的Change Replicat)中,需要在参数文件中配置HANDLECOLLISIONS参数,以避免重复应用第2和第3步之间的数据变化,因为这部分数据已经包含在初始化加载中传到目标数据库中了。

 


--以下建议可以增加load 速度和避免错误。

(1)Data: Make certain that the targettables are empty. Otherwise, there may be duplicate-row errors or conflictsbetween existing rows and rows that are being loaded.

       --确保target 表是空的,否则可能会出现重复行或者行冲突。

(2)Constraints: Disable foreign-keyconstraints and check constraints. Foreign-key constraints can cause errors,and check constraints can slow down the loading process. Constraints can bereactivated after the load concludes successfully.

       --禁用外键约束和check 约束,外键约束可能导致错误,而check 约束会到时load速度变慢。 约束可以待我们数据load 完成之后在激活。

(3) Indexes: Remove indexes from thetarget tables. Indexes are not necessary for inserts. They will slow down theloading process significantly. For each row that is inserted into a table, thedatabase will update every index on that table. You can add back the indexesafter the load is finished.

       --移除target 表上的索引。 Target 表上的索引会增加load的时间。 如果有索引,在维护表的同时还需要维护索引的信息。 待数据load 完毕之后在重建索引,重建的速度要比维护快很多。

NOTE:

 A primary indexis required for all applications that access DB2 for z/OS target tables. Youcan delete all other indexes from the target tables, except for the primaryindex.

 --DB2上的primary 索引是必须的。

(4)Keys: To use the HANDLECOLLISIONSfunction to reconcile incremental data changes with the load, each target tablemust have a primary or unique key. If you cannot create a key through yourapplication, use the KEYCOLS option of the TABLE and MAP parameters to specifycolumns as a substitute key for Oracle GoldenGate’s purposes. A key helps identifywhich row to process. If you cannot create keys, the source database must be quiescedfor the load.

       --使用HANDLECOLLISIONS 参数可以保证load的一致性,但是该函数要求target table 必须有primary 或者unique key。 如果没有,可以使用KEYCOLS 选项来指定. 有关该参数的具体作用,在后面讲direct load 时在说明。

 

 

 


实际部署时需要注意正确的执行顺序,大致可以分为以下几步:

(1)    源端和目标端创建配置各个同步进程。

(2)    开启源端同步抓取进程(图上的Change Extract),开始捕获变化。

(3)    开启初始化进程(图上的Initial-Load Extract),开始数据初始化加载。

(4)    等初始化加载结束,开启目标端复制应用进程(图上的ChangeReplicat),开始实时同步应用。

 

 在目标端复制应用进程(图上的Change Replicat)中,需要在参数文件中配置HANDLECOLLISIONS参数,以避免重复应用第2和第3步之间的数据变化,因为这部分数据已经包含在初始化加载中传到目标数据库中了。

该参数在前面的准备工作中有说明:

 To use theHANDLECOLLISIONS function to reconcile incremental data changes with the load,each target table must have a primary or unique key.

 

注意:

 GoldenGate的初始化同步不会也不需要去初始化目标端的SCN号。GoldenGate的同步与Streams不同,它不需要依赖两端数据库保持一致的SCN来应用同步,实际上它只在抓取时可能会与数据库的SCN有关联(抓取时可以指定源数据库的特定SCN号开始解析日志),在trail传输以及目标端应用时,都和源端数据库的SCN毫无关系。它的实质是通过自己的一套队列文件检查点机制来实现队列数据的管理,在目标端则通过数据的唯一键来定位数据行,trail文件最终解析成SQL语句在目标端数据库执行而实现数据的应用。

  所以这里的初始化加载,完全可以使用其他数据库工具来实现,比如说exp/imp、SQL*Loader、RMAN复制数据库等。

 

       也正式因为如此,所以在实际使用中,尽量使用其他高效的数据库传输工具来完成初始化加载,而不要用GoldenGate提高的初始化功能。

 

 


四.DirectLoad 示例
 4.1 准备工作

4.1.1 测试数据是一张270万的分区表,信息如下:

SQL> select count(1) from pdba;

 COUNT(1)

----------

  2713235

 

SQL> desc pdba

 Name                                     Null?    Type

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

 ID                                        NOT NULL NUMBER

 TIME                                      NOT NULLDATE

 

SQL> select table_name,partition_name from user_tab_partitions where table_name='PDBA';

 

TABLE_NAME                     PARTITION_NAME

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

PDBA                           P1

PDBA                           P2

PDBA                           P3

PDBA                           P4

 

4.1.2 禁用DDL,因为我之前的测试环境已经启用了DDL

gg1:/home/oracle> cd /u01/ggate/

--一定要进入GG的根目录

gg1:/u01/ggate> sqlplus / as sysdba;

SQL*Plus: Release 11.2.0.3.0 Production onTue Nov 15 19:59:41 2011

SQL> @ddl_disable.sql

Trigger altered.

 

4.1.3 在Target端创建目标表

       这里我直接使用Toad 获取表的SQL 之后,在target database上执行了一下。

 

       其他的准备工作在上次实验中已经完成。

 

4.2 使用GG Direct Load 方式初始化
这里的一些准备工作就跳过,如果归档设置等,不做说明,可以参考:

Oracle Golden Gate 系列六 --11gR2 Ora2Ora 单向复制GG 示例

http://blog.csdn.net/tianlesoftware/article/details/6950018

 

4.2.1 Source 端操作:

(1) 添加 initial-load Extract 提取进程

GGSCI (gg1) 5> info all

Program    Status      Group       Lag           Time Since Chkpt

MANAGER    STOPPED                                          

EXTRACT    ABENDED     EXT1        00:00:00      143:13:06  

 

GGSCI (gg1) 6> start manager

Manager started.

 

GGSCI (gg1) 2> add extract ext2,sourceistable

EXTRACT added.

--没有tranlog,意味着不是通过日志方式;没有begin XXX,表示还未启动;使用sourceistable参数不会使用检查点机制

 

GGSCI (gg1) 3> info all

Program    Status      Group       Lag           Time Since Chkpt

 

MANAGER    STOPPED                                          

EXTRACT    ABENDED     EXT1        00:00:00      143:10:18  

 

GGSCI (gg1) 11> info extractext2

 

EXTRACT   EXT2      Initialized   2011-11-15 20:09   Status STOPPED

Checkpoint Lag      Not Available

Log Read Checkpoint Not Available

                    First Record         Record 0

Task                SOURCEISTABLE

 

 

修改ext2的参数如下:

GGSCI (gg1) 12> view params ext2

extract ext2

userid ggate@gg1, password ggate

rmthost 192.168.3.200, mgrport 7809

rmttask replicat, group rept2

--注意是rmttask,指定目标复制进程名,直接管理target 端的进程自动启动。

table dave.pdba;

 

(2)增加一个抽取online log的Extract

       这里我直接使用之前的ext1,相关的创建命令如下:

GGSCI (gg1) 11> add extractext1,tranlog, begin now

GGSCI (gg1) 12> add exttrail/u01/ggate/dirdat/lt, extract ext1

 

GGSCI (gg1) 14> view params ext1

 

extract ext1

userid ggate@gg1, password ggate

rmthost gg2, mgrport 7809

rmttrail /u01/ggate/dirdat/lt

table dave.pdba;

 

4.2.2 Target 端操作:

(1)添加direct load 对应的Replicat 进程

GGSCI (gg2) 4> add replicat rept2,specialrun

REPLICAT added.

-- specialrun 参数表示一次性加载。

 

修改rept2参数如下:

GGSCI (gg2) 10> view params rept2

replicat rept2

ASSUMETARGETDEFS       

userid ggate@gg2,password ggate

reperror default, discard

discardfile/u01/ggate/dirdat/rep2_discard.txt, append, megabytes 100

BATCHSQL

INSERTAPPEND         

MAP dave.pdba, TARGET dave.pdba;

 

注意:

这里的extract和replicat进程添加完后在info all中看不到这个进程,但是view report和 info extract name/info replicat name可以跟踪到。

 

(2)添加online change的Replicat 进程及checkpoint table

       这里还是使用之前的rep1 进程,相关命令如下:

 

--在Target 端添加checkpoint表:

GGSCI (gg2) 6> edit params ./GLOBAL

GGSCHEMA ggate

CHECKPOINTTABLE ggate.checkpoint

 

GGSCI (gg2) 12> dblogin useridggate@gg2,password ggate

Successfully logged into database.

GGSCI (gg2) 13> add checkpointtableggate.checkpoint

Successfully created checkpointtableGGATE.CHECKPOINT.

 

--创建同步队列

GGSCI (gg2) 14> add replicatrep1,exttrail /u01/ggate/dirdat/lt, checkpointtable ggate.checkpoint

REPLICAT added.

 

修改相关的参数:

GGSCI (gg2) 11> view params rep1

replicat rep1

ASSUMETARGETDEFS

userid ggate@gg2,password ggate

discardfile/u01/ggate/dirdat/rep1_discard.txt, append, megabytes 10

HANDLECOLLISIONS           --当目标端已有数据时,略过重复数据错误   

map dave.pdba, target dave.pdba;

 

4.2.3 开始初始化
(1)On the source system, start changeextraction.

GGSCI (gg1) 17> START EXTRACT ext1

Sending START request to MANAGER ...

EXTRACT EXT1 starting

 

(2)On the source system, start theinitial-load Extract.

GGSCI (gg1) 21> START EXTRACText2

Sending START request to MANAGER ...

EXTRACT EXT2 starting

 

(3)On the target system, issue thefollowing command to find out if the load is finished. Waituntil the load is finished before going to the next step.

VIEW REPORT<initial-load Extract name>

 

GGSCI (gg1) 34> info extract ext2

 

EXTRACT   EXT2      LastStarted 2011-11-16 11:10   StatusRUNNING

Checkpoint Lag       Not Available

Log Read Checkpoint  Table DAVE.PDBA

                     2011-11-1611:14:18  Record 1610801

Task                 SOURCEISTABLE

 

GGSCI (gg1) 36> info extract ext2

 

EXTRACT   EXT2      Last Started 2011-11-1611:10   Status RUNNING

Checkpoint Lag       Not Available

Log Read Checkpoint  Table DAVE.PDBA

                     2011-11-16 11:15:18  Record 2035567

Task                 SOURCEISTABLE

 

通过以上2个对比,1分钟近40w条数据。

 

GGSCI (gg1) 37> view report ext2

 

 

2011-11-16 11:09:43  INFO   OGG-01017  Wildcard resolution setto IMMEDIATE because

 SOURCEISTABLE is used.

 

***********************************************************************

                 Oracle GoldenGate Capture forOracle

       Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040

  Linux, x64, 64bit (optimized), Oracle 11g on Apr 30 2011 18:52:51

 

Copyright (C) 1995, 2011, Oracle and/or itsaffiliates. All rights reserved.

 

 

                    Starting at 2011-11-1611:09:43

***********************************************************************

 

Operating System Version:

Linux

Version #1 SMP Tue Aug 18 15:59:52 EDT2009, Release 2.6.18-164.el5xen

Node: gg1

Machine: x86_64

                         soft limit   hard limit

Address Space Size   :   unlimited    unlimited

Heap Size            :   unlimited    unlimited

File Size            :   unlimited    unlimited

CPU Time             :    unlimited   unlimited

 

Process id: 4804

 

Description:

 

***********************************************************************

**            Running with the followingparameters                  **

***********************************************************************

extract ext2

userid ggate@gg1, password *****

rmthost 192.168.3.200, mgrport 7809

rmttask replicat, group rept2

table dave.pdba;

 

2011-11-16 11:09:55  WARNING OGG-00869  No unique key is defined for table PDBA. All

 viable columns will be used to represent thekey, but may not guarantee uniqueness.

 KEYCOLS may be used to define the key.

 

Using the following key columns for sourcetable DAVE.PDBA: ID, TIME.

 

 

CACHEMGR virtual memory values (may havebeen adjusted)

CACHEBUFFERSIZE:                         64K

CACHESIZE:                                8G

CACHEBUFFERSIZE (soft max):               4M

CACHEPAGEOUTSIZE (normal):                4M

PROCESS VM AVAIL FROM OS (min):          16G

CACHESIZEMAX (strict force to disk):  13.99G

 

Database Version:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE   11.2.0.3.0      Production

TNS for Linux: Version 11.2.0.3.0 -Production

NLSRTL Version 11.2.0.3.0 - Production

 

Database Language and Character Set:

NLS_LANG ="AMERICAN_AMERICA.zhs16gbk"

NLS_LANGUAGE     = "AMERICAN"

NLS_TERRITORY    = "AMERICA"

NLS_CHARACTERSET = "ZHS16GBK"

 

Processing table DAVE.PDBA

 

确认操作结束:

GGSCI (gg2) 25> info replicat rept2

 

REPLICAT  REPT2     Initialized   2011-11-15 20:26   Status STOPPED

Checkpoint Lag       00:00:00 (updated 14:50:41 ago)

Log Read Checkpoint  Not Available

Task                 SPECIALRUN

 

GGSCI (gg1) 39> view report ext2

 

 

2011-11-16 11:09:43  INFO    OGG-01017 Wildcard resolution set to IMMEDIATE because

 SOURCEISTABLE is used.

 

***********************************************************************

                 Oracle GoldenGate Capture forOracle

       Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040

  Linux, x64, 64bit (optimized), Oracle 11g on Apr 30 2011 18:52:51

 

Copyright (C) 1995, 2011, Oracle and/or itsaffiliates. All rights reserved.

 

 

                    Starting at 2011-11-1611:09:43

***********************************************************************

 

Operating System Version:

Linux

Version #1 SMP Tue Aug 18 15:59:52 EDT2009, Release 2.6.18-164.el5xen

Node: gg1

Machine: x86_64

                         soft limit   hard limit

Address Space Size   :   unlimited    unlimited

Heap Size            :   unlimited    unlimited

File Size            :   unlimited    unlimited

CPU Time             :    unlimited   unlimited

 

Process id: 4804

 

Description:

 

***********************************************************************

**            Running with the followingparameters                  **

***********************************************************************

extract ext2

userid ggate@gg1, password *****

rmthost 192.168.3.200, mgrport 7809

rmttask replicat, group rept2

table dave.pdba;

 

2011-11-16 11:09:55  WARNING OGG-00869  No unique key is defined for table PDBA. All

 viable columns will be used to represent thekey, but may not guarantee uniqueness.

 KEYCOLS may be used to define the key.

 

Using the following key columns for sourcetable DAVE.PDBA: ID, TIME.

 

 

CACHEMGR virtual memory values (may havebeen adjusted)

CACHEBUFFERSIZE:                         64K

CACHESIZE:                                8G

CACHEBUFFERSIZE (soft max):               4M

CACHEPAGEOUTSIZE (normal):                4M

PROCESS VM AVAIL FROM OS (min):          16G

CACHESIZEMAX (strict force to disk):  13.99G

 

Database Version:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE   11.2.0.3.0      Production

TNS for Linux: Version 11.2.0.3.0 -Production

NLSRTL Version 11.2.0.3.0 - Production

 

Database Language and Character Set:

NLS_LANG ="AMERICAN_AMERICA.zhs16gbk"

NLS_LANGUAGE     = "AMERICAN"

NLS_TERRITORY    = "AMERICA"

NLS_CHARACTERSET = "ZHS16GBK"

 

Processing table DAVE.PDBA

 

***********************************************************************

*                   ** Run Time Statistics**                         *

***********************************************************************

 

 

Report at 2011-11-16 11:17:01 (activitysince 2011-11-16 11:09:55)

 

Output to rept2:

 

From Table DAVE.PDBA:

      #                   inserts:   2713235

      #                   updates:         0

      #                   deletes:         0

      #                  discards:         0

 

 

REDO Log Statistics

 Bytes parsed                    0

 Bytes output            279463205

 

初始化的工作已经完成,几分钟就完成了同步工作,比之前网友测试的数据快,不过我这里的测试数据比较特殊,分区表数据虽多,但是只有2列,这个也是影响数据的一个重要因素。

 

(4) On the target system, start changereplication.

GGSCI (gg2) 26> start replicat rep1

Sending START request to MANAGER ...

REPLICAT REP1 starting

 

(5)On the target system, issue thefollowing command to verify the status of change replication.

       GGSCI(gg2) 28> info replicat rep1

 

REPLICAT   REP1     Last Started 2011-11-16 11:23  Status RUNNING

Checkpoint Lag       00:00:00 (updated 158:24:45 ago)

Log Read Checkpoint  File /u01/ggate/dirdat/lt000001

                     2011-11-0910:39:45.497561  RBA 1009

 

(6). On the target system, issue thefollowing command to turn off the HANDLECOLLISIONS parameter and disable theinitial-load error handling.

       取消HANDLECOLLISIONS参数

GGSCI (gg2) 30> send replicatrep1,NOHANDLECOLLISIONS

 

Sending NOHANDLECOLLISIONS requestto REPLICAT REP1 ...

REP1 No tables found matchingGGATE.* to set NOHANDLECOLLISIONS.

 

(7) On the target system, edit theReplicat parameter file to remove the HANDLECOLLISIONS parameter. This preventsHANDLECOLLISIONS from being enabled again the next time Replicat starts.

 

GGSCI (gg2) 32> view params rep1

 

replicat rep1

ASSUMETARGETDEFS

userid ggate@gg2,password ggate

discardfile/u01/ggate/dirdat/rep1_discard.txt, append, megabytes 10

--HANDLECOLLISIONS

map dave.pdba, target dave.pdba;

 

至此,使用DirectLoad 方式初始的测试完成。

 


4.3 使用expdp/impdp 进行初始化
 在前面演示了使用Direct Load 的方式进行初始化,当我们的表很大时,这种方法可能会需要较长的时间,这种情况下,我们可以考虑使用dblink 直接从Source db 将数据同步到target db。

 


       这个步骤大致如下:

(1)    配置同步的Change Extract 和 Change Replicat 进程

(2)    启动Change Extract 进程,捕捉改变的数据。

(3)    使用expdp/impdp 迁移数据

(4)    完成迁移后启动Change replicat,完成数据同步。

 

4.3.1 准备工作

--先启用我们的DDL支持

SQL> @ddl_enable.sql

Trigger altered.

 

--truncate target db 上的pdba 表

SQL> truncate table pdba;

Table truncated.

 

4.3.2  添加change Extract 和 change Replicat 进程

--change Extract 进程

GGSCI (gg1) 11> add extractext1,tranlog, begin now

GGSCI (gg1) 12> add exttrail/u01/ggate/dirdat/lt, extract ext1

 

GGSCI (gg1) 14> view params ext1

extract ext1

userid ggate@gg1, password ggate

rmthost gg2, mgrport 7809

rmttrail /u01/ggate/dirdat/lt

table dave.pdba;

 

--Change Replicat 进程

--在Target 端添加checkpoint表:

GGSCI (gg2) 6> edit params ./GLOBAL

GGSCHEMA ggate

CHECKPOINTTABLE ggate.checkpoint

 

GGSCI (gg2) 12> dblogin useridggate@gg2,password ggate

Successfully logged into database.

GGSCI (gg2) 13> add checkpointtableggate.checkpoint

Successfully created checkpointtableGGATE.CHECKPOINT.

 

--创建同步队列

GGSCI (gg2) 14> add replicatrep1,exttrail /u01/ggate/dirdat/lt, checkpointtable ggate.checkpoint

REPLICAT added.

 

修改相关的参数:

GGSCI (gg2) 11> view params rep1

replicat rep1

ASSUMETARGETDEFS

userid ggate@gg2,password ggate

discardfile/u01/ggate/dirdat/rep1_discard.txt, append, megabytes 10

HANDLECOLLISIONS           --当目标端已有数据时,略过重复数据错误   

map dave.pdba, target dave.pdba;

 

4.3.3 在Source 端启动changeExtract进程:ext1

启动Extract 进程之后就会捕捉Source 端的变化。

GGSCI (gg1) 43> view params ext1

extract ext1

userid ggate@gg1, password ggate

rmthost gg2, mgrport 7809

rmttrail /u01/ggate/dirdat/lt

table dave.pdba;

 

GGSCI (gg1) 44> info all

 

Program    Status      Group       Lag           Time Since Chkpt

MANAGER    RUNNING                                          

EXTRACT    RUNNING     EXT1        00:00:00      00:00:02   

 

4.3.4 使用expdp 导出导入数据

Oracle expdp/impdp 使用示例

http://blog.csdn.net/tianlesoftware/article/details/6260138

 

gg1:/home/oracle> expdp  dave/dave directory=backup dumpfile=pdba.dmp logfile=table.log tables=pdba;

 

Export: Release 11.2.0.3.0 - Production onWed Nov 16 12:21:32 2011

 

Copyright (c) 1982, 2011, Oracle and/or itsaffiliates.  All rights reserved.

 

Connected to: Oracle Database 11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining andReal Application Testing options

Starting"DAVE"."SYS_EXPORT_TABLE_02":  dave/******** directory=backupdumpfile=pdba.dmp logfile=table.log tables=pdba

Estimate in progress using BLOCKS method...

Processing object typeTABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 60 MB

Processing object typeTABLE_EXPORT/TABLE/TABLE

. . exported"DAVE"."PDBA"                               49.14 MB 2713235rows

Master table"DAVE"."SYS_EXPORT_TABLE_02" successfully loaded/unloaded

******************************************************************************

Dump file set for DAVE.SYS_EXPORT_TABLE_02is:

 /u01/backup/pdba.dmp

Job"DAVE"."SYS_EXPORT_TABLE_02" successfully completed at12:22:16

 

在Source DB上删除一部分数据,已体现变化。

SQL> select count(1) from pdba;

 COUNT(1)

----------

  2713235

SQL> select count(1) from pdba wheretrunc(time)=to_date('2010/1/11','yyyy/mm/dd');

 

 COUNT(1)

----------

     6613

 

删除这6613条记录:

SQL> Delete from pdba wheretrunc(time)=to_date('2010/1/11','yyyy/mm/dd');

6613 rows deleted.

SQL> commit;

Commit complete.

 

SQL> select count(1) from pdba;

 

 COUNT(1)

----------

  2706622

 

将dump 传到备库,然后impdp进去:

gg1:/u01/backup> scp pdba.dmp 192.168.3.200:/u01/backup

The authenticity of host '192.168.3.200(192.168.3.200)' can't be established.

RSA key fingerprint is04:39:b6:d7:61:44:18:42:80:4b:37:1a:31:5d:a7:55.

Are you sure you want to continueconnecting (yes/no)? yes

Warning: Permanently added '192.168.3.200'(RSA) to the list of known hosts.

oracle@192.168.3.200's password:

pdba.dmp                                         100%   49MB   3.5MB/s  00:14 

 

gg2:/u01/backup> impdp dave/davedirectory=backup dumpfile=pdba.dmp logfile=table.log tables=pdba table_exists_action=replace;

 

Import: Release 11.2.0.3.0 - Production onWed Nov 16 12:39:40 2011

 

Copyright (c) 1982, 2011, Oracle and/or itsaffiliates.  All rights reserved.

 

Connected to: Oracle Database 11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

Master table "DAVE"."SYS_IMPORT_TABLE_01"successfully loaded/unloaded

Starting"DAVE"."SYS_IMPORT_TABLE_01":  dave/******** directory=backupdumpfile=pdba.dmp logfile=table.log tables=pdba table_exists_action=replace

Processing object typeTABLE_EXPORT/TABLE/TABLE

Processing object typeTABLE_EXPORT/TABLE/TABLE_DATA

. . imported"DAVE"."PDBA"                               49.14 MB 2713235rows

Job"DAVE"."SYS_IMPORT_TABLE_01" successfully completed at12:40:16

 

4.3.5 启动Target 的Replicat 进程

 

SQL> conn dave/dave;

Connected.

SQL> select count(1) from pdba;

 

 COUNT(1)

----------

  2713235

 

GGSCI (gg2) 37> start replicat rep1

 

Sending START request to MANAGER ...

REPLICAT REP1 starting

 

GGSCI (gg2) 38> info all

Program    Status      Group       Lag           Time Since Chkpt

 

MANAGER    RUNNING                                          

REPLICAT   RUNNING     REP1        00:00:00      00:28:17   

 

SQL> select count(1) from pdba;

 

 COUNT(1)

----------

  2706622

 

在次查看,我们之前delete的数据,在Target 端也被delete 了。

 

清除Replicat 进程上的HANDLECOLLISIONS参数:

GGSCI (gg2) 40> send replicatrep1,NOHANDLECOLLISIONS

 

Sending NOHANDLECOLLISIONS request toREPLICAT REP1 ...

REP1 No tables found matching GGATE.* toset NOHANDLECOLLISIONS.

 

该参数是修改当前进程,使其生效,这样就不用重启replicat 进程。

 

修改参数,下次重启时生效:

GGSCI (gg2) 41> edit params rep1

GGSCI (gg2) 42> view params rep1

 

replicat rep1

ASSUMETARGETDEFS

userid ggate@gg2,password ggate

discardfile /u01/ggate/dirdat/rep1_discard.txt,append, megabytes 10

--HANDLECOLLISIONS

map dave.pdba, target dave.pdba;

 

 

至此,有关GG 数据初始化的内容就全部结束

0 0
原创粉丝点击