Working with the EXTRACT and REPLICAT utilities of Oracle GoldenGate
The Oracle GoldenGate utilities EXTRACT
and REPLICAT
work together to keep the
source and target databases in sync via incremental transaction replication using trail
files. All changes that occur on the source database are automatically detected by
EXTRACT
, then formatted and transferred to trail files on the Oracle GoldenGate
on-premises or Amazon EC2 instance hub. After initial load is completed, the data is read from
these files and replicated to the target database by the REPLICAT
utility.
Running the Oracle GoldenGate EXTRACT utility
The EXTRACT
utility retrieves, converts, and outputs data from the source
database to trail files. The basic process is as follows:
-
EXTRACT
queues transaction details to memory or to temporary disk storage. -
The source database commits the transaction.
-
EXTRACT
writes the transaction details to a trail file. -
The trail file routes these details to the Oracle GoldenGate on-premises or the Amazon EC2 instance hub and then to the target database.
The following steps start the EXTRACT
utility, capture the data from
EXAMPLE.TABLE
in source database OGGSOURCE
, and create the
trail files.
To run the EXTRACT utility
-
Configure the
EXTRACT
parameter file on the Oracle GoldenGate hub (on-premises or Amazon EC2 instance). The following listing shows an exampleEXTRACT
parameter file named$GGHOME/dirprm/eabc.prm
.EXTRACT EABC USERID oggadm1@OGGSOURCE, PASSWORD "
my-password
" EXTTRAIL/path/to/goldengate/dirdat/ab
IGNOREREPLICATES GETAPPLOPS TRANLOGOPTIONS EXCLUDEUSER OGGADM1 TABLE EXAMPLE.TABLE; -
On the Oracle GoldenGate hub, log in to the source database and launch the Oracle GoldenGate command line interface
ggsci
. The following example shows the format for logging in.dblogin oggadm1@OGGSOURCE
-
Add transaction data to turn on supplemental logging for the database table.
add trandata EXAMPLE.TABLE
-
Using the
ggsci
command line, enable theEXTRACT
utility using the following commands.add extract EABC tranlog, INTEGRATED tranlog, begin now add exttrail
/path/to/goldengate/dirdat/ab
extract EABC, MEGABYTES 100 -
Register the
EXTRACT
utility with the database so that the archive logs are not deleted. This task allows you to recover old, uncommitted transactions if necessary. To register theEXTRACT
utility with the database, use the following command.register EXTRACT EABC, DATABASE
-
Start the
EXTRACT
utility with the following command.start EABC
Running the Oracle GoldenGate REPLICAT utility
The REPLICAT
utility "pushes" transaction information in the trail files to the
target database.
The following steps enable and start the REPLICAT
utility so that it can
replicate the captured data to the table EXAMPLE.TABLE
in target database
OGGTARGET
.
To run the REPLICATE utility
-
Configure the
REPLICAT
parameter file on the Oracle GoldenGate hub (on-premises or EC2 instance). The following listing shows an exampleREPLICAT
parameter file named$GGHOME/dirprm/rabc.prm
.REPLICAT RABC USERID oggadm1@OGGTARGET, password "
my-password
" ASSUMETARGETDEFS MAP EXAMPLE.TABLE, TARGET EXAMPLE.TABLE;Note
Specify a password other than the prompt shown here as a security best practice.
-
Log in to the target database and launch the Oracle GoldenGate command line interface (
ggsci
). The following example shows the format for logging in.dblogin userid oggadm1@OGGTARGET
-
Using the
ggsci
command line, add a checkpoint table. The user indicated should be the Oracle GoldenGate user account, not the target table schema owner. The following example creates a checkpoint table namedgg_checkpoint
.add checkpointtable oggadm1.oggchkpt
-
To enable the
REPLICAT
utility, use the following command.add replicat RABC EXTTRAIL
/path/to/goldengate/dirdat/ab
CHECKPOINTTABLE oggadm1.oggchkpt -
Start the
REPLICAT
utility by using the following command.start RABC