ogg initial load初始化加载

来源:互联网 发布:网络神兽 编辑:程序博客网 时间:2024/05/29 17:57
源端pdg用户,目标端hc用户


源端操作:

1.创建用户

SQL> create user pdg identified by pdg;

User created.

SQL> grant dba to pdg;

Grant succeeded.


2.创建表

SQL> conn pdg/pdg
Connected.
SQL> CREATE TABLE vendors
  2    (
  3       code   NUMBER(5) PRIMARY KEY
  4     , name   VARCHAR2(40)
  5     , street VARCHAR2(30)
  6     , city   VARCHAR2(20)
  7     , state  CHAR(2)
  8     , zip    NUMBER(5)
  9     , phone  CHAR(12)
 10    );

Table created.

SQL> CREATE TABLE products
  2    (
  3       code   NUMBER(5) PRIMARY KEY
  4     , name   VARCHAR2(50)
  5     , price  NUMBER(8,2)
  6     , qty_oh NUMBER(6)
  7     , vendor NUMBER(5)
  8     , CONSTRAINT prod_vendor_fk FOREIGN KEY(vendor) REFERENCES vendors(code)
  9    ); 

Table created.

SQL> INSERT INTO vendors  VALUES (100, 'Acme Corp',
  2       '10 Acorn St', 'Albany', 'AL',12345,'123-456-7890');
INSERT INTO vendors  VALUES (200, 'Bank Inc',
     '20 Brick St', 'Buffalo', 'NY',23456,'234-567-8901');

1 row created.

SQL>   2  
1 row created.

SQL> INSERT INTO vendors  VALUES (300, 'Whiz LLC',
  2       '30 Walnut St','Washington','DC',34567,'345-678-9012');

1 row created.

SQL> INSERT INTO products VALUES (1000, 'wingnut', 0.50, 100, 200);
INSERT INTO products VALUES (1010, 'bushing', 0.40, 250, 100);
INSERT INTO products VALUES (1020, 'foobar',  1.00,  90, 100);

1 row created.

SQL> 
1 row created.

SQL> 
1 row created.

SQL> INSERT INTO products VALUES (1030, 'washer',  0.15, 300, 100);

1 row created.


SQL> INSERT INTO products VALUES (1040, 'doohick', 3.10,  20, 200);


1 row created.


SQL> INSERT INTO products VALUES (1050, 'spinner', 0.75,  15, 200);


1 row created.


SQL> commit;


Commit complete.


3.配置参数

Adding Transaction Data:


GGSCI (test1) 3> Add TranData pdg.*       ///不要;结尾


Logging of supplemental redo data enabled for table PDG.PRODUCTS.


Logging of supplemental redo data enabled for table PDG.VENDORS.


配置init extract参数:
Extract itestab
USERID scofy, PASSWORD scofy
RmtHost 10.80.18.250, mgrport 7839
RmtTask Replicat, Group rtestab
--RMTFILE ./dirdat/initload01.dat, PURGE
table pdg.vendors;
table pdg.products;




GGSCI (test1) 5> Add Extract itestab, SourceIsTable 
EXTRACT added.





目标端配置:

1.创建用户

SQL> create user hc identified by hc;


User created.


SQL> grant dba to hc;


Grant succeeded.



2.创建表,表结构一致(不一致情况后续文章会讲)
CREATE TABLE vendors1
  (
     code   NUMBER(5) PRIMARY KEY
   , name   VARCHAR2(40)
   , street VARCHAR2(30)
   , city   VARCHAR2(20)
   , state  CHAR(2)
   , zip    NUMBER(5)
   , phone  CHAR(12)
  ); 


CREATE TABLE products1
  (
     code   NUMBER(5) PRIMARY KEY
   , name   VARCHAR2(50)
   , price  NUMBER(8,2)
   , qty_oh NUMBER(6)
   , vendor NUMBER(5)
   , CONSTRAINT prod_vendor_fk FOREIGN KEY(vendor) REFERENCES vendors1(code)
  ); 


3.参数配置

Replicat rtestab参数:
GGSCI (selene) 2> edit param rtestab
Replicat rtestab
UserID ogg, password ogg
HandleCollisions
AssumeTargetDefs
DiscardFile ./dirrpt/rtestab.dsc, Purge
Map pdg.vendors, Target hc.vendors1;
map pdg.products, target hc.products1;



GGSCI (test3) 12> Add Replicat rtestab, SpecialRun
REPLICAT added.




源端:
GGSCI (test1) 11> start ITESTAB


Sending START request to MANAGER ...
EXTRACT ITESTAB starting



GGSCI (test1) 14> View Report itestab 


2015-12-09 15:11:54  INFO    OGG-01017  Wildcard resolution set to IMME
DIATE because SOURCEISTABLE is used.


***********************************************************************
                 Oracle GoldenGate Capture 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:42:16
 
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights rese
rved.




                    Starting at 2015-12-09 15:11:54
***********************************************************************


Operating System Version:
Linux
Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86
_64
Node: test1
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: 3631


Description: 


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


2015-12-09 15:11:54  INFO    OGG-03035  Operating system character set 
identified as UTF-8. Locale: en_US, LC_ALL:.
Extract itestab
USERID scofy, PASSWORD *****
RmtHost 10.80.18.250, mgrport 7839
RmtTask Replicat, Group rtestab
--RMTFILE ./dirdat/initload01.dat, PURGE
table pdg.vendors;
Using the following key columns for source table PDG.VENDORS: CODE.


table pdg.products;
Using the following key columns for source table PDG.PRODUCTS: CODE.




2015-12-09 15:11:56  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:
    /home/n/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.4.0 - 64bit Produ
ction
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production


Database Language and Character Set:
NLS_LANG         = "AMERICAN_AMERICA.ZHS16GBK" 
NLS_LANGUAGE     = "AMERICAN" 
NLS_TERRITORY    = "AMERICA" 
NLS_CHARACTERSET = "ZHS16GBK" 


Processing table PDG.VENDORS


Processing table PDG.PRODUCTS


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




Report at 2015-12-09 15:12:05 (activity since 2015-12-09 15:11:55)


Output to rtestab:


From Table PDG.VENDORS:
       #                   inserts:         3
       #                   updates:         0
       #                   deletes:         0
       #                  discards:         0
From Table PDG.PRODUCTS:
       #                   inserts:         6
       #                   updates:         0
       #                   deletes:         0
       #                  discards:         0





REDO Log Statistics
  Bytes parsed                    0
  Bytes output                 1304



目标端:

SQL> select * from products1;


      CODE NAME                                                    PRICE
---------- -------------------------------------------------- ----------
    QTY_OH     VENDOR
---------- ----------
      1000 wingnut                                                    .5
       100        200


      1010 bushing                                                    .4
       250        100


      1020 foobar                                                      1
        90        100




      CODE NAME                                                    PRICE
---------- -------------------------------------------------- ----------
    QTY_OH     VENDOR
---------- ----------
      1030 washer                                                    .15
       300        100


      1040 doohick                                                   3.1
        20        200


      1050 spinner                                                   .75
        15        200




6 rows selected.


我们可以看到初始化成功。

0 0