One or more database tables can be journaled to each environment, and multiple journal environments can exist at the same time on an individual IBM i machines.
You must create or specify existing journals for:
All replication source tables
Source tables are journaled to provide the records of the data changes that Connect CDC captures for distribution to the target.
All replication and copy target tables
Target tables are journaled to provide transaction control for committing or rolling back a series of changes.
The tables must be journaled with before-images as well as after-images. In addition to providing control for committing or rolling back, before-images are required to detect distribution key changes and for data enhancement as well as for collision reporting in protected replication.
To create a journal, you must first define or have available one or more journal receivers and a journal message queue. The table below describes first the IBM i commands to create a receiver and a message queue, followed by the command to create a journal definition and to assign a table to the journal. The descriptions include usage comments and related commands.DB2/400 databases support logging of database transactions within a journal environment. The environment includes a journal definition (*JRN object), one or more journal receivers (*JRNRCV object), and a journal message queue (*MSGQ object).
Command |
Comment |
---|---|
CRTJRNRCV |
Creates a journal receiver (*JRNRCV object), the first of a series (chain) of physical storage containers for the journal. You must create a receiver before you create the journal definition object. The receiver and journal may belong to different libraries. Related commands:
|
CRTMSGQ |
Creates a journal message queue (*MSGQ object), a persistent queue attached to the journal for receiving messages about the state of receivers. You must create a message queue before you create the journal definition object. It is not recommended to use the system message queue QSYSOPR for Connect CDC distribution. Its typical heavy usage makes it subject to operator maintenance that risks loss of data. Related command: DLTMSGQ–Deletes a journal message queue. |
CRTJRN |
Creates a journal definition (*JRN object), which contains management information for the journal environment and associates the receiver(s) and message queue with the journal. It is recommended that you set the command option Manage receivers (MNGRCV) to *SYSTEM and set Delete receivers (DLTRCV) to *NO. If this journal is for tables on a target-only Db2 for i server, journals are necessary for commitment control only, and Connect CDC change management is not available. You may want to specify *SYSTEM for Manage receivers and *YES for Delete receivers. Changes to user data are recorded as entries in the journal receiver, each of which is identified by a sequence number. You can display the entries in the journal receiver by issuing the DSPJRN command. Related commands:
|
STRJRNPF |
Starts journaling for a table (physical file) that is not currently being journaled. Specify *BOTH for the Journal images option; this journals both before-images and after-images of the changed data. *BOTH is not the default. Do not assign a table to the QAUDJRN journal (the system audit journal) in the QSYS library or to the Connect CDC metabase journal, if it exists. Related command: ENDJRNPF–Ends journaling on a physical file. |