GoldenGate單向表DML同步

luashin發表於2016-01-07

實驗環境:
 

  node1:
  5.5  11.0.2.3  host:192.168.130.168
  goldengate: fbo_ggs_Linux_x64_ora11g_64bit.zip
 
  node2:
  redhat 5.5  oracle 11.0.2.3  host:192.168.130.171
  goldengate: fbo_ggs_Linux_x64_ora11g_64bit.zip
 

1. 解壓goldengate軟體
 
  下載地址:
 
  [root@dd1 soft]# ll
  total 90588
  drwxrwxrwx 8 root root    4096 Apr  7 17:19 database
  -rw-r--r-- 1 root root 92502371 Oct 29 21:05 fbo_ggs_Linux_x64_ora11g_64bit.zip
  -rwxr-xr-x 1 root root  251438 Apr  8 17:40 rlwrap-0.37.tar.gz
 
  [root@dd1 soft]# unzip fbo_ggs_Linux_x64_ora11g_64bit.zip
  Archive:  fbo_ggs_Linux_x64_ora11g_64bit.zip
    inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar 
    inflating: OGG_WinUnix_Rel_Notes_11.1.1.1.2.pdf 
    inflating: Oracle_GoldenGate_11.1.1.1_README.txt
   
  解壓至oracle base目錄下
  [root@dd1 soft]# chmod 777 fbo_ggs_Linux_x64_ora11g_64bit.tar
  [root@dd1 soft]# su - oracle
  [root@dd1 soft]# mkdir /data/oracle/ogg11
  [oracle@dd1 ~]$ tar -xvf /opt/soft/fbo_ggs_Linux_x64_ora11g_64bit.tar -C /data/oracle/ogg11/
 
 
 
2. 配置環境變數:
    配置前bash_profile檔案內容:
  [oracle@dd1 ~]$ cat .bash_profile
  # .bash_profile
 
  # Get the aliases and functions
  if [ -f ~/.bashrc ]; then
          . ~/.bashrc
  fi
 
  # User specific environment and startup programs
 
  PATH=$PATH:$HOME/bin
 
  export PATH
 
  export ORACLE_BASE=/data/oracle
  export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
  export ORACLE_SID=test1
  export PATH
 
  alias sqlplus="rlwrap sqlplus"
  alias rman="rlwrap rman"
 
  配置後:
  [oracle@dd1 ~]$ vi .bash_profile
 
  # .bash_profile
 
  # Get the aliases and functions
  if [ -f ~/.bashrc ]; then
          . ~/.bashrc
  fi
 
  # User specific environment and startup programs
 
  PATH=$PATH:$HOME/bin
 
  export PATH
 
  export ORACLE_BASE=/data/oracle
  export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  export LD_LIBRARY_PATH=$ORACLE_BASE/ogg11 ###
  PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin:$ORACLE_BASE/ogg11 ###
  export ORACLE_SID=test1
  export PATH
 
  alias sqlplus="rlwrap sqlplus"
  alias rman="rlwrap rman"
  alias rman="rlwrap ggsci" ###
 
  [oracle@dd1 ~]$ source .bash_profile
 
  測試ggsci命令是否可用:
  [oracle@dd1 ~]$ ggsci
  ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file or directory
 
  根據上面的報錯,在bash_profile裡新增$ORACLE_HOME/lib:
  export LD_LIBRARY_PATH=$ORACLE_BASE/ogg11:$ORACLE_HOME/lib
  [oracle@dd1 ~]$ source .bash_profile
  [oracle@dd1 ~]$ ggsci
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
  GGSCI (dd1) 1>
  可以執行了。
