26 Preparing the System for Oracle GoldenGate
This chapter contains the following sections:
- Database Configuration
- Database User for Oracle GoldenGate Processes
- Preparing Tables for Processing
- Preparing the Transaction Logs
Parent topic: Using Oracle GoldenGate with Sybase
Database Configuration
The Extract process makes calls directly to the Sybase Replication API on a source Sybase server. The source database on this server must be configured as follows to support data capture by Oracle GoldenGate.
-
Because Extract uses the Sybase LTM to read the Sybase transaction log, it cannot run against a database configured with Sybase Replication Server. Only one process at a time can reserve a context that allows it to read the transaction log on the same database.
-
Sybase Multisite availability leverages the Sybase Replication Server to replicate transactions to a Warm Standby and a target subscription database. Oracle GoldenGate for Sybase cannot capture from the primary Warm Standby but can capture from the Multisite availability target subscription database because SAP Sybase Rep Server is not in control of the Transaction Log for that database.
-
Set the
DSQUERY
variable to the server that contains the database that Oracle GoldenGate will be using. -
The Extract process must be permitted to manage the secondary log truncation point. For more information, see Initializing the Secondary Truncation Point.
-
Configure the database page size to 4k, 8k,16k, 32k, or larger. To use the
UPGRADECHECKPOINT table_name
command to updated the checkpoint the target Sybase database, it must be configured to have a row size of more than 2K pages to be programmatically created; it will fail to upgrade the checkpoint if the target database is configured to be a 2K page size. This is valid only for Replicat.
Parent topic: Preparing the System for Oracle GoldenGate
Database User for Oracle GoldenGate Processes
Oracle GoldenGate requires a database user account. Create this account and assign privileges according to the following guidelines.
-
To preserve the security of your data, and to monitor Oracle GoldenGate processing accurately, do not permit other users, applications, or processes to log on, or operate as, the Oracle GoldenGate database user.
-
Create a database user that is dedicated to Oracle GoldenGate. It can be the same user for all of the Oracle GoldenGate processes that must connect to a database:
-
Extract (source database)
-
Replicat (target database)
-
DEFGEN
utility (source or target database)
-
-
The Extract process requires permission to access the source database. Do one of the following:
-
Grant System Administrator privileges.
-
Assign a user name with
replication_role
. The command to grant replication role is either:sp_role 'grant', replication_role,
Extract_user
Or
use dbname grant role replication_role to
Extract_user
Note:
Specific DDL or DML operations may require the use of both
sa_role
andreplication_role
. -
-
The Replicat process requires connect and DML privileges on the target database.
Parent topic: Preparing the System for Oracle GoldenGate
Preparing Tables for Processing
The following table attributes must be addressed in an Oracle GoldenGate environment.
Topics:
- Disabling Triggers and Cascade Constraints
- Assigning Row Identifiers
- Limiting Row Changes in Tables that do not Have a Key
- Replicating Encrypted Data
Parent topic: Preparing the System for Oracle GoldenGate
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:
Parent topic: Preparing Tables for Processing
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.
Parent topic: Preparing Tables for Processing
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.
Parent topic: Preparing Tables for Processing
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);
Parent topic: Preparing Tables for Processing
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:
Topics:
- Initializing the Secondary Truncation Point
- Sizing and Retaining the Logs
- Enabling Transaction Logging
Parent topic: Preparing the System for Oracle GoldenGate
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.
Parent topic: Preparing the Transaction Logs
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 .
If data that Extract needs during processing is not retained, either in online or backup logs, one of the following corrective actions might be required:
-
You might need to alter Extract to capture from a later point in time for which log data is available (and accept possible data loss on the target).
-
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.
Parent topic: Preparing the Transaction Logs
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:
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.
Parent topic: Preparing the Transaction Logs