Topics:
Parent topic: Using Oracle GoldenGate with SQL Server
This section contains instructions for setting up the Extract and Replicat connections to a SQL Server database.
Parent topic: Preparing the System for Oracle GoldenGate
Extract connects to a source SQL Server database through an ODBC (Open Database Connectivity) connection. To create this connection, you set up a data source name (DSN) through the Data Sources (ODBC) control panel. See Configuring an ODBC Connection for instructions.
When using Transport Layer Security (TLS) 1.2 in your database environment, include the following parameter in Extract to force it to use a supported connection protocol:
DBOPTIONS DRIVER SQLNCLI11
Parent topic: Configuring a Database Connection
Replicat can connect to the target database to perform DML operations in the following ways:
Through ODBC.
Through OLE DB. This is the default and provides slightly better performance than using ODBC.
Through OLE DB as the SQL Server replication user. NOT FOR REPLICATION
must be set on IDENTITY
columns, foreign key constraints, and triggers.
Note:
Because Replicat always uses ODBC to query for metadata, you must configure a target ODBC connection.
Before you select a method to use, review the following guidelines and procedures to evaluate the advantages and disadvantages of each.
Parent topic: Configuring a Database Connection
If Replicat connects through ODBC or through the default OLE DB connection, the following limitations apply:
To keep IDENTITY
columns identical on source and target when using ODBC or default OLE DB, Replicat creates special operations in its transaction to ensure that the seeds are incremented on the target. These steps may reduce delivery performance.
You must adjust or disable triggers and constraints on the target tables to eliminate the potential for redundant operations.
To use Replicat with either ODBC or OLE DB, follow these steps:
Note:
OLE DB uses the ODBC connection settings to derive connection information for OLE DB together with information on which driver to use.
Parent topic: Configuring a Replicat Database Connection
USEREPLICATIONUSER
If Replicat connects as the SQL Server replication user through OLE DB with the USEREPLICATIONUSER
option, and NOT FOR REPLICATION
is enabled for IDENTITY
, triggers, and foreign key constraints, the following benefits and limitations apply.
IDENTITY
seeds are not incremented when Replicat performs an insert. For SQL Server bidirectional configurations, stagger the seed and increment values like the example in Step 3 of the previous section.
Triggers are disabled for the Replicat user automatically on the target to prevent redundant operations. However triggers fire on the target for other users.
Foreign key constraints are not enforced on the target for Replicat transactions. CASCADE
updates and deletes are not performed. These, too, prevent redundant operations.
CHECK
constraints are not enforced on the target for Replicat transactions. Even though these constraints are enforced on the source before data is captured, consider whether their absence on the target could cause data integrity issues.
Note:
Normal IDENTITY
, trigger, and constraint functionality remains in effect for any users other than the Replicat replication user.
To use Replicat with USEREPLICATIONUSER
, follow these steps:
Parent topic: Configuring a Replicat Database Connection
Follow these instructions to create a SQL Server system data source name (DSN) for a source SQL Server database and for a target SQL Server database. A DSN stores information about how to connect to a SQL Server database through ODBC (Open Database Connectivity).
Note:
Even when using OLE DB as the apply connection method, Replicat always uses ODBC to query the target database for metadata. Therefore Replicat always requires a DSN.
To create a SQL Server DSN
Parent topic: Configuring a Database Connection
The table attributes in the following sections must be addressed in your Oracle GoldenGate environment.
Parent topic: Preparing the System for Oracle GoldenGate
In an environment where SQL Server is the target, consider triggers and cascade constraints that may repeat an operation that occurred on the source. For example, if the source has an insert trigger on TableA that inserts a record into TableB, and Oracle GoldenGate is configured to capture and deliver both TableA and TableB, the insert trigger on the target table, TableA, must be disabled. Otherwise, Replicat inserts into TableA, and the trigger fires and insert into TableB. Replicat will then try to insert into TableB, and then terminate abnormally.
You use the DBOPTIONS USEREPLICATIONUSER
parameter in Replicat.
You use OLE DB connection for Replicat. The use of the OLE DB connection is the default configuration. Note that the trigger, constraint, or IDENTITY
property must have NOT FOR REPLICATION
enabled.
In the following scenario, disable the triggers and constraints on the target:
Uni-directional replication where all tables on the source are replicated.
In the following scenarios, enable the triggers and constraints on the target:
Uni-directional replication where tables affected by a trigger or cascade operation are not replicated, and the only application that loads these tables is using a trigger or cascade operation.
Uni-directional or -bi-directional replication where all tables on the source are replicated. In this scenario, set the target table cascade constraints and triggers to enable NOT FOR REPLICATION
, and use the DBOPTIONS USEREPLICATIONUSER
parameter in Replicat.
Parent topic: Preparing Tables for Processing
Oracle GoldenGate requires unique row identifiers on the source and target tables to locate the correct target rows for replicated updates and deletes. Source tables can have any kind of key listed in How Oracle GoldenGate Determines the Kind of Row Identifier to Use, except for tables of a SQL Server Standard Edition instance, which require a primary key. If there is no primary key identified on a table that has fixed-length columns, the length of one of the fixed-length columns must be below 3800 bytes.
Parent topic: Preparing Tables for Processing
Unless a KEYCOLS
clause is used in the TABLE
or MAP
statement, Oracle GoldenGate selects a row identifier to use in the following order of priority:
Parent topic: Assigning Row Identifiers
KEYCOLS
to Specify a Custom KeyIf a table does not have an applicable row identifier, or if you prefer that identifiers are not used, you can define a substitute key, providing that the table has columns that always contain unique values. You define this substitute key by including a KEYCOLS
clause within the Extract TABLE
parameter and the Replicat MAP
parameter. The specified key overrides any existing primary or unique key that Oracle GoldenGate finds. For more information, see Reference for Oracle GoldenGate.
Parent topic: Assigning Row Identifiers
IDENTITY
Replication with Array ProcessingBecause only one table per session can have IDENTITY_INSERT
set to ON
, Replicat must continuously toggle IDENTITY_INSERT
when it applies IDENTITY
data to multiple tables in a session. To improve the performance of Replicat in this situation, use the BATCHSQL
parameter. BATCHSQL
causes Replicat to use array processing instead of applying SQL statements one at a time.
Parent topic: Preparing Tables for Processing
Oracle GoldenGate provides globalization support that lets it process data in its native language encoding. The Oracle GoldenGate apply process (Replicat) can convert data from one character set to another when the data is contained in character column types. For more information, see Administering Oracle GoldenGate.
Parent topic: Preparing the System for Oracle GoldenGate