GoldenGate将Oracle数据同步到GreenPlum(2)

--编辑添加RAC1和RAC2 Oracle用户的tnsnames.ora文件,支持ASM访问
 [oracle@vzwc1 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
 # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.
 

ZWC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vzwc-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = zwc)
    )
  )
 

ASM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vzwc1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = +ASM)
      (INSTANCE_NAME = +ASM1)
      (UR=A)
    )
  )
 [oracle@vzwc1 ~]$ ssh vzwc2 cat $ORACLE_HOME/network/admin/tnsnames.ora
 # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.
 

ZWC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vzwc-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = zwc)
    )
  )
 

ASM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vzwc2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = +ASM)
      (INSTANCE_NAME = +ASM2)
      (UR=A)
    )
  )
 


 

--开启SUPPLEMENTAL LOG
 SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
 

Database altered.
 

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS; 
 

Database altered.
 

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;
 

Database altered.
 

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (FOREIGN KEY) COLUMNS; 
 

Database altered.
 

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
 

Database altered.
 --也可以针对表级别开启补充日志
 SQL> ALTER TABLE SCOTT.EMP ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
 

Table altered.
 

--在/ggs/ogg下解压ggs_Linux_x64_ora11g_64bit_v11_1_1_0_0_078.tar和ggs_FileWriter_Linux_x64_v11_1_1_0_0_007.tar
 --配置OGG
 [oracle@vzwc1 ogg]$ ./ggsci
 

Oracle GoldenGate Command Interpreter for Oracle
 Version 11.1.1.0.0 Build 078
 Linux, x64, 64bit (optimized), Oracle 11 on Jul 28 2010 13:13:42
 

Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
 

GGSCI (vzwc1) 1> create subdirs   
 

Creating subdirectories under current directory /ggs/ogg
 

Parameter files                /ggs/ogg/dirprm: created
 Report files                  /ggs/ogg/dirrpt: created
 Checkpoint files              /ggs/ogg/dirchk: created
 Process status files          /ggs/ogg/dirpcs: created
 SQL script files              /ggs/ogg/dirsql: created
 Database definitions files    /ggs/ogg/dirdef: created
 Extract data files            /ggs/ogg/dirdat: created
 Temporary files                /ggs/ogg/dirtmp: created
 Veridata files                /ggs/ogg/dirver: created
 Veridata Lock files            /ggs/ogg/dirver/lock: created
 Veridata Out-Of-Sync files    /ggs/ogg/dirver/oos: created
 Veridata Out-Of-Sync XML files /ggs/ogg/dirver/oosxml: created
 Veridata Parameter files      /ggs/ogg/dirver/params: created
 Veridata Report files          /ggs/ogg/dirver/report: created
 Veridata Status files          /ggs/ogg/dirver/status: created
 Veridata Trace files          /ggs/ogg/dirver/trace: created
 Stdout files                  /ggs/ogg/dirout: created
 


--配置mgr
 GGSCI (vzwc1) 3> edit params mgr
 

GGSCI (vzwc1) 4> view params mgr
 

PORT 7809
 DYNAMICPORTLIST 7840-7914
 USERID goldengate, PASSWORD goldengate
 AUTORESTART EXTRACT *,RETRIES 3,WAITMINUTES 5,RESETMINUTES 10
 PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 1
 PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5
 PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5
 LAGREPORTHOURS 1
 LAGINFOMINUTES 30
 LAGCRITICALMINUTES 45
 

GGSCI (vzwc1) 5> start mgr
 

Manager started.
 

GGSCI (vzwc1) 6> info mgr
 

Manager is running (IP port vzwc1.7809).
 

GGSCI (vzwc1) 40> dblogin userid ggadmin, password ggadmin
 Successfully logged into database.
 

GGSCI (vzwc1) 41> add trandata scott.*
 

2014-02-15 23:14:50  WARNING OGG-00869  No unique key is defined for table BONUS. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.
 

Logging of supplemental redo data enabled for table SCOTT.BONUS.
 

Logging of supplemental redo data enabled for table SCOTT.DEPT.
 

Logging of supplemental redo data enabled for table SCOTT.EMP.
 

2014-02-15 23:14:52  WARNING OGG-00869  No unique key is defined for table SALGRADE. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.
 

Logging of supplemental redo data enabled for table SCOTT.SALGRADE.
 

GGSCI (vzwc1) 43> list tables scott.*
 SCOTT.BONUS
 SCOTT.DEPT
 SCOTT.EMP
 SCOTT.SALGRADE
 

Found 4 tables matching list criteria.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d9d4d37846b4bc0ce68ed37f4a951f4a.html