ITPub博客

首页 > 数据库 > Oracle > 【OGG】Oracle GoldenGate 11g (二) GoldenGate 11g 单向同步配置 下

【OGG】Oracle GoldenGate 11g (二) GoldenGate 11g 单向同步配置 下

原创 Oracle 作者:海星星hktk 时间:2017-11-20 17:59:10 0 删除 编辑
                                 Oracle GoldenGate 11g (二)
GoldenGate 11g 单向同步配置 下

Item

Source System

Target System

Platform

RHEL6.4 - 64bit

RHEL6.4 - 64bit

Hostname

rhel64.oracle.com

ora11g.oracle.com

Database

Oracle 11.2.0.3

Oracle 11.2.0.3

Character Set

AL32UTF8

AL32UTF8

ORACLE_SID

PROD

EMREP

Listener Name/Port

LISTENER/1521

LISTENER/1521

Goldengate User

ogg

ogg


1.6    Configure Replicat process in target system

1.6.1  Create GLOBALS parameter in target system

Edit GLOBALS(upper case) parameter file to indicate checkpoint table

GGSCI (rhel102.oracle.com) 11> edit params ./GLOBALS

Add:

CHECKPOINTTABLE ogg.ggschkpt

Verify:

[oracle@rhel102 ~]$ ll /u01/app/oracle/ggs/11.2.1/GLOBALS

-rw-rw-rw- 1 oracle oinstall 29 Jan  5 10:17 /u01/app/oracle/ggs/11.2.1/GLOBALS

 


For GLOBALS configuration take effect, we must exit GGSCI session:

GGSCI (rhel102.oracle.com) 14> exit

 

Add replicat checkpoint table in target system:

[oracle@rhel102 11.2.1]$ ggsci

GGSCI (rhel102.oracle.com) 1> dblogin userid ogg,password ogg

Successfully logged into database.

 

GGSCI (rhel102.oracle.com) 2> add checkpointtable

 

No checkpoint table specified, using GLOBALS specification (ogg.ggschkpt)...

 

Successfully created checkpoint table ogg.ggschkpt.

 

 

1.6.2  Edit Delivery process parameter rora_1

Add Replicat group:

GGSCI (rhel102.oracle.com) 5> add replicat rora_1,exttrail ./dirdat/ra

REPLICAT added.、

 

Edit replicat process RORA_1 parameter:

GGSCI (rhel102.oracle.com) 4> edit params rora_1

Add:

-- Change Delivery parameter file to apply scott.ggtab Changes

REPLICAT RORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)

USERID ogg, PASSWORD ogg

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE ./dirrpt/RORAaa.DSC, PURGE

MAP scott.ggtab, TARGET scott.ggtab;

Note: In the MAP statement, the first owner/schema is for the source and the second for the target.

 

 

 

 

GGSCI (rhel102.oracle.com) 15> view params rora_1

 

 

 

 

Start Replicat process:

GGSCI (rhel102.oracle.com) 7> start replicat rora_1

 

Sending START request to MANAGER ...

REPLICAT RORA_1 starting

 

 

GGSCI (rhel102.oracle.com) 8> info replicat rora_1

 

REPLICAT   RORA_1    Last Started 2017-01-05 10:27   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:05 ago)

Log Read Checkpoint  File ./dirdat/ra000000

                     First Record  RBA 0

 

 

GGSCI (rhel102.oracle.com) 9> info all

 

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

 

MANAGER     RUNNING                                          

REPLICAT    RUNNING     RORA_1      00:00:00      00:00:08   

 

1.6.3  Verify if DML can be duplicated correctly

1.6.3.1  Insert operation

Insert data in source system:

SCOTT@PROD>insert into ggtab values

 (8888,'Damon','DBA',7788,sysdate,800,100,10);

SCOTT@PROD>commit;

 

Check the result in target system:

SCOTT@EMREP>select * from ggtab;

 

 

1.6.3.2 Update operation

