Schema to be replicated "SCOTT". SOURCE DATABASE. OS - Red Hat Enterprise Linux Server release 5.4 Hostname - canada IP Address - 192.168.1.100 Database - Oracle 11g Release 2. SID - orcl GoldenGate Version - 11.1.1.1.2 Sample "/etc/hosts" file.# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.1.100 canada canada 192.168.1.200 london london
TARGET DATABASE. OS - Red Hat Enterprise Linux Server release 5.4 Hostname - london IP Address - 192.168.1.200 Database - Oracle 11g Release 2 SID - dup GoldenGate Version - 11.1.1.1.2 Sample "/etc/hosts" file.# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.1.100 canada canada 192.168.1.200 london london
Install GoldenGate Software on both the machines.---link --make sure supplemental log data is enabled only for the source database. Ping from both the machines to ensure network connectivity. --Do from both machines. # ping canada # ping london Both the databases should be in archivelog mode. ON SOURCE [oracle@canada gg]$ export ORACLE_SID=orcl [oracle@canada gg]$ ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 Linux, x86, 32bit (optimized), Oracle 11g on Oct 4 2011 23:53:33 Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved. GGSCI (canada) 1> dblogin userid ggs_admin, password ggs_admin Successfully logged into database. --Add supplemental logging on the source database for tables --in the SCOTT users schema. GGSCI (canada) 2> add trandata SCOTT.* Configure manager service on both Source and Target. ggsci > edit param mgr port 7980 purgeoldextracts dirdat/*, usecheckpoints, minkeepdays 2 -The above parameter instructs the GoldenGate software to -delete all the trails which have been used by the Extract -and Replicat process after 2 days. ggsci > start manager Manager started. ggsci > info manager Manager is running (IP port canada.7980). Configure local extract on source. ggsci> edit param ext1 extract ext1 userid ggs_admin, password ggs_admin exttrail dirdat/t1 table SCOTT.*; GGSCI (canada) 8> add extract ext1, tranlog, begin now EXTRACT added. GGSCI (canada) 9> add exttrail dirdat/t1, extract ext1, megabytes 100 EXTTRAIL added. GGSCI (canada) 10> start extract ext1 Sending START request to MANAGER ... EXTRACT EXT1 starting GGSCI (canada) 13> info extract ext1EXTRACT EXT1 Last Started 2012-03-15 20:47 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:03 ago) Log Read Checkpoint Oracle Redo Logs 2012-03-15 20:48:15 Seqno 5, RBA 6204416
To stop the extract. ggsci > stop extract ext1 Configure datapump on source. GGSCI> edit param dpump1 extract dpump1 passthru rmthost london, mgrport 7980 rmttrail dirdat/t2 table SCOTT.*; --passthru parameter is used here because we are not using any data --filteration or column mapping. The source and target data structures --are identical. GGSCI (canada) 15> add extract dpump1, exttrailsource dirdat/t1 EXTRACT added. GGSCI (canada) 16> add rmttrail dirdat/t2, extract dpump1, megabytes 100 RMTTRAIL added. GGSCI (canada) 17> start extract dpump1 Sending START request to MANAGER ... EXTRACT DPUMP1 starting To stop datapump. GGSCI> stop extract dpump1 GGSCI (canada) 18> info extract dpump1EXTRACT DPUMP1 Last Started 2012-03-15 20:58 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:04 ago) Log Read Checkpoint File dirdat/t1000000 First Record RBA 943
GGSCI (canada) 19> info allProgram Status Group Lag Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPUMP1 00:00:00 00:00:00 EXTRACT RUNNING EXT1 00:00:00 00:00:02
Configure Replicat on target database. [oracle@london gg]$ export ORACLE_SID=dup [oracle@london gg]$ ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 Linux, x86, 32bit (optimized), Oracle 11g on Oct 4 2011 23:53:33 Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved. -create checkpoint table GGSCI (london) 3> dblogin userid ggs_admin, password ggs_admin Successfully logged into database. GGSCI (london) 4> add checkpointtable ggs_admin.chkpt Successfully created checkpoint table GGS_ADMIN.CHKPT. GGSCI (london) 1> edit param repl1 replicat repl1 userid ggs_admin, password ggs_admin handlecollisions assumetargetdefs discardfile dirrpt/repl1.dsc, append discardrollover at 5:00 on sunday map SCOTT.*, target SCOTT.*; --handlecollisions helps in detection and resolution of DML errors, while applying --changes to the target. --assumetargetdefs parameter tells the GoldenGate software that source and --target tables are identical. --discardfile parameter instructs the GoldenGate software to write --all the errors encountered to the file specified. --discardrollover parameter instructs the goldengate software to create --a new discardfile every sunday at 5:00. --The old discard file can be safely deleted in order to avoid --space constraints. GGSCI (london) 5> add replicat repl1, exttrail dirdat/t2, checkpointtable ggs_admin.chkpt REPLICAT added. GGSCI (london) 6> start replicat repl1 Sending START request to MANAGER ... REPLICAT REPL1 starting To stop replicat service. GGSCI> stop replicat repl1 GGSCI (london) 7> info replicat repl1REPLICAT REPL1 Last Started 2012-03-15 21:28 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:09 ago) Log Read Checkpoint File dirdat/t2000000 First Record RBA 0
GGSCI (london) 8> info allProgram Status Group Lag Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REPL1 00:00:00 00:00:03
Verify. On Source SQL> conn scott/tiger SQL> update emp set sal=13000 where ename='MILLER'; 1 row updated. SQL> commit; Commit complete. On Target SQL>conn scott/tiger SQL> select sal from emp where ename='MILLER'; SAL ---------- 13000 Also, SQL> exit [oracle@london gg]$ export ORACLE_SID=dup [oracle@london gg]$ ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 Linux, x86, 32bit (optimized), Oracle 11g on Oct 4 2011 23:53:33 Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved. GGSCI (london) 1> stats replicat repl1Sending STATS request to REPLICAT REPL1 ... Start of Statistics at 2012-03-15 21:35:11. Replicating from SCOTT.EMP to SCOTT.EMP: *** Total statistics since 2012-03-15 21:31:54 *** Total inserts 0.00 Total updates 1.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 *** Daily statistics since 2012-03-15 21:31:54 *** Total inserts 0.00 Total updates 1.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 *** Hourly statistics since 2012-03-15 21:31:54 *** Total inserts 0.00 Total updates 1.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 *** Latest statistics since 2012-03-15 21:31:54 *** Total inserts 0.00 Total updates 1.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 End of Statistics.
--At this point your basic DML unidirectional replication is complete.
Search This Blog
Friday, March 16, 2012
Oracle GoldenGate Basic DML Replication.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment