Oracle GoldenGate系統之----資料初始化

wailon發表於2013-12-04

對於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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章