Install Oracle GoldenGate [3]

27 Mar

III. Demo Replication
1. manager harus start source
[oracle@orcl10 ~]$ cd $GGATE
[oracle@orcl10 gg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 10.4.0.19 Build 002
Linux, x64, 64bit (optimized), Oracle 10 on Sep 22 2009 14:18:08
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.


GGSCI (orcl10) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED

GGSCI (orcl10) 2> info manager
Manager is DOWN!

GGSCI (orcl10) 3> start manager
Manager started.

GGSCI (orcl10) 4> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING

2. Create scipt

GGSCI (orcl10) 5> add extract ext1, tranlog, begin now
EXTRACT added.

GGSCI (orcl10) 6> add exttrail /u01/app/oracle/product/gg/dirdat/lt, extract ext1
EXTTRAIL added.

GGSCI (orcl10) 7> edit params ext1
–extract group–
EXTRACT ext1
–connection to database–
USERID ggate, PASSWORD 123456
–hostname and port for trail–
RMTHOST orcl3, MGRPORT 7809
–path and name for trail–
rmttrail /u01/app/oracle/product/gg/dirdat/lt
–DDL support
ddl include mapped objname orcl10.*
–DML
TABLE orcl10.*;

#####################################################
### penjelasan
#####################################################
EXTRACT: nama dari extract group
USERID/PASSWORD: user di source server
RMTHOST: IP address / hostname dari target server
MGRPORT: port manager Golden Gate
TABLE: tabel yang akan di-extracted & replicated, sebutkan schemanya

GGSCI (orcl10) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:13:55

3. Create scipt [target]
[oracle@orcl3 ~]$ cd $GGATE
[oracle@orcl3 gg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 10.4.0.19 Build 002
Linux, x64, 64bit (optimized), Oracle 10 on Sep 22 2009 14:18:08
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.

GGSCI (orcl3) 1> dblogin userid ggate
Password:
Successfully logged into database.

GGSCI (orcl3) 2> add checkpointtable ggate.checkpoint
Successfully created checkpoint table GGATE.CHECKPOINT.

GGSCI (orcl3) 3> edit params ./GLOBALS
GGSCHEMA orcl3
CHECKPOINTTABLE ggate.checkpoint

GGSCI (orcl3) 4> add replicat rep1, exttrail /u01/app/oracle/product/gg/dirdat/lt,checkpointtable ggate.checkpoint
REPLICAT added.

GGSCI (orcl3) 5> edit params rep1
–Replicat group —
replicat rep1
–source and target definitions
ASSUMETARGETDEFS
–target database login —
userid ggate, password 123456
–ddl support
DDL
–file for dicarded transaction —
discardfile /u01/app/oracle/product/gg/discard/rep1_discard.txt, append, megabytes 10
map orcl10.*, target orcl3.*;

4. Start extract and replicat:
###################################
### Source:
###################################
GGSCI (orcl10) 9> start extract ext1
Sending START request to MANAGER …
EXTRACT EXT1 starting

###################################
### Destination:
###################################
GGSCI (orcl3) 7> start replicat rep1
ERROR: Manager not currently running.

GGSCI (orcl3) 8> start manager
Manager started.

GGSCI (orcl3) 9> start replicat rep1
Sending START request to MANAGER …
REPLICAT REP1 starting

5. testttttttttt
a. source : create table, insert 2 record
target : ter-replikasi
###################################
### Source:
###################################
[oracle@orcl10 gg]$ sqlplus orcl10/123456@orcl10
SQL> CREATE TABLE DEPT
( DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13)
);

SQL> CREATE UNIQUE INDEX PK_DEPT ON DEPT(DEPTNO) LOGGING;
SQL> ALTER TABLE DEPT ADD (CONSTRAINT PK_DEPT PRIMARY KEY (DEPTNO));
SQL> insert into dept values (51,’IT’,’SBY’);
SQL> insert into dept values (52,’AU’,’SBY’);
SQL> commit;
SQL> select * from dept order by deptno;
DEPTNO DNAME LOC
———- ————– ————-
51 IT SBY
52 AU SBY

###################################
### Target:
###################################
[oracle@orcl3 gg]$ sqlplus orcl3/123456@orcl3
SQL> select * from dept order by deptno;
DEPTNO DNAME LOC
———- ————– ————-
51 IT SBY
52 AU SBY

b. source : insert 2 record lagi
target : ter-replikasi
###################################
### Source:
###################################
SQL> insert into dept values (53,’MKT’,’JKT’);
SQL> insert into dept values (54,’ACC’,’JKT’);
SQL> commit;
SQL> select * from dept order by deptno;
DEPTNO DNAME LOC
———- ————– ————-
51 IT SBY
52 AU SBY
53 MKT JKT
54 ACC JKT

###################################
### Target:
###################################
SQL> select * from dept order by deptno;
DEPTNO DNAME LOC
———- ————– ————-
51 IT SBY
52 AU SBY
53 MKT JKT
54 ACC JKT

referensi :
http://www.pythian.com/news/7959/oracle-goldengate-installation-part-1/
http://gavinsoorma.com/2010/02/08/goldengate-concepts-and-architecture/
http://gavinsoorma.com/2010/02/09/goldengate-installation-oracle-11g-on-red-hat-linux/
http://gavinsoorma.com/2010/02/11/goldengate-tutorial-3-configuring-the-manager-process/
http://gavinsoorma.com/2010/02/15/oracle-goldengate-tutorial-4-performing-initial-data-load/

1. Oracle Golden Gate

2. install-oracle-goldengate 1

3. install-oracle-goldengate 2

4. install-oracle-goldengate 3

3 Responses to “Install Oracle GoldenGate [3]”

  1. setijo agus April 7, 2010 at 7:44 am #

    contoh diatas tidak untuk ‘update’ dan ‘bi-directonal’

  2. yahya December 17, 2011 at 3:31 am #

    Pak Setijo, menambahkan untuk langkah-langkah di atas, perlu perintah ggsci:
    ggsci> add trandata namaschema.*

    jadi kalau melibatkan ratusan schema, semuanya perlu dieksekusi seperti karena gg tidak support wildcard nama schema.

    Dampaknya kalau perintah trandata belum dilakukan, perintah DML update tidak berjalan, tapi perintah DML insert seperti dicontohkan di atas berjalan.

  3. yahya December 17, 2011 at 3:36 am #

    Bisa menggunakan perintah obey jika telah menyimpan berbaris2x perintah gg.
    Misal :
    $ vi addtrandata_all
    add trandata hr.*
    add trandata scott.*
    add trandata schemaku.*

    $ ./ggsci
    ggsci > dblogin userid ggate, password 123456
    ggsci > obey addtrandata_all

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: