13 Using the Java User Exit

This chapter describes how to start and restart the Oracle GoldenGate Adapter user exit that delivers messages. It assumes that the primary Extract has already generated a trail to be consume the user exit Replicat.

This chapter includes the following sections:

13.1 Starting the Application

Oracle GoldenGate release 12.2 introduced metadata in trail, which can be used by either the Extract or the Replicat process as the metadata definitions. Metadata in trail makes the separate source definitions file unnecessary as in previous releases. For the examples that follow, a simple TCUSTMER and TCUSTORD trail is used (matching the demo SQL provided with the Oracle GoldenGate software download), along with a source definitions file defining the data types used in the trail.

Note:

Replicat user exit must have access to the source definitions in order to run. Source metadata must be provided either from a static source definitions file or by using the metadata in trail feature where the metadata can be obtained from the trail. However, the Extract process does require metadata describing the trail data. Either the Extract must login to a database for metadata, or a source definitions file can be provided. In either case, the Extract cannot be in PASSTHRU mode when using a user exit.

To run the user exit, simply start the Replicat process from GGSCI:

GGSCI> START REPLICAT javaue
GGSCI> INFO REPLICAT javaue

The INFO command returnS information similar to the following:

REPLICAT JAVAUE Last Started 2011-08-25 18:41 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File ./dirdat/bb000000
2011-09-24 12:52:58.000000 RBA 2702

If the Replicat process is running and the file handler is being used (as in the example above), then you should see the output file output.xml in the Oracle GoldenGate installation directory (the same directory as the Replicat executable).

If the process does not start or abends, see Checking for Errors.

13.2 Restarting the Application at the Beginning of a Trail

There are two checkpoints for an Replicat running the user exit: the user exit checkpoint and the Replicat checkpoint. Before rerunning the Replicat, you must reset both checkpoints:

  1. Delete the user exit checkpoint file.

    In this example, the name of the Replicat group is javaue, so this will default to the checkpoint prefix.

    Windows: cmd>d el JAVAUE.cpj

    UNIX: $ rm JAVAUE.cpj

    Note:

    Do not modify checkpoints or delete the user exit checkpoint file on a production system.

  2. Reset the Replicat to the beginning of the trail data:
    GGSCI> ALTER REPLICAT JAVAUE, EXTSEQNO 0, EXTRBA 0
    
  3. Restart the Replicat:
    GGSCI> START JAVAUE
    GGSCI> INFO JAVAUE
    REPLICAT    JAVAUE    Last Started 2011-08-25 18:41   Status RUNNING
    Checkpoint Lag       00:00:00 (updated 00:00:00 ago)
    Log Read Checkpoint  File ./dirdat/ps000000
                         2011-09-24 12:52:58.000000  RBA 2702
    

    It may take a few seconds for the Replicat process status to report itself as running. Check the report file to see if it abended or is still in the process of starting:

    GGSCI> VIEW REPORT JAVAUE