3. 進入ggsci 用create subdirs建立目錄
    建議進入$_BASE/ogg11目錄:
  [oracle@dd1 ~]$ cd $ORACLE_BASE/ogg11
  [oracle@dd1 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (dd1) 1> create subdirs
 
  Creating subdirectories under current directory /data/oracle/ogg11
 
  Parameter files                /data/oracle/ogg11/dirprm: created
  Report files                  /data/oracle/ogg11/dirrpt: created
  Checkpoint files              /data/oracle/ogg11/dirchk: created
  Process status files          /data/oracle/ogg11/dirpcs: created
  SQL script files              /data/oracle/ogg11/dirsql: created
  Database definitions files    /data/oracle/ogg11/dirdef: created
  Extract data files            /data/oracle/ogg11/dirdat: created
  Temporary files                /data/oracle/ogg11/dirtmp: created
  Veridata files                /data/oracle/ogg11/dirver: created
  Veridata Lock files            /data/oracle/ogg11/dirver/lock: created
  Veridata Out-Of-Sync files    /data/oracle/ogg11/dirver/oos: created
  Veridata Out-Of-Sync XML files /data/oracle/ogg11/dirver/oosxml: created
  Veridata Parameter files      /data/oracle/ogg11/dirver/params: created
  Veridata Report files          /data/oracle/ogg11/dirver/report: created
  Veridata Status files          /data/oracle/ogg11/dirver/status: created
  Veridata Trace files          /data/oracle/ogg11/dirver/trace: created
  Stdout files                  /data/oracle/ogg11/dirout: created
 
  GGSCI (dd1) 2> exit
 
  GoldenGate安裝完成,以上配置安裝兩個節點都要執行。
4. 對源庫進行設定
 
  確認已經開啟歸檔:
  SQL> archive log list;
  Database log mode              Archive Mode
  Automatic archival            Enabled
  Archive destination            /data//archivelog
  Oldest online log sequence    7
  Next log sequence to archive  9
 
  新增附加日誌:
  SQL> alter database add supplemental log data;
 
  Database altered.
 
  SQL> alter system switch logfile;
 
  System altered.
 
  編輯源資料庫管理程式引數檔案,輸入埠號:
  [oracle@dd1 ~]$ cd $ORACLE_BASE/ogg11
  [oracle@dd1 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (dd1) 1> edit params mgr
 
  PORT 7809
 
  啟動管理程式:
  GGSCI (dd1) 2> start mgr
 
  Manager started.
 
  檢視管理程式資訊:
  GGSCI (dd1) 3> info mgr
  Manager is running (IP port dd1.7809).

5. 對目標庫進行設定
  編輯目標庫管理程式引數檔案,輸入埠:
  [@kf2 ~]$ cd $ORACLE_BASE/ogg11
  [oracle@kf2 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (kf2.calvin) 1> edit params mgr
 
 
 
  -- this is configuration of this manager process
  PORT 7809
 
  啟動管理程式:
  GGSCI (kf2.calvin) 2> start mgr
 
  Manager started.
 
  檢視管理程式資訊:
  GGSCI (kf2.calvin) 3> info mgr
 
  Manager is running (IP port kf2.calvin.7809).
 
 
 
6. 建立源資料庫和目標資料庫實驗使用者:
  在源資料庫端建立:
  [oracle@dd1 ogg11]$ sqlplus / as sysdba
 
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 11:13:54 2013
 
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
 
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
  SQL> create tablespace testdata datafile'/data/oracle/oradata/test1/testdata01.dbf' size 1G;
 
  Tablespace created.
 
  SQL> create user ogguser identified by ogguser default tablespace testdata quota unlimited on testdata;
 
  User created.
 
  SQL> grant connect,resource to ogguser;
 
  Grant succeeded.
 
  SQL> conn ogguser/ogguser
  Connected.
 
  建立實驗表:
  SQL> @demo_ora_create.sql
  DROP TABLE tcustmer
              *
  ERROR at line 1:
  ORA-00942: table or view does not exist
 
 
 
  Table created.
 
  DROP TABLE tcustord
              *
  ERROR at line 1:
  ORA-00942: table or view does not exist
 
 
 
  Table created.
 
  往實驗表插入資料記錄:
  SQL> @demo_ora_insert.sql
 
  1 row created.
 
 
  1 row created.
 
 
  1 row created.
 
 
  1 row created.
 
 
  Commit complete.
 
 

  在目標目標庫端建立:
  GGSCI (kf2.calvin) 4> quit
  [oracle@kf2 ogg11]$ sqlplus / as sysdba
 
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 11:24:40 2013
 
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
 
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
  SQL> create tablespace testdata datafile'/data/oracle/oradata/test2/testdata01.dbf' size 1G;
 
  Tablespace created.
 
  SQL> create user ogguser identified by ogguser default tablespace testdata quota unlimited on testdata;
 
  User created.
 
  SQL> grant connect,resource to ogguser;
 
  Grant succeeded.
 
  SQL>  conn ogguser/ogguser
  Connected.
 
  目標庫建立實驗表,但不插入資料:
  SQL> @demo_ora_create.sql
  DROP TABLE tcustmer
              *
  ERROR at line 1:
  ORA-00942: table or view does not exist
 
 
 
  Table created.
 
  DROP TABLE tcustord
              *
  ERROR at line 1:
  ORA-00942: table or view does not exist
 
 
 
  Table created.
 
 
  檢視源庫表資料:
  SQL> show user
  USER is "OGGUSER"
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO
 
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
 
 
  檢視目標庫資料記錄:
  SQL> show user
  USER is "OGGUSER"

  SQL> select * from tcustmer;
  no rows selected
 
  SQL> select * from tcustord;
  no rows selected
7. 一次性抽取源庫資料到目標庫:
 
  [@dd1 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
  GGSCI (dd1) 3> dblogin userid system,password calvin
  Successfully logged into database.
 
  GGSCI (dd1) 5> add trandata ogguser.tcustmer
 
  Logging of supplemental redo data enabled for table OGGUSER.TCUSTMER.
 
  GGSCI (dd1) 6> add trandata ogguser.tcustord
 
  Logging of supplemental redo data enabled for table OGGUSER.TCUSTORD.
 
  GGSCI (dd1) 7> info trandata ogguser.*
 
  Logging of supplemental redo log data is enabled for table OGGUSER.TCUSTMER
 
  Logging of supplemental redo log data is enabled for table OGGUSER.TCUSTORD
 
  GGSCI (dd1) 8>
 
  源庫新增extrace組任務和引數檔案:
  GGSCI (dd1) 8> add extract einikk,sourceistable
  EXTRACT added.
 
 
  GGSCI (dd1) 9> edit params einikk
 
 
  -- GoldenGate Inintal Data Capture
  -- for TCUSTMER and TCUSTORD
  --
  EXTRACT EINIKK
  USERID system,PASSWORD "calvin"
  RMTHOST 192.168.130.171,MGRPORT 7809  ##目標庫host
  RMTTASK REPLICAT,GROUP RINIKK
  TABLE ogguser.TCUSTMER;
  TABLE ogguser.TCUSTORD;
  ~
  GGSCI (dd1) 10> info extract *,tasks
 
  EXTRACT    EINIKK    Initialized  2013-04-16 11:36  Status STOPPED
  Checkpoint Lag      Not Available
  Log Read Checkpoint  Not Available
                        First Record        Record 0
  Task                SOURCEISTABLE
 
  目標庫新增replicat組任務和引數檔案:
  [oracle@kf2 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (kf2.calvin) 1> add replicat rinikk,specialrun
  REPLICAT added.
 
 
  GGSCI (kf2.calvin) 2> edit params rinikk
 
 
  --
  -- GoldGate Initial Load Delivery
  --
  replicat rinikk
  assumetargetdefs
  userid system,password calvin
  discardfile ./dirrpt/rinikk.dsc,purge
  map ogguser.*, target ogguser.*;  --target 和前面的','間必須有一個空格
  ~
  GGSCI (kf2.calvin) 3> info replicat *,task
 
  REPLICAT  RINIKK    Initialized  2013-04-16 11:45  Status STOPPED
  Checkpoint Lag      00:00:00 (updated 00:02:52 ago)
  Log Read Checkpoint  Not Available
  Task                SPECIALRUN
 
  源庫啟動extract:
  GGSCI (dd1) 11> start extract einikk
 
  Sending START request to MANAGER ...
  EXTRACT EINIKK starting
 
  看到extract日誌有下面內容,說明成功:
  GGSCI (dd1) 20> view report einikk
  ...
  Output to RINIKK:
 
  From Table OGGUSER.TCUSTMER:
          #                  inserts:        2
          #                  updates:        0
          #                  deletes:        0
          #                  discards:        0
  From Table OGGUSER.TCUSTORD:
          #                  inserts:        2
          #                  updates:        0
          #                  deletes:        0
          #                  discards:        0
  ...
 
  目標庫檢視replicat日誌:
  GGSCI (kf2.calvin) 2> view report rinikk
  ...
  Report at 2013-04-16 13:51:08 (activity since 2013-04-16 13:51:02)
 
  From Table OGGUSER.TCUSTMER to OGGUSER.TCUSTMER:
          #                  inserts:        2
          #                  updates:        0
          #                  deletes:        0
          #                  discards:        0
  From Table OGGUSER.TCUSTORD to OGGUSER.TCUSTORD:
          #                  inserts:        2
          #                  updates:        0
          #                  deletes:        0
          #                  discards:        0
  ...
 
 
  檢查目標庫資料記錄是否已經同步:
  [oracle@kf2 ogg11]$ sqlplus ogguser/ogguser
 
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 13:55:30 2013
 
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
 
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO
 
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
 
 
 
8. 配置DML方式
 
  源庫新增extract組和引數檔案:
  [oracle@dd1 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (dd1) 1> add extract eorakk,tranlog,begin now,threads 1
  EXTRACT added.
 
 
  GGSCI (dd1) 2> info extract *
 
  EXTRACT    EORAKK    Initialized  2013-04-16 13:54  Status STOPPED
  Checkpoint Lag      00:00:00 (updated 00:00:11 ago)
  Log Read Checkpoint  Oracle Redo Logs
                        2013-04-16 13:54:23  Thread 1, Seqno 0, RBA 0
 
 
  GGSCI (dd1) 3> edit params eorakk
 
 
  EXTRACT EORAKK
  USERID system, PASSWORD "calvin"
  RMTHOST 192.168.130.171, MGRPORT 7809 ##目標庫host
  RMTTRAIL ./dirdat/kk
  TABLE ogguser.TCUSTMER;
  TABLE ogguser.TCUSTORD;
 
 
  在源庫新增remottrail並啟動extract:
  GGSCI (dd1) 4> ADD RMTTRAIL ./dirdat/kk, EXTRACT EORAKK, MEGABYTES 5
  RMTTRAIL added.
 
 
  GGSCI (dd1) 5> INFO RMTTRAIL *
 
        Extract Trail: ./dirdat/kk
                Extract: EORAKK
                  Seqno: 0
                    RBA: 0
              File Size: 5M
 
 
 
  GGSCI (dd1) 6> start extract eorakk
 
  Sending START request to MANAGER ...
  EXTRACT EORAKK starting
 
 
  GGSCI (dd1) 7>
 
 
  在目標庫配置全域性引數檔案:
  [oracle@kf2 ogg11]$ ggsci
 
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
 
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 
 
 
  GGSCI (kf2.calvin) 1> edit params ./GLOBALS
 
 
  CHECKPOINTTABLE system.ggchkptable
 
  新增checkpoint:
  GGSCI (kf2.calvin) 6> add checkpointtable
  ERROR: Missing checkpoint table specification  ##報錯提示沒有指定checkpoint表
 
  GGSCI (kf2.calvin) 7> add checkpointtable system.ggchkptable
 
  Successfully created checkpoint table SYSTEM.GGCHKPTABLE.
 
  新增replicate組和引數檔案:
  GGSCI (kf2.calvin) 10> add replicat rorakk, exttrail ./dirdat/kk, checkpointtable SYSTEM.GGCHKPTABLE
  REPLICAT added.
 
 
  GGSCI (kf2.calvin) 11> edit params rorakk
 
 
  REPLICAT RORAKK
  USERID system, PASSWORD calvin
  HANDLECOLLISIONS
  ASSUMETARGETDEFS
  DISCARDFILE ./dirrpt/RORAKK.DSC, PURGE
  MAP  ogguser.TCUSTMER, TARGET ogguser.TCUSTMER;
  MAP  ogguser.TCUSTORD, TARGET ogguser.TCUSTORD;
 
  啟動replicat:
  GGSCI (kf2.calvin) 3> start replicat rorakk
  Sending START request to MANAGER ...
  REPLICAT RORAKK starting
 
  檢視replicat報告:
  GGSCI (kf2.calvin) 4> view report rorakk
  ...
  Opened trail file ./dirdat/kk000000 at 2013-04-16 14:27:04  ##看到這句說明成功

9. 測試DML資料記錄同步情況
  源庫插入測試資料記錄:
  SQL> insert into tcustord values('CALV',to_date('2013/04/16','yyyy/mm/dd'),'CHR',111,'100011',5,6);
 
  1 row created.
 
  SQL> commit;
 
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
  CALV 16-APR-13 CHR            111        100011              5              6
 
 
  SQL> insert into tcustmer values('1001','CALV','SHANGHAI','SH');
 
  1 row created.
 
  SQL> commit;
 
  Commit complete.
 
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO
  1001 CALV                          SHANGHAI            SH
 
  目標庫檢視資料記錄是否同步:
  [@kf2 ogg11]$ sqlplus ogguser/ogguser
 
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 14:39:46 2013
 
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
 
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
  CALV 16-APR-13 CHR            111        100011              5              6 ##已同步
 
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO
  1001 CALV                          SHANGHAI            SH  ##已同步
 
 
  源庫刪除資料記錄測試:
  SQL> delete from tcustord where order_id='111';
 
  1 row deleted.
 
  SQL> commit;
 
  Commit complete.
 
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
 
 
  SQL> delete from tcustmer where CUST_CODE='1001';
 
  1 row deleted.
 
  SQL> commit;
 
  Commit complete.
 
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO
 
 
 
  目標庫檢視資料記錄是否刪除:
  SQL> select * from tcustord;
 
  CUST ORDER_DAT PRODUCT_  ORDER_ID PRODUCT_PRICE PRODUCT_AMOUNT TRANSACTION_ID
  ---- --------- -------- ---------- ------------- -------------- --------------
  WILL 30-SEP-94 CAR            144        17520              3            100
  JANE 11-NOV-95 PLANE          256        133300              1            100
 
  SQL> select * from tcustmer;
 
  CUST NAME                          CITY                ST
  ---- ------------------------------ -------------------- --
  WILL BG SOFTWARE CO.                SEATTLE              WA
  JANE ROCKY FLYER INC.              DENVER              CO

  至此,GoldenGate單向表DML同步實驗完成。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-1973438/,如需轉載,請註明出處,否則將追究法律責任。

相關文章