Update data:

SCOTT@PROD>update ggtab set ename='lvh' where empno=7788;

SCOTT@PROD>commit;

 

Check the result in target system:

 

 

1.6.3.3 Delete operation

Delete data:

SCOTT@PROD>delete from ggtab where deptno=10;

SCOTT@PROD>commit;

 

Check the result in target system:

SCOTT@EMREP>select * from ggtab;

 

 

SCOTT@ test1>select * from lvxinghao;


 EMPNO ENAME   JOB         MGR HIREDATE     SAL  COMM DEPTNO

------ ------- --------- ----- --------- ------ ----- ------

  7788 lxh     ANALYST    7566 19-APR-87   3000           20

  7839 KING    PRESIDENT       17-NOV-81   5000           10

  7844 TURNER  SALESMAN   7698 08-SEP-81   1500     0     30

  7876 ADAMS   CLERK      7788 23-MAY-87   1100           20

  7900 JAMES   CLERK      7698 03-DEC-81    950           30

  7902 FORD    ANALYST    7566 03-DEC-81   3000           20

  7934 MILLER  CLERK      7782 23-JAN-82   1300           10

  8000 Damon   CLERK      7902 13-SEP-14    800   100     20

  8001 Elena   CLERK      7698 13-SEP-14    600   200     30

9 rows selected.


1.7    Configure eora_1 pora_1 rora_1 同步scott用户所有表

1.7.1  eora_1

 

 

GGSCI (rhel101.oracle.com) 1> view params eora_1

 

 

1.7.2  pora_1

GGSCI (rhel101.oracle.com) 7> view params pora_1

 

 

 

 

1.7.3  rora_1

GGSCI (rhel102.oracle.com) 3> view params rora_1

 

 

 

 

 

1.8    Limitation and Process

1.8.1  Column Width differs in different encoding

In zhs16gbk encoding, two bytes represents one chinese character. However, in AL32UTF8 encoding three bytes represents one chinese character. Therefore, if we INSERT 10 chinese characters in source system (zhs16gbk), which actually occupies 20 bytes, it will become 30 bytes in target system (AL32UTF8). If the column maximum width is 20 bytes, The INSERT operation can succeed in source system, but fail in target system.

 

List details about process :  info replicat rora_1,showch  --showch show channel

1.8.2  List details about process

Source system

GGSCI (rhel101.oracle.com) 41> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     RUNNING                                          

EXTRACT     RUNNING     EORA_1      00:00:00      00:00:01   

EXTRACT     RUNNING     PORA_1      00:00:00      00:00:05

 

 

GGSCI (rhel101.oracle.com) 43> info extract eora_1,showch

 

EXTRACT    EORA_1    Last Started 2014-09-13 20:38   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:07 ago)

Log Read Checkpoint  Oracle Redo Logs

                     2014-09-13 21:41:04  Seqno 21, RBA 13795840

 

 

Current Checkpoint Detail:

 

Read Checkpoint #1

  Oracle Redo Log

  Startup Checkpoint (starting position in the data source):

    Sequence #: 21

    RBA: 11470864

    Timestamp: 2014-09-13 20:36:38.000000

    Redo File:

  Recovery Checkpoint (position of oldest unprocessed transaction in the data source):

    Sequence #: 21

    RBA: 13795344

    Timestamp: 2014-09-13 21:41:04.000000

    Redo File: /disk1/oradata/prod/redo02a.log

  Current Checkpoint (position of last record read in the data source):

    Sequence #: 21

    RBA: 13795840

    Timestamp: 2014-09-13 21:41:04.000000

    Redo File: /disk1/oradata/prod/redo02a.log

Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position):

    Sequence #: 0

    RBA: 2432

    Timestamp: 2014-09-13 21:41:08.203754

    Extract Trail: ./dirdat/aa

Header:

  Version = 2

  Record Source = A

  Type = 4

  # Input Checkpoints = 1

  # Output Checkpoints = 1

