Adding new table to existing GoldenGate Replication
In this article, we will add a new table in existing GG replication setup without downtime using filter (@GETENV (‘TRANSACTION’,’CSN’) > scn number);
Source : GG11
Target : GG12
Source :
Connect and Login to the ggsci
1 2 3 4 5 |
[oracle@GG11 19c12]$ ./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 19.1.0.0.1 OGGCORE_19.1.0.0.0_PLATFORMS_190524.2201_FBO Operating system character set identified as UTF-8. Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved. |
Check the process running
1 2 3 4 5 6 7 |
GGSCI (GG11) 1> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPUMP1_SRC 00:00:00 00:00:09 EXTRACT RUNNING DPUMP2_SRC 00:00:00 00:00:07 EXTRACT RUNNING EXT1_SRC 00:00:03 00:00:09 EXTRACT RUNNING EXT2_SRC 00:00:02 00:00:07 |
View the Source extract param file
1 2 3 4 5 6 7 8 9 10 11 12 |
GGSCI (GG11) 2> view param EXT1_SRC extract EXT1_SRC useridalias gg11_gguser exttrail ./dirdat/EXT1_SRC/E1 REPORTCOUNT EVERY 1000 RECORDS, RATE TABLE KTEXPERTS.ADAARMS; TABLE KTEXPERTS.NOTE; TABLE KTEXPERTS.TRLRRAB; TABLE KTEXPERTS.TREVRS; TABLE KTEXPERTS.AUDIT_SQL; TABLE KTEXPERTS.LOG; TABLE KTEXPERTS.NOTING; |
Login as DB user
1 |
GGSCI (GG11) 3> dblogin useridalias gg11_gguser |
Check trandata is enabled on table which we need to add
1 2 |
GGSCI (GG11 as gguser@nposqp1) 4> info trandata KTEXPERTS.PTRCET Logging of supplemental redo log data is disabled for table KTEXPERTS.PTRCET. |
Add the trandata for the table
1 2 3 4 5 |
GGSCI (GG11 as gguser@nposqp1) 6> ADD trandata KTEXPERTS.PTRCET ALLCOLS 2021-07-28 23:54:30 INFO OGG-15132 Logging of supplemental redo data enabled for table KTEXPERTS.PTRCET. 2021-07-28 23:54:30 INFO OGG-15133 TRANDATA for scheduling columns has been added on table KTEXPERTS.PTRCET. 2021-07-28 23:54:30 INFO OGG-15134 TRANDATA for all columns has been added on table KTEXPERTS.PTRCET. 2021-07-28 23:54:30 INFO OGG-15135 TRANDATA for instantiation CSN has been added on table KTEXPERTS.PTRCET. |
Stop the extract process and use leg end command to stop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
GGSCI (GG11 as gguser@nposqp1) 9> stop extract EXT1_SRC Sending STOP request to EXTRACT EXT1_SRC ... Request processed. GGSCI (GG11 as gguser@nposqp1) 10> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPUMP1_SRC 00:00:00 00:00:02 EXTRACT RUNNING DPUMP2_SRC 00:00:00 00:00:00 EXTRACT RUNNING EXT1_SRC 00:00:04 00:00:03 EXTRACT RUNNING EXT2_SRC 00:00:04 00:00:09 GGSCI (GG11 as gguser@nposqp1) 11> info EXT1_SRC EXTRACT EXT1_SRC Last Started 2021-04-03 07:45 Status STOPPED Checkpoint Lag 00:00:04 (updated 00:00:12 ago) Log Read Checkpoint Oracle Integrated Redo Logs 2021-07-28 23:55:09 SCN 3354.1123057821 (14406443368605) |
Do logend of pump process
1 2 3 |
GGSCI (GG11 as gguser@nposqp1) 12> send DPUMP1_SRC logend Sending LOGEND request to EXTRACT DPUMP1_SRC ... YES |
On Target side :
1 2 3 4 5 6 7 |
GGSCI (GG12) 1> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REPPOSP1 00:00:07 00:00:02 REPLICAT RUNNING REPPOSP2 00:00:10 00:00:02 REPLICAT RUNNING REP1_SRC 00:00:08 00:00:07 REPLICAT RUNNING REP2_SRC 00:00:00 00:00:04 |
1 2 3 4 5 6 7 |
GGSCI (GG12) 3> info REP1_SRC REPLICAT REP1_SRC Last Started 2021-07-18 22:41 Status RUNNING INTEGRATED Checkpoint Lag 00:00:00 (updated 00:00:08 ago) Process ID 6546 Log Read Checkpoint File /u02/dbbackup/GG_trails_ora/pos_jda/R1000001523 2021-07-28 23:55:09.000297 RBA 32673607 |
Logend for replicate :
1 2 3 |
GGSCI (GG12) 6> send REP1_SRC logend Sending LOGEND request to REPLICAT REP1_SRC ... YES |
If the table size is large then take export and import in the Target database.
In Source : Take backup of the table
1 2 3 4 |
SQL> select current_scn from V$database; CURRENT_SCN ------------------------- 14408722271371 |
Take the export using flashback_scn
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
[oracle@GG11 ~]$ expdp "'/ as sysdba'" directory=DPUMP dumpfile=nposqp11_expdp_PTRCET_29Jul2021.dmp logfile=nposqp11_expdp_PTRCET_29Jul2021.log EXCLUDE=STATISTICS tables=KTEXPERTS.PTRCET flashback_scn=14408722271371 metrics=Y version=12.1 Export: Release 12.1.0.2.0 - Production on Thu Jul 29 00:05:17 2021 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options FLASHBACK automatically enabled to preserve database integrity. Starting "SYS"."SYS_EXPORT_TABLE_01": "/******** AS SYSDBA" directory=DPUMP dumpfile=nposqp11_expdp_PTRCET_29Jul2021.dmp logfile=nposqp11_expdp_PTRCET_29Jul2021.log EXCLUDE=STATISTICS tables=KTEXPERTS.PTRCET flashback_scn=14408722271371 metrics=Y version=12.1 Startup took 1 seconds Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Estimated 1 TABLE_DATA objects in 0 seconds Total estimation using BLOCKS method: 8 MB Processing object type TABLE_EXPORT/TABLE/PROCACT_INSTANCE Completed 1 PROCACT_INSTANCE objects in 1 seconds Processing object type TABLE_EXPORT/TABLE/TABLE Completed 1 TABLE objects in 3 seconds Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Completed 3 OBJECT_GRANT objects in 1 seconds Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Completed 1 INDEX objects in 0 seconds Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Completed 6 CONSTRAINT objects in 2 seconds . . exported "KTEXPERTS"."PTRCET" 5.944 MB 69787 rows in 0 seconds Completed 1 TABLE_EXPORT/TABLE/TABLE_DATA objects in 0 seconds Master table "SYS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.SYS_EXPORT_TABLE_01 is: /dbbackup/datapump/nposqp1/nposqp11_expdp_PTRCET_29Jul2021.dmp Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at Thu Jul 29 00:05:27 2021 elapsed 0 00:00:08 |
Transfer the dumpfile to the target.
1 2 3 |
[oracle@GG11 ~]$ scp /dbbackup/datapump/sepwdcp1/nposqp11_expdp_PTRCET_29Jul2021.dmp oracle@GG12:/u02/dbbackup/datapump/nposqp2 oracle@GG12's password: nposqp11_expdp_PTRCET_29Jul2021.dmp 100% 6260KB 6.1MB/s 00:00 |
Import the dumpfile in Target DB:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[oracle@GG12 nposqp2]$ impdp "'/ as sysdba'" directory=DBA_EXPORT dumpfile=nposqp11_expdp_PTRCET_29Jul2021.dmp logfile=sepwdcp1_impdp_PRTDSC_29Jul2021_new.log remap_schema=KTEXPERTS:POSBKP table_exists_action=truncate Import: Release 12.1.0.2.0 - Production on Thu Jul 29 00:12:15 2021 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options Master table "SYS"."SYS_IMPORT_FULL_03" successfully loaded/unloaded Starting "SYS"."SYS_IMPORT_FULL_03": "/******** AS SYSDBA" directory=DBA_EXPORT dumpfile=nposqp11_expdp_PTRCET_29Jul2021.dmp logfile=sepwdcp1_impdp_PRTDSC_29Jul2021_new.log remap_schema=KTEXPERTS:POSBKP table_exists_action=truncate Processing object type TABLE_EXPORT/TABLE/PROCACT_INSTANCE Processing object type TABLE_EXPORT/TABLE/TABLE Table "POSBKP"."PTRCET" exists and has been truncated. Data will be loaded but all dependent metadata will be skipped due to table_exists_action of truncate Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "POSBKP"."PTRCET" 5.944 MB 69787 rows Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Job "SYS"."SYS_IMPORT_FULL_03" successfully completed at Thu Jul 29 00:12:17 2021 elapsed 0 00:00:02 |
Edit extract param and add table entry :
1 2 |
GGSCI (GG11 as gguser@nposqp1) 16> edit param EXT1_SRC TABLE KTEXPERTS.PTRCET; |
Check pump param file , if full schema importing just ignore
1 2 3 4 5 6 7 |
GGSCI (GG11 as gguser@nposqp1) 18> view param DPUMP1_SRC extract DPUMP1_SRC PASSTHRU REPORTCOUNT EVERY 1000 RECORDS, RATE rmthost 10.186.242.179, mgrport 7809 rmttrail /u02/dbbackup/GG_trails_ora/wdc_jda/R1 TABLE KTEXPERTS.*; |
In Target:
Add table entry in replicat param file
Note: use filter (@GETENV (‘TRANSACTION’,’CSN’) > scn number);
1 2 |
GGSCI (GG12) 3> edit param REP1_SRC MAP KTEXPERTS.PTRCET ,TARGET POSBKP.PTRCET,filter (@GETENV ('TRANSACTION','CSN') > 14408722271371); |
1 2 3 4 5 6 7 |
GGSCI (GG11 as gguser@nposqp1) 19> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT STOPPED DPUMP1_SRC 00:00:00 00:23:15 EXTRACT RUNNING DPUMP2_SRC 00:00:00 00:00:01 EXTRACT STOPPED EXT1_SRC 00:00:04 00:25:08 EXTRACT RUNNING EXT2_SRC 00:00:03 00:00:01 |
Start the extract :
1 2 3 |
GGSCI (GG11 as gguser@nposqp1) 20> start EXT1_SRC Sending START request to MANAGER ... EXTRACT EXT1_SRC starting |
Start the pump :
1 2 3 |
GGSCI (GG11 as gguser@nposqp1) 21> start DPUMP1_SRC Sending START request to MANAGER ... EXTRACT DPUMP1_SRC starting |
1 2 3 4 5 6 7 |
GGSCI (GG11 as gguser@nposqp1) 23> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPUMP1_SRC 00:00:00 00:00:02 EXTRACT RUNNING DPUMP2_SRC 00:00:00 00:00:01 EXTRACT RUNNING EXT1_SRC 00:19:52 00:00:00 EXTRACT RUNNING EXT2_SRC 00:00:04 00:00:01 |
Check the status of Extract using Send
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
GGSCI (GG11 as gguser@nposqp1) 24> send EXT1_SRC status Sending STATUS request to EXTRACT EXT1_SRC ... EXTRACT EXT1_SRC (PID 9029) Current status: Recovery complete: Processing data Current read position: Redo thread #: 1 Sequence #: 1710 RBA: 4253716828 Timestamp: 2021-07-29 00:20:54.000000 SCN: 3354.1123613592 (14408722271371) Current write position: Sequence #: 1523 RBA: 100693230 Timestamp: 2021-07-29 00:20:51.460073 Extract Trail: ./dirdat/EXT1_SRC/E1 |
Noe Log at check point time is cleared
1 2 3 4 5 6 7 |
GGSCI (GG11 as gguser@nposqp1) 25> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPUMP1_SRC 00:00:00 00:00:08 EXTRACT RUNNING DPUMP2_SRC 00:00:00 00:00:08 EXTRACT RUNNING EXT1_SRC 00:00:04 00:00:07 EXTRACT RUNNING EXT2_SRC 00:00:03 00:00:08 |
Target :
Check status of GG processes.
1 2 3 4 5 |
GGSCI (GG12) 12> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REP2_SRC 00:00:00 00:00:07 REPLICAT STOPPED REP1_SRC 00:00:00 00:18:16 |
Start Replicat process.
1 |
GGSCI (GG12) 12> start REP1_SRC |
1 2 3 4 5 |
GGSCI (GG12) 12> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REP2_SRC 00:00:00 00:00:07 REPLICAT RUNNING REP1_SRC 00:00:00 00:00:01 |
Now the lag is cleared and we can check table count in Source and Target as a part of Validation.
Check the stats for table which we replicated to know the transactions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
GGSCI (GG12) 23> stats REP1_SRC table POSBKP.PTRCET Sending STATS request to REPLICAT REP1_SRC ... Start of Statistics at 2021-07-29 00:29:16. Integrated Replicat Statistics: Total transactions 10071.00 Redirected 0.00 Replicated procedures 0.00 DDL operations 0.00 Stored procedures 0.00 Datatype functionality 0.00 Operation type functionality 0.00 Event actions 0.00 Direct transactions ratio 0.00% Fully qualified table name POSBKP.PTRCET is not found in the Oracle GoldenGate configuration. End of Statistics. |
Note : Once the validation is success then remove filters from replicat param file.
Target :
1 2 3 4 |
GGSCI (GG12) 26> stop REP1_SRC Sending STOP request to REPLICAT REP1_SRC ... Request processed. |
Remove filter entry in replicat param file
1 2 |
GGSCI (GG12) 3> edit param REP1_SRC MAP KTEXPERTS.PTRCET ,TARGET POSBKP.PTRCET; |
Start the replicat process.
1 2 3 4 |
GGSCI (GG12) 28> start REP1_SRC Sending START request to MANAGER ... REPLICAT REP1_SRC starting |
info all
1 2 3 4 5 |
GGSCI (GG12) 29> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REP2_SRC 00:00:00 00:00:08 REPLICAT RUNNING REP1_SRC 00:00:11 00:00:02 |
Info replicat
1 2 3 4 5 6 7 |
GGSCI (GG12) 30> info REP1_SRC REPLICAT REP1_SRC Last Started 2021-07-29 00:32 Status RUNNING INTEGRATED Checkpoint Lag 00:00:00 (updated 00:00:03 ago) Process ID 79480 Log Read Checkpoint File /u02/dbbackup/GG_trails_ora/pos_jda/R1000001524 2021-07-29 00:31:53.000284 RBA 119345238 |
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts