Enabling CDC Supplemental Logging
With the CDC Extract, the method of capturing change data is via SQL Server Change Data Capture tables, so it is imperative that you follow the procedures and requirements below, so that change data is correctly logged, maintained, and captured by Extract.
You will enable supplemental logging with the ADD TRANDATA
command so that Extract can capture the information that is required to reconstruct transactions.
ADD TRANDATA
must be issued for all tables that are to be captured by Oracle GoldenGate, and to do so requires that a valid schema be used in order to create the necessary Oracle GoldenGate tables and stored procedures.
Enabling supplemental logging for a CDC Extract does the following:
-
Enables SQL Server Change Data Capture at the database level, if it’s not already enabled.
-
EXECUTE sys.sp_cdc_enable_db
-
-
Creates a Change Data Capture staging table for each base table enabled with supplemental logging by running
EXECUTE sys.sp_cdc_enable_table
, and creates a trigger for each CDC table. The CDC table exists as part of the system tables within the database and has a naming convention like,cdc.OracleGG_basetableobjectid_CT
. -
Creates a tracking table of naming convention
schema.OracleGGTranTables
. This table is used to store transaction indicators for the CDC tables, and is populated when the trigger for a CDC table is fired. The table will be owned by the schema listed in theGLOBALS
file’s,GGSCHEMA
parameter. -
Creates a unique fetch stored procedure for each CDC table, as well as several other stored procedures that are required for Extract to function. These stored procedures will be owned by the schema listed in the
GLOBALS
file’s,GGSCHEMA
parameter. -
Also, as part of enabling CDC for tables, SQL Server creates two jobs per database:
cdc.dbname_capture
cdc.dbname_cleanup
-
The CDC Capture job is the job that reads the SQL Server transaction log and populates the data into the CDC tables, and it is from those CDC tables that the Extract will capture the transactions. So it is of extreme importance that the CDC capture job be running at all times. This too requires that SQL Server Agent be set to run at all times and enabled to run automatically when SQL Server starts.
-
Important tuning information of the CDC Capture job can be found in CDC Capture Method Operational Considerations.
-
The CDC Cleanup job that is created by Microsoft does not have any dependencies on whether the Oracle GoldenGate Extract has captured data in the CDC tables or not. Therefore, extra steps need to be followed in order to disable or delete the CDC cleanup job immediately after
TRANDATA
is enabled, and to enable Oracle GoldenGate's own CDC cleanup job. See Retaining the CDC Table History Data for more information.
The following steps require a database user who is a member of the SQL Server System Administrators (sysadmin
) role.