Preparing Tables for Processing
The following table attributes must be addressed in an Oracle GoldenGate environment.
Disabling Triggers and Cascade Constraints
Disable triggers, cascade delete constraints, and cascade update constraints on target Sybase tables, or alter them to ignore changes made by the Oracle GoldenGate database user. Oracle GoldenGate replicates DML that results from a trigger or cascade constraint. If the same trigger or constraint gets activated on the target table, it becomes redundant because of the replicated version, and the database returns an error. Consider the following example, where the source tables are emp_src
and salary_src
and the target tables are emp_targ
and salary_targ
.
-
A delete is issued for
emp_src
. -
It cascades a delete to
salary_src
. -
Oracle GoldenGate sends both deletes to the target.
-
The parent delete arrives first and is applied to
emp_targ
. -
The parent delete cascades a delete to
salary_targ
. -
The cascaded delete from
salary_src
is applied tosalary_targ
. -
The row cannot be located because it was already deleted in step 5.
To configure Replicat to disable target triggers at the start of its database session, take the following steps:
Assigning Row Identifiers
Oracle GoldenGate requires some form of unique row identifier on source and target tables to locate the correct target rows for replicated updates and deletes.
Limiting Row Changes in Tables that do not Have a Key
If a target table has no primary key or unique key, duplicate rows can exist. It is possible for Oracle GoldenGate to update or delete too many rows in the target table, causing the source and target data to go out of synchronization without error messages to alert you. To limit the number of rows that are updated, use the DBOPTIONS
parameter with the LIMITROWS
option in the Replicat parameter file. LIMITROWS
can increase the performance of Oracle GoldenGate on the target system because only one row is processed.
Replicating Encrypted Data
Oracle GoldenGate supports columns that are encrypted with a system-encrypted password, but not columns that are encrypted with a user-defined password. Check the tables from which you want to capture data against the following Oracle GoldenGate limitations:
-
The table that contains the encrypted columns must have a primary or unique key.
-
Columns that use encryption cannot be part of the primary key.
Encrypted columns are encrypted in the data files and in the log, so Extract must be configured to fetch the clear-text values from the database. To trigger this fetch, use the FETCHCOLS
and FETCHMODCOLS[EXCEPT]
options of the Extract TABLE
parameter. FETCHCOLS
forces a fetch of values that are not in the log, and FETCHMODCOLS
or FETCHMODCOLS[EXCEPT]
forces a fetch of values that are in the logs. Used together, these parameters ensure that the encrypted columns are always fetched from the database.
The following is an example of how to configure Extract to support the encryption. In this example, the encrypted column is cardnum
.
TABLE ab.payments, FETCHCOLS (cardnum), FETCHMODCOLS (cardnum);
Preparing the Transaction Logs
To capture DML operations, Oracle GoldenGate reads the online logs. To ensure the continuity and integrity of Oracle GoldenGate processing, the logs must be configured as directed in the following sections:
Initializing the Secondary Truncation Point
Establish a secondary log truncation point on the source system prior to running the Oracle GoldenGate Extract process. Extract uses the secondary truncation point to identify data that remains to be processed.
To initialize the secondary truncation point, log on to the database as a user with sa_role
privileges and then issue the following command:
dbcc settrunc( 'ltm', valid )
By default, Extract will manage the secondary truncation point once it is established. Do not permit Extract to be stopped any longer than necessary; otherwise the log could eventually fill up and the database will halt. The only way to resolve this problem is to disable the secondary truncation point and manage it outside of Oracle GoldenGate, and then purge the transaction log. Data not yet processed by Extract will be lost, and you will have to resynchronize the source and target data.
To control how the secondary truncation point is managed, use the TRANLOGOPTIONS
parameter. For more information, see Reference for Oracle GoldenGate for Windows and UNIX.
Sizing and Retaining the Logs
Retain enough log data on the source system so that Extract can start
again from its checkpoints after you stop it or there is an unplanned outage.
Extract must have access to the log that contains the start of the oldest
uncommitted unit of work, and all logs thereafter. To determine where the Extract
checkpoints are, use the INFO EXTRACT
command. For more information
about INFO EXTRACT
, see Reference for Oracle GoldenGate for Windows and UNIX .
-
You might need to alter the Extract to capture from a later point in time for which log data is available (and accept possible data loss on the target). This can be achieved using the
ALTER EXTRACT
command. - You might need to resynchronize the source and target tables, and then start the Oracle GoldenGate environment over again.
Make certain not to use backup or archive options that cause old archive files to be overwritten by new backups on the source system. New backups should be separate files with different names from older ones. This ensures that if Extract looks for a particular log, it will still exist, and it also ensures that the data is available in case it is needed for a support case.
Enabling Transaction Logging
Use the ADD TRANDATA
command to mark each source table for replication. This command uses the Sybase sp_setreptable
and sp_setrepcol
system procedures. ADD TRANDATA
is the recommended way to mark the tables, instead of using those procedures through the database interface, but the owner or the system administrator can use them if needed. For more information, see the Sybase documentation.
To mark tables for replication with ADD TRANDATA:
Run the ADD TRANDATA
command for each table to be marked. The syntax
of the ADD TRANDATA
command is:
ADD TRANDATA SCHEMA.TABLE LOBSNEVER | LOBSALWAYS | LOBSALWAYSNOINDEX |
LOBSIFCHANGED
LOBSNEVER | LOBSALWAYS | LOBSALWAYSNOINDEX | LOBSIFCHANGED
control
whether LOB data is never propagated, only propagated if changed (the default), or
always propagated. The LOBSIFCHANGED
is the default value if no LOB
option is specified. The ADD TRANDATA
command will overwrite the
LOB replication setting that is currently set for the table.
Note:
Some ADD TRANDATA
options enable the
ALWAYS_REPLICATE
option of
sp_setrepcol
. If a LOB
column contains
a NULL
value, and then another column in the table gets
updated (but not the LOB
), that LOB
will
not be captured even though ALWAYS_REPLICATE
is
enabled.