Oracle 11g GoldenGate与Oracle 11g数据同步(2)


3.在source端修改支持supplemental log日志
[oracle@oracle11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 20 04:18:26 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database add supplemental log data;     
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> select supplemental_log_data_min from v$database;
SUPPLEME
--------
YES
SQL>


4.在source端和target端创建表空间,用户和测试表(只有source端有测试数据)
source节点:

SQL> create tablespace wuhan datafile '/u01/oracle/oradata/orac11g/wuhan.dbf' size 100m;
Tablespace created.
SQL> create user gguser identified by system default tablespace wuhan quota unlimited on wuhan;
User created.
SQL> grant dba,resource,connect to gguser;
Grant succeeded.
SQL> conn gguser/system
Connected.
SQL> create table t (a number,b char(10));
Table created.
SQL> insert into t values(1,'a');
1 row created.
SQL> insert into t values(2,'b');
1 row created.
SQL> insert into t values(3,'c');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
  A    B
---------- ----------
  1    a
  2    b
  3    c
SQL>


target节点:
SQL> create tablespace wuhan datafile '/u01/app/oracle/oradata/oracleogg/wuhan.dbf' size 100m;
Tablespace created.
SQL> create user gguser identified by system default tablespace wuhan quota unlimited on wuhan;
User created.
SQL> grant dba,resource,connect to gguser;
Grant succeeded.
SQL> conn gguser/system
Connected.
SQL> create table t (a number,b char(10));
Table created.
SQL>


5.source端和target端启动mgr进程(两个节点都需要做)
aource节点:

GGSCI (oracle11g) 3> edit params mgr        --设置mgr的端口
-- port                  --这个是注释
PORT 7809        --指定的端口
GGSCI (oracle11g) 4> start mgr      --启动mgr
Manager started.
GGSCI (oracle11g) 6> info mgr      --查看mgr的状态
Manager is running (IP port oracle11g.7809).
GGSCI (oracle11g) 7>


6.配置glodengate需要同步的表(source节点)

GGSCI (oracle11g) 7> dblogin userid gguser, password system
Successfully logged into database.
GGSCI (oracle11g) 8> add trandata gguser.t            --也可以使用通配符(add trandata gguser.*)
2016-11-20 05:32:50  WARNING OGG-00869  No unique key is defined for table 'T'. 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 GGUSER.T.
GGSCI (oracle11g) 9> info trandata gguser.*
Logging of supplemental redo log data is enabled for table GGUSER.T.
Columns supplementally logged for table GGUSER.T: A, B.
GGSCI (oracle11g) 10>


7.初使化数据(将source的数据导入到target节点中)
source节点:

GGSCI (oracle11g) 10> add extract einiaa, sourceistable
EXTRACT added.
GGSCI (oracle11g) 11> edit params einiaa

EXTRACT EINIAA
USERID GGUSER, PASSWORD "system"
RMTHOST 192.168.3.90, MGRPORT 7809
RMTTASK REPLICAT, GROUP RINIAA
TABLE gguser.t;
GGSCI (oracle11g) 12>

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

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