Professional Documents
Culture Documents
Executive Overview.............................................................................. 1
Introduction.......................................................................................... 1
Prerequisites........................................................................................ 4
Hardware.......................................................................................... 4
Intermediary Server.......................................................................... 4
Install and Configure Oracle GoldenGate Software......................... 4
Setup the Database User................................................................. 4
Teradata Database.......................................................................... 5
Configure ODBC.............................................................................. 6
Database Activity............................................................................. 6
Oracle GoldenGate Manager Process................................................. 9
Max Protection Capture..................................................................... 11
TAM Configuration......................................................................... 11
Change Data Capture.................................................................... 13
Configure VAM Sort Extract........................................................... 16
Configure Extract Data Pump........................................................ 16
Configure Replicat.............................................................................. 19
Teradata to Teradata Configuration............................................... 19
Other Databases to Teradata Configuration.................................. 19
Turbo Apply for Teradata............................................................... 20
Using KEYCOLS in Replicat.......................................................... 21
Oracle GoldenGate Macros............................................................... 22
DDL Replication................................................................................. 24
Enable DDL Capture in Teradata................................................... 24
Enable DDL Capture in VAM Extract............................................. 25
Enable DDL Passthru in Sort Extract............................................. 25
Enable DDL Passthru in Data Pump.............................................. 25
Enable DDL Apply in Replicat........................................................ 25
Maintenance Tasks........................................................................ 25
Oracle GoldenGate for Teradata
Staging Tables................................................................................... 27
Teradata to Teradata..................................................................... 27
Other Databases to Teradata........................................................ 29
Staging Table Processing With Oracle GoldenGate...................... 30
Synchronizing Data............................................................................ 31
Maintenance....................................................................................... 32
Delete Oracle GoldenGate Extract................................................ 32
Add a Table to an Existing Extract................................................. 32
Move a Table to a New Extract...................................................... 32
Modify Table Columns................................................................... 33
Things to Know.................................................................................. 34
In Doubt Transactions.................................................................... 34
Character Sets and Replication..................................................... 34
Avoiding ODBC Login Timeouts.................................................... 34
Teradata ODBC Driver Limitations................................................ 35
Improving Oracle GoldenGate Throughput with @RANGE........... 35
Primary Indexes vs. Primary Keys ................................................ 35
Executing Stored Procedures from Oracle GoldenGate................ 37
Teradata Queries You Need To Know........................................... 38
References......................................................................................... 40
Oracle GoldenGate for Teradata
Executive Overview
This paper presents configuration considerations for implementing Oracle GoldenGate version 12c
into an environment running the Teradata database.
Oracle GoldenGate supports data capture for the Teradata Database up to version 14.10. As of
Teradata Database version 15.00, Oracle GoldenGate only supports delivery delivery.
Introduction
Oracle GoldenGate for Teradata allows users to capture changes made to a specific set of tables in
one database and deliver those changes to corresponding tables in another database in near real
time. Replication can serve several purposes in database information management:
• Replication can provide a backup of specified table data in the event of problems with the
primary database.
• If the site is dual active, and one system becomes unavailable, the remaining system can
automatically take over database operations. The data on the systems will have been
automatically synchronized via replication.
• When implemented between Teradata and databases from other vendors, data can be
migrated from one system to the other, making data accessible across the different
environments.
• A source database
• A target database
• A source and target server running Oracle GoldenGate for Teradata. Oracle GoldenGate
for Teradata provides transport for data captured from Teradata Database and applies it to
the target database.
• The ODBC driver for Teradata installed on the both Oracle GoldenGate servers; this
supports data transfer between the Oracle GoldenGate software and the database systems.
• Teradata Access Module installed on the source Oracle GoldenGate server; this supports
data transfer between a Teradata Database and Oracle GoldenGate.
1
Oracle GoldenGate for Teradata
In our simplified view, the major components associated with Teradata data replication are:
2
Oracle GoldenGate for Teradata
3
Prerequisites
Before implementing Oracle GoldenGate Extract and Replicat, several modifications must be made
to the server environment. In this section we shall discuss these prerequisites.
Hardware
Although not required, it is best to install the Oracle GoldenGate application on a multi-node cluster
server. Doing so will minimize the impact of a Oracle GoldenGate outage due to a server failure.
Two intermediary servers will be required; one for change data capture and one for change data
apply, connected via TCP/IP.
The Oracle GoldenGate application does have specific hardware requirements; however, the
minimum configuration recommended is:
Intermediary Server
The intermediary server, where Oracle GoldenGate is to be installed, may run any supported
version of the Linux or Windows Operating System.
If the intermediary server uses the Windows operating system, tune the Windows Desktop Heap to
allow more than 50 Oracle GoldenGate groups to run simultaneously by changing the following
operating system values:
Teradata Database
1. Create the RSG Spill File Directory
a. This directory is used by the RSG to store transaction data if a large transaction occurs,
or Oracle GoldenGate Extract does not receive change data as quickly as it is
generated.
2. Define RSG vprocs
a. The process of capturing change data relies on RSG vprocs. RSGs must be added to
every Teradata node.
DBSControl Settings
There are four DBSControl Utility Fields whose settings affect Replication. These fields are:
For more information on these database requirements refer to the Teradata Replication Solutions
Overview in the Teradata Database Documentation.
Configure ODBC
Oracle GoldenGate utilizes ODBC to communicate with the Teradata server. Setup an ODBC Data
Source for the Teradata server, specifying:
For Oracle GoldenGate running on a Linux server, in the Oracle GoldenGate user’s .cshrc file
include an environment variable to define the location of the odbc.ini file:
For more information about ODBC configuration for Oracle GoldenGate, refer to the Oracle
GoldenGate Administration Manual or the ODBC Driver for Teradata User Guide.
Database Activity
To properly configure the Oracle GoldenGate application for maximum performance, gather the size
and activity rates for all tables being considered for data replication. Business rules must be
established that specify the acceptable delay, or lag, for data to be captured from the source database
and applied to the target database. These rules are needed to determine the number of Oracle
GoldenGate Extract and Replicat processes.
Teradata
Extract
T
A
Node 1 M Extract for Teradata
Replication Group
RGOLDEN,
Node 2 containing tables
used by Sales, HR,
and Payroll
applications.
Node n
Teradata
Extract
T Extract for Teradata Replication Group
A RSALES, containing tables used by Sales
Node 1 application
M
Node 2
Extract
T Extract for Teradata Replication Group RHR,
A containing tables used by HR application
M
Node n
Extract
T Extract for Teradata Replication Group
A RPAYROLL, containing tables used by
Payroll application
M
1. If there are multiple applications, each with a unique set of tables, it is appropriate to isolate
each set of tables in a separate replication group.
6. Bulk SQL refers to SQL DML statements, such as MERGE or INSERT SELECT, that are
often used for data loading, as well as deletes and UPDATE WHERE statements. These
statements may generate large amounts of change data. Since SQL statements are always
contained within a single transaction, all the change data for the statement will be directed
to a single, randomly selected RSG. The Memory limit per transaction field prevents such
large transactions from monopolizing RSG memory resources to the detriment of other
kinds of transactions.
Since bulk SQL transactions normally use spill files, it is important to ensure that there is adequate
disk space on each node. Note that the default spill file directory is system disk that is used for other
important files.
Oracle GoldenGate Manager Process
Manager is the Oracle GoldenGate parent process and is responsible for the management of Oracle
GoldenGate processes, resources, user interface, and the reporting of thresholds and errors.
PORT
The default Manager listener port is 7809. Because this is a well documented and publicized port
number, it may not be the best setting in a customer environment; especially if the server is on a non-
secure network. The customer’s network administrator should assign Oracle GoldenGate Manager a
non-default port number.
DYNAMICPORTLIST
When Manager receives a connect request from Capture, Apply, or GGSCI; the default functionality
is to utilize any available free port for data exchange. In a production environment this may not be
desired functionality; therefore, the customer’s network administrator should assign a series, or
range of ports for exclusive use by Oracle GoldenGate processes.
1. A series of ports
a. DYNAMICPORTLIST 15301, 15302, 15303, 15380, 15420
2. A range of ports
a. DYNAMICPORTLIST 12010-12250
3. A range of ports plus individual ports
a. DYNAMICPORTLIST 12010-12020, 15420, 15303
PURGEOLDEXTRACTS
Use PURGEOLDEXTRACTS in the Manager parameter file to purge trail files when oldenGate has
finished processing them. As a Manager parameter, PURGEOLDEXTRACTS provides trail
management in a centralized fashion and takes into account multiple processes.
1. Specify USECHECKPOINTS to purge when all processes are finished with a file as indicated
by checkpoints. Basing the purge on checkpoints ensures that no file is deleted until all
processes are finished with it. USECHECKPOINTS considers the checkpoints of both Extract
and Replicat before purging.
2. Use the MINKEEP rules to set a minimum amount of time to keep an unmodified file:
a. Use MINKEEPHOURS or MINKEEPDAYS to keep a file for <n> hours or days.
b. Use MINKEEPFILES to keep at least <n> files including the active file. The default is
1.
3. Use only one of the MINKEEP options. If more than one is used, Oracle GoldenGate selects
one of them based on the following:
a. If both MINKEEPHOURS and MINKEEPDAYS are specified, only the last one is
accepted, and the other will be ignored.
b. If either MINKEEPHOURS or MINKEEPDAYS is used with MINKEEPFILES, then
MINKEEPHOURS or MINKEEPDAYS is accepted, and MINKEEPFILES is ignored.
Set MINKEEPDAYS on the source server to keep <n> number of local extract trails on disk to
facilitate disaster recovery of the source database. The number of days is determined by the
customer.
AUTOSTART
AUTOSTART is used to start Oracle GoldenGate Capture or Apply processes as soon as Manager’s
startup process completes.
LAGREPORT
LAGREPORT denotes the interval at which Manager checks Capture and Apply processes for lag.
This setting is customer dependent; however, a setting of “LAGREPORTHOURS 1” should be
sufficient in most environments.
LAGCRITICAL
LAGCRITICAL denotes the threshold at which lag becomes unacceptable. Manager writes a
message to the Oracle GoldenGate Error Log. This setting is customer dependent; however, the
recommended settings below will suffice for most installations:
Environment Setting
Disaster Recovery LAGCRITICALMINUTES 5
Decision Support LAGCRITICALMINUTES 5
Reporting LAGCRITICALHOURS 1
BOOTDELAYMINUTES specifies the amount of time Manager is to delay after the server has
booted. This delay is to allow other server components (RAID disks, database, network, etc) to
startup and become active before Manager begins processing
TAM Configuration
The Teradata Access Module, or TAM, must be obtained from Teradata and installed into the Oracle
GoldenGate object directory before Extract can be implemented. This module is linked into the
Oracle GoldenGate Extract program at startup time and provides Extract with links into the Teradata
database environment.
TAM requires a configuration file be present that provides specifics about the Teradata environment
and the Teradata Replication Group that will be used to facilitate Oracle GoldenGate Extract.
When Oracle GoldenGate Extract is started, the information provided will be used by TAM to
establish communication between the database and Extract. The tam.ini file will be updated with the
Teradata Replication Group Security Token. A maximum of 99 Teradata Replication Groups are
permitted.
Create Group Statement File
The Create Group Statement file may be created via any text editor, and should be saved with the
suffix “.sql”. It is recommended to store these files within the Oracle GoldenGate installation
directory, in a subdirectory named “dirtam”. Information required in this file is:
Table 3 shows an example of the create group statement file read by the tam.ini file presented in
Table 2.
When the Replication Group is created, Teradata assigns the group to an available RSG. The
assignments are made “round-robin” among the configured RSG vprocs. Once the RSG connection
is made, all data for tables associated with the Replication Group will be processed through the
assigned RSG. There is no supported functionality to allow RSG reassignment or tuning within
Teradata.
Considerations
Maximum Protection mode offers the highest level of data protection for replication. Transactions
are not committed on the Teradata Database server until Oracle GoldenGate has acknowledged
receipt of all data for the transaction.
Under this mode of operation, if Oracle GoldenGate Extract disconnects from the database,
processing of transactions continues; however, they are not committed back to the client application.
If Oracle GoldenGate does not reestablish connectivity within the timeframe denoted by the
Teradata DBSControl field “Client Reset Timeout”; the database aborts all transactions not
acknowledged by Oracle GoldenGate.
Maximum Protection mode employs a two-phase commit protocol between the database server and
Oracle GoldenGate to ensure that no transactions are lost or sent more than once in the event of
failure of either of the Teradata servers, Oracle GoldenGate, or communication links.
VAM Extract Configuration
Parameters required to configure Extract for Max Protection are:
By default, when Extract encounters an end of file condition, it goes to sleep for 60 seconds. Since
Teradata RSG sends data to TAM in batches, Extract goes to sleep between RSG data batches. To
improve performance it is recommended that the parameter “EOFDELAY 0” be set in the VAM
Extract. Setting this parameter will prevent Extract from going to sleep when the TAM is queried for
data and there is nothing to retrieve (an EOF condition exists). The drawback of setting this
parameter is increased CPU utilization due to the increased calls to TAM during slow database
periods.
If CPU utilization rates are a concern, setting EOFDELAYCSECS (this specifies time in 1/100 th of a
second intervals) to a value greater than 0 and less than 100 will ensure Extract sleeps less than 60
seconds when an end of file condition is encountered. A setting of “EOFDELAYCSECS 10” will
cause Extract to delay one-tenth of a second before querying TAM for more data.
The TAM setting CopyThreadDataWaitSleep may be used to override this Extract option. The
recommended setting for CopyThreadDataWaitSleep from Teradata is 0.001 (one one-thousands of a
second).
In our sample Extract parameter file we can generate information related to the performance of
Extract and workload per table by setting the following options:
KEYCOLS Usage
In environments in which the source table has no defined keys or indices, listing tables with an
associated KEYCOLS clause of the VAM extract has been shown to improve both Extract and
Replicat performance, as well as reduce or eliminate concrete step errors in associated Replicats.
The columns specified in the KEYCOLS clause in the VAM Extract must be a real part of the
schema and table but do not need to be keys or indices or parts of such.
Configure VAM Sort Extract
VAM Sort Extracts are required when Oracle GoldenGate Extract is in Max Protection mode. The
Oracle GoldenGate Extract writes data in log-style format, which interleaves change records for
different transactions into the VAM Trail. This data must be sorted into correct change sequence
order before it can be applied to the target database.
Table 5 provides a sample configuration file for a VAM Sort Extract associated with a Teradata
Extract.
NOTE: Because of the performance impact, the VAM Sort Extract should write to a local
EXTTRAIL, and never be configured to transmit data over TCP/IP to the target Oracle GoldenGate
Server.
The data source option “SORTTRANLOG” is required and specifies that Extract will sort the
interleaved database transactions into correct prepare/commit/rollback transactional units.
Using KEYCOLS
KEYCOLS should not be specified for the VAM Sort Extract.
Table 6 provides a sample configuration file for a Data Pump associated with a Teradata Extract.
As with all Extract Data Pumps, the parameter “PASSTHRU” is required to move the data without
accessing the database or interpreting the incoming data. If table mapping, or data transformation is
performed in the Data Pump, ODBC connect information must be provided via the SOURCEDB
parameter.
RMTHOST Options
COMPRESS
COMPRESS should be set anytime data is being transmitted over TCP/P. Compressing outgoing
blocks of records to reduce bandwidth requirements. Oracle GoldenGate decompresses the data
before writing it to the trail.
COMPRESS typically results in compression ratios of at least 4:1 and sometimes better.
Encryption
Data transmitted via public networks should be encrypted. Transactions containing sensitive data
(credit card numbers, social security numbers, healthcare information, etc) must be encrypted before
transmission over unsecure networks.
TCPBUFSIZE
TCPBUFSIZE controls the size of the TCP socket buffer in bytes. By increasing the size of the
buffer larger packets can be sent to the target system. The actual size of the buffer depends on the
TCP stack implementation and the network. The default is 30,000 bytes, but modern network
configurations usually support higher values.
Valid values are from 1000 to 200000000 (two hundred million) bytes.
1. Use ping to determine the average round trip time to the target server.
a. PING has several options that may be specified:
i. “-n <count>”
1. The number of echo requests to send. Defaults to 4.
ii. “-l <size>”
1. The size of the ping packet. Defaults to 32 bytes.
b. If you know the average transaction size for data captured, use that value for the
ping; otherwise, use the default.
2. After obtaining the average round trip time, multiply that value by the network
bandwidth.
a. For example, ping returned 64 ms as the average round trip time, and the network
bandwidth is 100 Mb. Multiplying these two numbers will product a result of: .07
* 100 = 7 Mb (.065 rounded up)
3. Network bandwidth is in bits per second, so we need to convert the result from step 2
into bytes per second.
a. Divide the result in step 2 by 8: 7/8 = .875 megabytes per second.
4. TCPBUFSIZE should be set to 875000 in this instance.
On Unix/Linux systems using the ifconfig command to get the TCP Receive Space will also provide
the correct value for the TCPBUFSIZE. On the target system issue the following command:
ifconfig –a
Example output:
Example output:
The lower the send Wait time the better performance for the pump over the network.
The customer network administrator can also assist in determining an optimal value.
TCPFLUSHBYTES
TCPFLUSHBYTES controls the size of the buffer, in bytes, that collects data that is ready to be sent
across the network. When this value is reached, the data is flushed to the target.
Refer to the Oracle GoldenGate Reference Manual for more information on configuring Data
Pumps.
Configure Replicat
For Teradata implementations, Oracle GoldenGate Replicat differs slightly from other Oracle
GoldenGate installations in that ODBC is used to connect to the target database. All other Replicat
functionality remains the same.
If the target tables had different column names, columns of different data types, more columns than
the source, or fewer columns than the source, Oracle GoldenGate data transformation functionality
could be used to the source data to the appropriate target columns.
For more information on column mapping and data transformation functions, refer to the Oracle
GoldenGate Reference Guide.
Data transformation is performed via the parameter “SOURCEDEFS”. This parameter specifies a
file name that contains information about the source data; table name, column names, data types,
data length, offset, etc. Replicat uses this information to map and convert the incoming source data
to its Teradata target. The file specified in the SOURCEDEFS parameter is created via the Oracle
GoldenGate DEFGEN utility on the source system and is stored in the “dirdef” subdirectory of the
Teradata Oracle GoldenGate installation directory.
Table 8. Replicat Parameters – Oracle to Teradata
replicat rhremp
targetdb vm050_td13, userid lpenton, password lpenton
sourcedefs ./dirdef/oradefs.def
discardfile ./dirrpt/rhemp.dsc, append
maxtransops 500
batchsql batchtransops 500, bytesperqueue 1000000, opsperbatch 500
reportcount every 60 minutes, rate
statoptions resetreportstats
report at 00:01
reportrollover at 00:01
map personnel.emp, target hr.employee,
colmap (usedefaults,
employee_name = emp_name,
employee_number = emp_nbr
);
map personnel.emp_info, target hr.emp_info,
colmap (usedefaults,
employee_number = emp_nbr
address = emp_add,
apartment_no = emp_add2,
next_of_kin = emp_nok,
hire_date = date_of_hire;
);
map personnel.emp_dept, target hr.emp_dept,
colmap (usedefaults,
employee_number = emp_nbr
);
map personnel.emp_reviews, target hr.emp_reviews,
colmap (usedefaults,
employee_number = emp_nbr
);
For more information on column mapping, DEFGEN, and data transformation functions, refer to the
Oracle GoldenGate Reference Guide.
To specify Turbo Apply, add the following option to the Replicat parameter file:
By default Oracle GoldenGate Turbo Apply has a limit of 20Mbytes per write operation. Teradata
ODBC can only handle 1 Mb of data per operation; so Replicat must be set to not exceed the
limitations of Teradata ODBC. This is done by specifying the maximum number of batch operations
per batch (500) and maximum number of bytes per batch queue (1 million) when activating
BATCHSQL.
To prevent Replicat error 3714 “Concrete Step” warnings, the number of operations per batch is set
to 500, instead of the default 1200. This value maybe reduced as needed.
Using KEYCOLS in Replicat
If the Teradata table definition contains non-unique primary indexes, specifying KEYCOLS on the
NUPI column(s) plays a significant role in the reduction of "concrete step" errors in Replicat. The
overhead of the pseudo all-column key when there is no defined UPI takes enough memory to
overrun the Teradata ODBC with even the most conservative sized transaction group.
For example, a NUPI table has 155 columns and we specify KEYCOLS on 4 columns:
For update operations on the NUPI table we would be comparing 155 key columns. For every update
we'll loop through all of the columns to see if any column changed (to determine if it's a key update).
Ultimately, it will be. In this case, we must include all 155 columns for the before image, and those
same 155 columns in the after image for the primary key update record (310 columns in each key
update record).
By specifying the 4 KEYCOLS columns we only have 8 columns (4 * 2) plus the changed columns
in each update record.
The processing and I/O overhead can be significant just based on the number of columns being
processed.
1. To provide a single location for storing database DSN and user access information.
2. Share common configuration options across all VAM Extract, VAM Sort, and Replicat groups.
In this situation, a Macro Library is the best choice as the shared configuration options may be stored
externally to the Oracle GoldenGate parameter file. Macro Library text files should be stored in a
subdirectory to the Oracle GoldenGate installation named “dirmac”. Table 9 depicts a sample Macro
Library file.
--
-- MAX Protection VAM Extract
--
MACRO #max_protect
PARAMS (#tam, #tamini)
BEGIN
vam #tam PARAMS(inifile, #tamini, callbacklib, extract.exe)
dsoptions createtranlog, restartappend, vamcompatibility 1
wildcardresolve dynamic
END;
--
-- VAM Sort DSOPTIONS
--
MACRO #vam_sort
BEGIN
dsoptions sorttranlog
wildcardresolve dynamic
END;
--
-- Generate Statistics
--
MACRO #gen_stats
BEGIN
reportcount every 60 minutes, rate
statoptions resetreportstats
report at 00:01
reportrollover at 00:01
END;
In our sample macro library file, the password to establish a database connection has been encrypted.
Proper security protocol prohibits the storage of clear passwords within text files, so encrypting the
database access password for Oracle GoldenGate is required.
The GGSCI command “encrypt password” is used to accomplish this task. For more information on
password encryption refer to the Oracle GoldenGate Reference Manual.
Table 10 shows VAM Extract parameter file that utilizes Oracle GoldenGate Macros to share
In our sample parameter file, anything following “NOLIST” will not be written to the report file. In
this case, the contents of the Macro Library file ./dirmac/mac_lib.mac will be read by Extract at
startup; but not written to its report file. Use “LIST” to turn on report file display.
Three Macros are called that utilizes configurations options from the Library:
For detailed information on DDL replication, see the Oracle GoldenGate Administrator Guide.
A Teradata DDL statement can be replicated when it satisfies one of the following conditions:
The DDL statement affects a table that is a member of a replication group.
The DDL statement matches a user-defined replication rule.
The DDL statement changes certain properties of a replication group.
1. Only unidirectional configurations are supported and like to like configurations are supported.
2. All filtering, mapping, and transformation of data operations must be performed by a primary
Extract process or by Replicat. All of the tables that use DDL support must be configured for
PASSTHRU mode in the Data Pump parameter file.
3. Keep related DDL and DML together in the same process stream to ensure data integrity.
Configure the processes so that:
a. All DDL and DML for any given object are processed by the same Extract group and
by the same Replicat group.
b. All objects that are relational to an object are processed by the same group as the
parent object.
4. If an Extract group writes to multiple trails that are read by different Replicat groups, Extract
sends all of the DDL to all of the trails. Use each Replicat group to filter the DDL by using the
filter options of the DDL parameter.
6. On the target, DDL support is enabled by default, to maintain the integrity of transactional data
that is replicated. By default, Replicat will process all DDL operations that the trail contains.
Replicat may be configured to ignore or filter DDL operations by using parameter settings.
The command:
If multiple Replication Groups and VAM Captures exist, specify each table already associated with a
Replication Group in a corresponding Ruleset silimar to the following:
Note: There are a multitude of configuration options for the DDL parameter related to scope,
operation types, object types, object names, instruction strings, and instruction words; so be sure to
review the Oracle GoldenGate Administrators Guide to determine which setting is best for a
particular production implementation.
If data filtering or transformation is required for DML operations in the Data Pump, set PASSTHRU
for tables where DDL support is required then set NOPASSTHRU for tables where DML
transformation is required.
Maintenance Tasks
Database maintenance is less intrusive when DDL Replication is enabled as the Teradata Replication
Group may remain active when modifying existing table schema or adding new tables for
Replication. Below are some common tasks and steps to perform the maintenance item (the
assumption is that Oracle GoldenGate is configured for DDL Replication).
Note: If the VAM Extract table definition is not wildcarded, the new table must be added to the
Extract table list and the Extract stopped and restarted before the table will be recognized by Oracle
GoldenGate.
1. Create a new TAM.INI file that will be used by the VAM Extract.
2. Create the associated CreateGroupStmtFile.
a. Specify an empty Teradata Replication Group.
i. Create Replication Group <name>;
3. Create the Oracle GoldenGate components.
4. Start the VAM Extract.
5. Create the Teradata Replication Ruleset.
6. Create the Teradata tables.
Note: If an empty Teradata Replication Group is created for existing tables, no data will be captured
by the VAM Extract and no warning or error messages will be presented by Oracle GoldenGate.
Staging Tables
Often it is not practical to have Replicat apply data direct to the target Teradata tables. This may be
due to data transformation requirements not provided with the Oracle GoldenGate product, heavy
workloads, or other reasons. In these situations, utilizing Oracle GoldenGate to apply data to a
staging table that is processed via another mechanism may be the only alternative.
In most Teradata environments, these staging tables are processed at regular time intervals via an
Informatica job, Teradata Multiload job, or some other mechanism that loads the target table in a
batch mode. When the load is performed via Informatica, be aware that Informatica performs a table
lock on the staging table which will block Replicat and any other process attempting to gain access
to staging table data. By default, Replicat will recover from these table locks; however, other
applications or utilities (including Informatica) will not.
One of the main issues with processing staging tables is determining proper transaction sequencing
to ensure update and delete operations are processed in proper order. In this section we shall discuss
configuration guidelines for the staging table, Extract, and Replicat to ensure records maybe sorted
in correct transaction sequence by the batch load utility and identify options within Oracle
GoldenGate that maybe used to eliminate the need to use Informatica for batch job processing.
Teradata to Teradata
For Teradata, we must used a derived column GG_LOGPOSITION_LOGRBA that identifies the
Oracle GoldenGate Trail sequence number and relative byte address of the record within the trail for
the data row. For other databases, Extract can pass the record sequence number (RSN) of the
transaction in the source database as a token; however, this data does not exist in Teradata.
Extract Configuration
Extract must be configured to pass full data images for insert and delete operations. In the VAM
Extract parameter file this is accomplished by specifying:
1. NOCOMPRESSUPDATES
2. NOCOMPRESSDELETES
Replicat Configuration
In Replicat we must set options to insure all records are inserted into the staging table and then map
the additional data columns with proper data. Add the following to the Replicat parameter file:
1. INSERTALLRECORDS
a. Perform an insert of the record, no matter what the source operation.
2. In the table MAP statement, add the following column maps:
colmap ( usedefaults,
gg_logposition_logrba = @STRCAT (@STRNUM (@GETENV ("RECORD",
"FILESEQNO"), RIGHTZERO, 6), @STRNUM (@GETENV ("RECORD", "FILERBA"),
RIGHTZERO, 10)),
gg_commit_ts = @GETENV ("GGHEADER", "COMMITTIMESTAMP"),
gg_optype = @CASE(@GETENV ("GGHEADER", "OPTYPE"), "INSERT", "I",
"DELETE", "D", "U")
)
We get the source record commit timestamp from the Oracle GoldenGate Record Header. This
will be used to determine what records the batch load utility will process.
We get the source operation type from the header. If the operation was an insert, we write “I”
into the gg_optype column; if a delete, “D”. If neither of these, the operation was an update and
we write “U”.
Other Databases to Teradata
For Teradata, we must used a derived column GG_LOGPOSITION_LOGRBA that identifies the
Oracle GoldenGate Trail sequence number and relative byte address of the record within the trail for
the data row. For other databases, Extract can pass the record sequence number (RSN) of the
transaction in the source database as a token; however, this data does not exist in Teradata.
Extract Configuration
Extract must be configured to pass full data images for insert and delete operations. In the VAM
Extract parameter file this is accomplished by specifying:
NOCOMPRESSUPDATES
NOCOMPRESSDELETES
Additionally Extract must be configured to pass the transaction record sequence number from the
source database. This is accomplished by setting a token on the TABLE statement:
Replicat Configuration
In Replicat we must set options to insure all records are inserted into the staging table and then map
the additional data columns with proper data. Add the following to the Replicat parameter file:
1. INSERTALLRECORDS
a. Perform an insert of the record, no matter what the source operation.
2. In the table MAP statement, add the following column maps:
colmap ( usedefaults,
trans_rsn = @TOKEN ("trans_rsn"),
gg_commit_ts = @GETENV ("GGHEADER", "COMMITTIMESTAMP"),
gg_optype = @CASE(@GETENV ("GGHEADER", "OPTYPE"), "INSERT", "I",
"DELETE", "D", "U")
)
Note: Because of inefficiencies in calling Teradata Stored Procedures, this call should not be
performed too often (See section 11.7 for more information related to these ineffeciencies.)
Oracle GoldenGate Event Markers are initiated at the source. To setup Event Markers to trigger
batch processing of the staging tables:
1. Create an event marker table that contains one column, such as:
1. Add a table statement to the Replicat parameter file to perform the shell call anytime an event
marker is read from the Oracle GoldenGate Trail.
Refer to the Teradata Zero Downtime Migration Best Practices document for details on how to
perform target instantiation for ZDM installations.
Maintenance
When a table is setup for change data capture, the Teradata Replication Group must be inactive
before table maintenance tasks maybe performed. Below are some common tasks and steps that must
be taken to perform the maintenance item. (Note: DDL capture is supported in Teradata 13.)
In Doubt Transactions
In Maximum Protetction mode, if Oracle GoldenGate does not reconnect before the time period
expires, the system aborts all transactions not acknowledged by Oracle GoldenGate. This may
include some transactions actually sent to Oracle GoldenGate before the disconnection occurred.
The system records each such transaction as a row in the DBC.InDoubtResLog table. When Oracle
GoldenGate reconnects after the time out period, TAM reads the rows in DBC.InDoubtResLog to
find the
in-doubt transactions that were aborted by the server. TAM notifies Oracle GoldenGate to abort
those transactions.
If the database server resets before Oracle GoldenGate reconnects, any outstanding transactions
remain in the in-doubt state, and the timer is started again (regardless of whether Oracle GoldenGate
was connected at the time of the server reset). If the timer subsequently expires before Oracle
GoldenGate reconnects, the outstanding transactions are aborted. When Oracle GoldenGate
reconnects before the time period expires, then Oracle GoldenGate and Teradata coordinate to
determine which in-doubt transactions were received by Oracle GoldenGate; the received
transactions are then committed, while the remaining in-doubt transactions are rolled back .
Oracle GoldenGate supports replication of the following character sets between different system
types:
• LATIN
• UNICODE
Wherever UNICODE and KANJISJIS are used, the following limitations exist:
Make sure that the ODBC timeout parameter is set to a value higher than the default (20 seconds) in
order to avoid timeouts. The suggested setting for LoginTimeout is 3600.
Teradata ODBC Driver Limitations
The Teradata ODBC Driver has a limitation of 15 outstanding SQL statements. This affects Replicat
functionality. To address this limitation Oracle GoldenGate Replicat automatically adjusts the
maximum number of active SQL statements when using BATCHSQL so that the database limit of
15 is not exceeded.
Teradata ODBC can only handle 1 Mb of data per operation; so Replicat must be set to not exceed
the limitations of Teradata ODBC.
By default Oracle GoldenGate Turbo Apply performs 20Mbytes per write operation. This is done by
specifying the maximum number of operations per batch (500) and maximum number of bytes per
batch queue (1 million) when activating BATCHSQL:
This function may be used at the Data Pump or Replicat process; however, it is more efficient for
use in the Data Pump because calculating ranges on the target side requires Replicat to read through
its entire Oracle GoldenGate Trail to find the data that meets each range specification.
@RANGE cannot be used for Replicat in environments where primary key updates occur. The
PK Update will cause Replicat failures if the update value is not within the data range of the
Replicat process.
Rows in tables with relational constraints to one another must be grouped together into the same
process or trail to preserve referential integrity.
When specifying @RANGE at the Data Pump, the Oracle GoldenGate database userid must
have Select authority on the source database.
Use the column specification to @RANGE instead of KEYCOLS. This is more efficient as the
program logic flow is (1) @RANGE column specification, (2) KEYCOLS specification, then
(3) table Primary Index specification if neither of the above are declared .
Primary key
A primary key is a field (or combination of fields) in a table that is unique
for each row in that table.
Teradata does not utilize the concept of a “primary key”.
For the following discussion, the sample table schema below creates a table with a non-unique
primary index. By default, Teradata will set col1 as the Primary Index for data distribution across all
available AMPs.
In our test schema, we designate col1 as a Unique Primary Index (UPI). Oracle GoldenGate Replicat
uses this column as it would a primary key. The DML statement built by Replicat is:
UPDATE "LPDB"."T_PK" SET "col2"='This is a test',"col3"='of Terdadta primary key and
indexes',"col4"='Update operation ' WHERE "col1"=123456789
By designating col1 as a Primary Index (NUPI), we see that Oracle GoldenGate treats all columns as
the table key. The values of col1, col2, col3, and the before image of col4 in the target must match
the captured data for the update to be processed:
This results in an all AMP operation because the data row hash contained within the database is
based upon the Primary Index, col1, but the DML requires a check of all columns to locate the row.
To override this functionality, setting KEYCOLS (col1), in the Replicat MAP statement results in
the DML statement:
To avoid this performance hit, use Teradata Macros instead of Stored Procedures as Macros execute
the same as normal DML statements (and are cached). As opposed to Stored Procedures, Macros do
not support the use of conditional statements for data selection prior to executing DML. For the
Teradata Macro to function properly, conditional logic must be performed in the Oracle GoldenGate
process.
To eliminate the database server performance degradation caused by calling the Stored Procedure,
we convert it to two Teradata Macro that only contains the DML statements; one for the upsert and
one for the delete, and modify the Replicat Group to perform the conditional logic for selecting
records based upon operation type. We’d then call the Macro via a SQLEXEC statement similar to
the following:
5. What Replication RuleSets exist and what Replication Group and tables are associated with
each?
a. SELECT * from DBC.RepCaptureRulesV;
6. How do I decode a Teradata error message?
a. SELECT ERRORTEXT FROM dbc.errormsgs WHERE errorcode = <error_number>;
References
The following publications were utilized as reference materials for information presented in this
document:
Worldwide Inquiries: Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective
Fax: +1.650.506.7200
oracle.com 0109