File Information:

  Block Size = 2048

  Max Blocks = 100

  Record Length = 2048

  Current Offset = 0

Configuration:

  Data Source = 3

  Transaction Integrity = 1

  Task Type = 0

 

Status:

  Start Time = 2014-09-13 20:38:06

  Last Update Time = 2014-09-13 21:41:08

  Stop Status = A

  Last Result = 400

 

GGSCI (rhel101.oracle.com) 44> info extract pora_1,showch

 

EXTRACT    PORA_1    Last Started 2014-09-13 20:59   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:06 ago)

Log Read Checkpoint  File ./dirdat/aa000000

                     2014-09-13 21:28:58.000000  RBA 2432

Current Checkpoint Detail:

Read Checkpoint #1

  GGS Log Trail

  Startup Checkpoint (starting position in the data source):

    Sequence #: 0

    RBA: 0

    Timestamp: Not Available

    Extract Trail: ./dirdat/aa

  Current Checkpoint (position of last record read in the data source):

    Sequence #: 0

    RBA: 2432

    Timestamp: 2014-09-13 21:28:58.000000

    Extract Trail: ./dirdat/aa

Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position):

    Sequence #: 0

    RBA: 2469

    Timestamp: 2014-09-13 21:43:01.820809

    Extract Trail: ./dirdat/pa

Header:

  Version = 2

  Record Source = A

  Type = 1

  # Input Checkpoints = 1

  # Output Checkpoints = 1

File Information:

  Block Size = 2048

  Max Blocks = 100

  Record Length = 2048

  Current Offset = 0

Configuration:

  Data Source = 0

  Transaction Integrity = 1

  Task Type = 0

Status:

  Start Time = 2014-09-13 20:59:44

  Last Update Time = 2014-09-13 21:43:01

  Stop Status = A

  Last Result = 400

Target System

GGSCI (rhel102.oracle.com) 12> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     RUNNING                                          

REPLICAT    RUNNING     RORA_1      00:00:00      00:00:09

 

GGSCI (rhel102.oracle.com) 14> info replicat rora_1,showch

 

REPLICAT   RORA_1    Last Started 2014-09-13 21:09   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:01 ago)

Log Read Checkpoint  File ./dirdat/pa000000

                     2014-09-13 21:28:58.461077  RBA 2469

Current Checkpoint Detail:

Read Checkpoint #1

  GGS Log Trail

  Startup Checkpoint (starting position in the data source):

    Sequence #: 0

    RBA: 0

    Timestamp: Not Available

    Extract Trail: ./dirdat/pa

  Current Checkpoint (position of last record read in the data source):

    Sequence #: 0

    RBA: 2469

    Timestamp: 2014-09-13 21:28:58.461077

    Extract Trail: ./dirdat/pa

Header:

  Version = 2

  Record Source = A

  Type = 1

  # Input Checkpoints = 1

  # Output Checkpoints = 0

File Information:

  Block Size = 2048

  Max Blocks = 100

  Record Length = 2048

  Current Offset = 0

Configuration:

  Data Source = 0

  Transaction Integrity = -1

  Task Type = 0

Database Checkpoint:

  Checkpoint table = OGG.GGSCHKPT

  Key = 421866981 (0x19252de5)

  Create Time = 2014-09-13 21:07:43

Status:

  Start Time = 2014-09-13 21:09:51

  Last Update Time = 2014-09-13 21:37:56

  Stop Status = A

  Last Result = 400

 

吕星昊
2017年11月20日


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29475508/viewspace-2147522/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
恩墨学院 Oracle OCM 认证培训教学总监。拥有RHCE、OCP、OCM 认证证书。5年教育培训行业经验。Oracle WDP 注册OCM讲师,已培养Oracle OCP认证专家1000余人,培养Oracle OCM认证大师200余人。

注册时间:2014-02-08

  • 博文量
    128
  • 访问量
    2516036