ITPub博客

首页 > 数据库 > Oracle > Oracle GoldenGate系统之----数据初始化

Oracle GoldenGate系统之----数据初始化

原创 Oracle 作者:wailon 时间:2013-12-04 20:20:55 0 删除 编辑

对于OGG数据初始化加载,有几种方法,如RMAN,逻辑备份(EXP/EXPDP)等,这里只介绍使用OGG的初始化,其实这个方法现实中使用的最少。

 [oracle@dg ogg]$ 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 11g on Apr 23 2012 08:32:14

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
-- 使用SOURCEISTABLE定义

GGSCI (dg) 1> add extract extb,sourceistable
EXTRACT added.


-- 直接将数据投递到目标端
GGSCI (dg) 2> edit param extb
extract extb
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon, password tiger
rmthost 192.168.56.131, mgrport 7801
rmttask replicat, group repb
table scott.b;
"dirprm/extb.prm" [New] 6L, 172C written

-- info all看不到初始化进程
GGSCI (dg) 3> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                          
EXTRACT     RUNNING     DGRAC       00:00:00      00:00:03   
EXTRACT     RUNNING     EXTDG       00:00:00      00:00:01   
REPLICAT    RUNNING     REP1        00:00:00      00:00:08   

GGSCI (dg) 4> start extb

Sending START request to MANAGER ...
EXTRACT EXTB starting


GGSCI (dg) 5> info extb

EXTRACT    EXTB      Initialized   2013-09-25 16:46   Status RUNNING
Checkpoint Lag       Not Available
Log Read Checkpoint  Not Available
                     First Record         Record 0
Task                 SOURCEISTABLE


GGSCI (dg) 6> info extb

EXTRACT    EXTB      Initialized   2013-09-25 16:46   Status STOPPED
Checkpoint Lag       Not Available
Log Read Checkpoint  Not Available
                     First Record         Record 0
Task                 SOURCEISTABLE


GGSCI (dg) 11> view report extb


2013-09-25 17:07:45  INFO    OGG-01017  Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************

2013-09-25 17:07:45  INFO    OGG-03035  Operating system character set identified as US-ASCII. Locale: en_US, LC_ALL: en_
US.
extract extb
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Set environment variable (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon, password *****
rmthost 192.168.56.131, mgrport 7801
rmttask replicat, group repb
table scott.b;

2013-09-25 17:07:45  WARNING OGG-00869  No unique key is defined for table 'B'. All viable columns will be used to repres
ent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.
Using the following key columns for source table SCOTT.B: OWNER, OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID,
OBJECT_TYPE, CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS, TEMPORARY, GENERATED, SECONDARY, NAMESPACE, EDITION_NAME.

2013-09-25 17:07:51  WARNING OGG-01194  EXTRACT task REPB abended : INSERTAPPEND must be used with the BATCHSQL parameter
 in order to function correctly.

2013-09-25 17:07:51  ERROR   OGG-01203  EXTRACT abending.

2013-09-25 17:07:51  ERROR   OGG-01668  PROCESS ABENDING.


 -- 对初始化的表增加主键,使用OGG同步的对象最好都有primary key或unique key约束
[oracle@dg ogg]$ sqlplus scott/tiger

SQL> alter table b add constraint pk_object_id primary key (object_id);

Table altered.

-- 再次启动数据初始化进程extb

 

GGSCI (dg) 1> start extb

Sending START request to MANAGER ...
EXTRACT EXTB starting


GGSCI (dg) 2> info extb

EXTRACT    EXTB      Last Started 2013-09-25 17:13   Status RUNNING
Checkpoint Lag       Not Available
Log Read Checkpoint  Table SCOTT.B
                     2013-09-25 17:13:42  Record 1
Task                 SOURCEISTABLE


GGSCI (dg) 3> view report extb


2013-09-25 17:17:13  INFO    OGG-01017  Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************

2013-09-25 17:17:13  INFO    OGG-03035  Operating system character set identified as US-ASCII. Locale: en_US, LC_ALL: en_
US.
extract extb
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Set environment variable (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon, password *****
rmthost 192.168.56.131, mgrport 7801
rmttask replicat, group repb
table scott.b;
Using the following key columns for source table SCOTT.B: OBJECT_ID.


2013-09-25 17:17:13  INFO    OGG-01815  Virtual Memory Facilities for: COM
    anon alloc: mmap(MAP_ANON)  anon free: munmap
    file alloc: mmap(MAP_SHARED)  file free: munmap
    target directories:
    /u01/app/ogg/dirtmp.

CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE:                               64G
CACHEPAGEOUTSIZE (normal):                8M
PROCESS VM AVAIL FROM OS (min):         128G
CACHESIZEMAX (strict force to disk):     96G

Database Version:
Oracle Database 11g Enterprise Edition Release 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 SCOTT.B

***********************************************************************
*                   ** Run Time Statistics **                         *
***********************************************************************


Report at 2013-09-25 17:17:20 (activity since 2013-09-25 17:17:13)

Output to repb:

From Table SCOTT.B:
       #                   inserts:       201
       #                   updates:         0
       #                   deletes:         0
       #                  discards:         0


REDO Log Statistics
  Bytes parsed                    0
  Bytes output                54389

-- 已成功初始化201条记录

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/429786/viewspace-1062223/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-08

  • 博文量
    51
  • 访问量
    291509