Oracle Database

Replicat process of oracle goldengate 26ai part 2 read&learn gg

Photo by Markus Spiske on Unsplash

Replicat process is responsible for applying remote trail files to the target database . We discussed Replicat internals in our previous blog. This blog focusses on creating a replicat and the frequently used parameters in the trail file.

Before creating a replicat make sure to check off the below checklist
1. Create a database connection
2. Add Trandata
3. add checkpoint table
4. add Heartbeat table
( I will discuss these perquisites in future blog )

CREATE REPLICAT

# Adding an Integrated Replicat
> ADD REPLICAT reptarget , INTEGRATED, EXTTRAIL RTARGET/ra

#Adding Parallel Integrated Replicat
>ADD REPLICAT reptarget , PARALLEL, INTEGRATED, EXTTRAIL RTARGET/ra

#Adding Parallel Non Integrated Replicat
> ADD REPLICAT reptarget , PARALLEL, EXTTRAIL RTARGET/ra

EXTTRAIL RTARGET/ra , is the directory in your $Deploy_Home/var/lib/data folder. The remote trail files are created in ordered sequence like ra000000001 , ra000000002 and so on.

Once created modify the replicat parameter file and add common parameters as below.

#Parameter file of a Parallel Non Integrated Replicat
>edit params reptarget
replicat reptarget
USERIDALIAS ggadmin DOMAIN OracleGoldenGate

DISCARDROLLOVER at 00:00
DISCARDFILE reptarget.dsc, APPEND, megabytes 500
REPERROR (2291, ABEND)
REPERROR (DEFAULT, DISCARD)
--REPERROR (DEFAULT, ABEND)
MAP_PARALLELISM 4
APPLY_PARALLELISM 4

-- Tables
HANDLECOLLISIONS
MAP SCOTT.table1, TARGET EMP.table1;
NOHANDLECOLLISIONS
MAP SCOTT.table2, TARGET EMP.table2;

PARAMETERS

DISCARDROLLOVER at 00:00 , Discard file reports all sqls which were rejected by goldengate for any operational error. It could be a missing row or a unique key constraint or a column mismatch. This parameter rotates the discard file at 12 am midnight everyday to prevent one file from growing aggressively

DISCARDFILE reptarget.dsc, APPEND, megabytes 500 . Sets the name of discard file to reptarget.dsc . Its default location is $Deploy_Home/var/lib/report . All the errors are appended and file is archived after szie limit of 500Mb.

REPERROR . Reperror parameter controls how a replicat should respond to various error messages . To stop the goldengate replication on catching a foreignkey constraint error use REPERROR (2291, ABEND) . To stop replication for any error use REPERROR (DEFAULT, ABEND) . Continue replication even with errors use REPERROR (DEFAULT, DISCARD) . The order of various REPERROR syntax varies , in our parameter file for foreign key errors the replicat abends and for rest it discards.

MAP_PARALLELISM . This parameter controls the number of mapper threads. These threads reads the trail files in parallel, parse the data , map source and target tables and calculate dependencies. Its default value is 2. Increase its value if replicat is lagging in reading the remote trail files.

APPLY_PARALLELISM . This parameter controls number of applier threads. Its default value is 4. These threads connect to target database and executes the SQL statement batches generated by Mappers.

HANDLECOLLISIONS | NOHANDLECOLLISIONS will be discussed in our next blog in detail . Happy reading !!!

Ref:
https://docs.oracle.com/goldengate/c1230/gg-winux/GWURF/reperror.htm
https://docs.oracle.com/en/database/goldengate/core/26/index.html
https://www.dbasolved.com/2015/01/oracle-goldengate-processes-part-4-replicat/
https://www.dbasolved.com/2017/11/build-a-parallel-replicat-from-adminclient/

Leave a Reply