2 Preparing the Database for Oracle GoldenGate
Learn how to prepare your database for Oracle GoldenGate, including how to configure connections and logging, how to enable Oracle GoldenGate in your database, how to set the flashback query, and how to manage server resources.
Topics:
- Configuring Connections for Integrated Processes
If you will be using integrated capture and integrated Replicat, each requires a dedicated server connection in thetnsnames.ora
file. - Configuring Logging Properties
Oracle GoldenGate relies on the redo logs to capture the data that it needs to replicate source transactions. The Oracle redo logs on the source system must be configured properly before you start Oracle GoldenGate processing. - Enabling Oracle GoldenGate in the Database
The database services required to support Oracle GoldenGate capture and apply must be enabled explicitly for all Oracle database versions. This is required for all Extract and Replicat modes. - Setting Flashback Query
To process certain update records, Extract fetches additional row data from the source database. - Managing Server Resources
In integrated mode, Extract interacts with an underlying logmining server in the source database and Replicat interacts with an inbound server in the target database. This section provides guidelines for managing the shared memory consumed by the these servers. - Ensuring Row Uniqueness in Source and Target Tables
Oracle GoldenGate requires a unique row identifier on the source and target tables to locate the correct target rows for replicated updates and deletes.
Configuring Connections for Integrated Processes
If you will be using integrated capture and integrated Replicat, each requires a
dedicated server connection in the tnsnames.ora
file.
You direct the processes to use these connections with the USERID
or USERIDALIAS
parameter in the Extract and Replicat parameter files when
you configure those processes.
The following is an example of the dedicated connection required for integrated capture (Extract) and integrated Replicat.
TEST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = test2)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) ) )
The following are the security options for specifying the connection string in the Extract or Replicat parameter file.
Password encryption method:
USERID intext@test, PASSWORD mypassword
Credential store method:
USERIDALIAS ext
In the case of USERIDALIAS
, the alias ext
is stored in the Oracle GoldenGate credential store with the actual connection string, as in the following example:
AdminClient INFO CREDENTIALSTORE DOMAIN support Domain: Support Alias: ext Userid: intext@test
Parent topic: Preparing the Database for Oracle GoldenGate
Configuring Logging Properties
Oracle GoldenGate relies on the redo logs to capture the data that it needs to replicate source transactions. The Oracle redo logs on the source system must be configured properly before you start Oracle GoldenGate processing.
This section addresses the following logging levels that apply to Oracle GoldenGate. Which logging level that you use is dependent on the Oracle GoldenGate feature or features that you are using.
Note:
Redo volume is increased as the result of this required logging. You can wait until you are ready to start Oracle GoldenGate processing to enable the logging.
This table shows the Oracle GoldenGate use cases for the different logging properties.
Logging option | GGSCI command | What it does | Use case |
---|---|---|---|
Forced logging mode |
|
Forces the logging of all transactions and loads. |
Strongly recommended for all Oracle GoldenGate use cases. |
Minimum database-level supplemental logging |
|
Enables minimal supplemental logging to add row-chaining information to the redo log. |
Required for all Oracle GoldenGate use cases |
Schema-level supplemental logging, default setting |
|
Enables unconditional supplemental logging of the primary key and conditional supplemental logging of unique key(s) and foreign key(s) of all tables in a schema. All of these keys together are known as the scheduling columns. |
Enables the logging for all current and future tables in the schema. If the primary key, unique key, and foreign key columns are not identical at both source and target, use |
Schema-level supplemental logging with unconditional logging for all supported columns. (See Enabling Schema-level Supplemental Logging for non-supported column types.) |
|
Enables unconditional supplemental logging of all of the columns in a table, for all of the tables in a schema. |
Used for bidirectional and active-active configurations where all column values are checked, not just the changed columns, when attempting to perform an update or delete. This takes more resources though allows for the highest level of real-time data validation and thus conflict detection. This method should also be used if they are going to be using the
|
Schema-level supplemental logging, minimal setting |
|
Enables unconditional supplemental logging of the primary key and all valid unique indexes of all tables in a schema. |
Use only for nonintegrated Replicat. This is the minimum required schema-level logging. |
Table-level supplemental logging with built-in support for integrated Replicat |
|
Enables unconditional supplemental logging of the primary key and conditional supplemental logging of unique key(s) and foreign key(s) of a table. All of these keys together are known as the scheduling columns. |
Required for all Oracle GoldenGate use cases unless schema-level supplemental logging is used. If the primary key, unique key, and foreign key columns are not identical at both source and target, use |
Table-level supplemental logging with unconditional logging for all supported columns. (See Enabling Table-level Supplemental Logging for non-supported column types.) |
|
Enables unconditional supplemental logging of all of the columns of the table. |
Used for bidirectional and active-active configurations where all column values are checked, not just the changed columns, when attempting to perform an update or delete. This takes more resources though allows for the highest level of real-time data validation and thus conflict detection. It can also be used when the source and target primary, unique, and foreign keys are not the same or are constantly changing between source and target. |
Table-level supplemental logging, minimal setting |
|
Enables unconditional supplemental logging of the primary key and all valid unique indexes of a table. |
Use for nonintegrated Replicat and non-parallel Replicat. This is the minimum required table-level logging. |
Note:
Oracle Databases must be in ARCHIVELOG
mode so that Extract can process the log files.
- Enabling Minimum Database-level Supplemental Logging
- Enabling Schema-level Supplemental Logging
- Enabling Table-level Supplemental Logging
Parent topic: Preparing the Database for Oracle GoldenGate
Enabling Minimum Database-level Supplemental Logging
Oracle strongly recommends putting the Oracle source database into forced logging mode. Forced logging mode forces the logging of all transactions and loads, overriding any user or storage settings to the contrary. This ensures that no source data in the Extract configuration gets missed.
In addition, minimal supplemental logging, a database-level option, is required for an Oracle source database when using Oracle GoldenGate. This adds row chaining information, if any exists, to the redo log for update operations.
Note:
Database-level primary key (PK) and unique index (UI) logging is only discouraged if you are replicating a subset of tables. You can use it with Live Standby, or if Oracle GoldenGate is going to replicate all tables, like to reduce the downtime for a migration or upgrade.
Perform the following steps to verify and enable, if necessary, minimal supplemental logging and forced logging.
Parent topic: Configuring Logging Properties
Enabling Schema-level Supplemental Logging
Oracle GoldenGate supports schema-level supplemental logging. Schema-level logging is required for an Oracle source database when using the Oracle GoldenGate DDL replication feature. In all other use cases, it is optional, but then you must use table-level logging instead (see Enabling Table-level Supplemental Logging).
By default, schema-level logging automatically enables unconditional supplemental logging of the primary key and conditional supplemental logging of unique key(s) and foreign key(s) of all tables in a schema. Options enable you to alter the logging as needed.
Note:
Oracle strongly recommends using schema-level logging rather than table-level
logging, because it ensures that any new tables added to a schema are captured
if they satisfy wildcard specifications. This method is also recommended because
any changes to key columns are automatically reflected in the supplemental log
data too. For example, if a key changes, there is no need to issue ADD
TRANDATA
.
Perform the following steps on the source system to enable schema-level supplemental logging.
Parent topic: Configuring Logging Properties
Enabling Table-level Supplemental Logging
Enable table-level supplemental logging on the source system in the following cases:
-
To enable the required level of logging when not using schema-level logging (see Enabling Schema-level Supplemental Logging). Either schema-level or table-level logging must be used. By default, table-level logging automatically enables unconditional supplemental logging of the primary key and conditional supplemental logging of unique key(s) and foreign key(s) of a table. Options enable you to alter the logging as needed.
-
To prevent the logging of the primary key for any given table.
-
To log non-key column values at the table level to support specific Oracle GoldenGate features, such as filtering and conflict detection and resolution logic.
-
If the key columns change on a table that only has table-level supplemental logging, you must perform
ADD TRANDATA
on the table prior to allowing any DML activity on the table.
Perform the following steps on the source system to enable table-level supplemental logging or use the optional features of the command.
-
Run GGSCI on the source system.
-
Issue the
DBLOGIN
command using the alias of a user in the credential store who has privilege to enable table-level supplemental logging.DBLOGIN USERIDALIAS
alias
See USERIDALIAS in Reference for Oracle GoldenGatefor more information about
DBLOGIN
and additional options. -
Issue the
ADD TRANDATA
command.ADD TRANDATA [
PDB
.]schema.
table
[, COLS (columns)
] [, NOKEY] [, ALLCOLS | NOSCHEDULINGCOLS]Where:
-
PDB
is the name of the root container or pluggable database if the table is in a multitenant container database. -
schema
is the source schema that contains the table. -
table
is the name of the table. See Specifying Object Names in Oracle GoldenGate Input in Administering Oracle GoldenGate for instructions for specifying object names. -
ADD TRANDATA
without other options automatically enables unconditional supplemental logging of the primary key and conditional supplemental logging of unique key(s) and foreign key(s) of the table. Unconditional logging forces the primary key values to the log whether or not the key was changed in the current operation. Conditional logging logs all of the column values of a foreign or unique key if at least one of them was changed in the current operation. The default is optional to support nonintegrated Replicat (see alsoNOSCHEDULINGCOLS
) but is required to support integrated Replicat because primary key, unique keys, and foreign keys must all be available to the inbound server to compute dependencies. For more information about integrated Replicat, see Deciding Which Apply Method to Use. -
ALLCOLS
enables the unconditional supplemental logging of all of the columns of the table. Use to support integrated Replicat when the source and target tables have different scheduling columns. (Scheduling columns are the primary key, the unique key, and the foreign key.) -
NOSCHEDULINGCOLS
is valid for Replicat in nonintegrated mode only. It issues anALTER TABLE
command with anADD SUPPLEMENTAL LOG DATA ALWAYS
clause that is appropriate for the type of unique constraint that is defined for the table, or all columns in the absence of a unique constraint. This command satisfies the basic table-level logging requirements of Oracle GoldenGate when schema-level logging will not be used. See Ensuring Row Uniqueness in Source and Target Tables for how Oracle GoldenGate selects a key or index. -
COLS
columns
logs non-key columns that are required for aKEYCOLS
clause or for filtering and manipulation. The parentheses are required. These columns will be logged in addition to the primary key unless theNOKEY
option is also present. -
NOKEY
prevents the logging of the primary key or unique key. Requires aKEYCOLS
clause in theTABLE
andMAP
parameters and aCOLS
clause in theADD TRANDATA
command to log the alternateKEYCOLS
columns.
-
-
If using
ADD TRANDATA
with theCOLS
option, create a unique index for those columns on the target to optimize row retrieval. If you are logging those columns as a substitute key for aKEYCOLS
clause, make a note to add theKEYCOLS
clause to theTABLE
andMAP
statements when you configure the Oracle GoldenGate processes.
Parent topic: Configuring Logging Properties
Enabling Oracle GoldenGate in the Database
The database services required to support Oracle GoldenGate capture and apply must be enabled explicitly for all Oracle database versions. This is required for all Extract and Replicat modes.
To enable Oracle GoldenGate, set the following database initialization parameter. All instances in Oracle RAC must have the same setting.
ENABLE_GOLDENGATE_REPLICATION=true
This parameter alters the DBA_FEATURE_USAGE_STATISTICS
view. For
more information about this parameter, see Initialization Parameters.
Parent topic: Preparing the Database for Oracle GoldenGate
Setting Flashback Query
To process certain update records, Extract fetches additional row data from the source database.
Oracle GoldenGate fetches data for the following:
-
User-defined types
-
Nested tables
-
XMLType objects
By default, Oracle GoldenGate uses Flashback Query to fetch the values from the undo (rollback) tablespaces. That way, Oracle GoldenGate can reconstruct a read-consistent row image as of a specific time or SCN to match the redo record.
For best fetch results, configure the source database as follows:
Oracle GoldenGate provides the following parameters to manage fetching.
Parameter or Command | Description |
---|---|
|
Shows Extract fetch statistics on demand. |
|
Sets the |
|
Controls the number of open cursors for prepared queries that Extract maintains in the source database, and also for |
|
Controls the default fetch behavior of Extract: whether Extract performs a flashback query or fetches the current image from the table. |
|
Handles the failure of an Extract flashback query, such as if the undo retention expired or the structure of a table changed. Extract can fetch the current image from the table or ignore the failure. |
|
Controls the response by Replicat when it processes trail records that include fetched data or column-missing conditions. |
Parent topic: Preparing the Database for Oracle GoldenGate
Managing Server Resources
In integrated mode, Extract interacts with an underlying logmining server in the source database and Replicat interacts with an inbound server in the target database. This section provides guidelines for managing the shared memory consumed by the these servers.
The shared memory that is used by the servers comes from the Streams pool portion of the System Global Area (SGA) in the database. Therefore, you must set the database initialization parameter STREAMS_POOL_SIZE
high enough to keep enough memory available for the number of Extract and Replicat processes that you expect to run in integrated mode. Note that Streams pool is also used by other components of the database (like Oracle Streams, Advanced Queuing, and Datapump export/import), so make certain to take them into account while sizing the Streams pool for Oracle GoldenGate.
By default, one integrated capture Extract requests the logmining server to run with MAX_SGA_SIZE
of 1GB. Thus, if you are running three Extracts in integrated capture mode in the same database instance, you need at least 3 GB of memory allocated to the Streams pool. As a best practice, keep 25 percent of the Streams pool available. For example, if there are 3 Extracts in integrated capture mode, set STREAMS_POOL_SIZE
for the database to the following value:
3 GB * 1.25 = 3.75 GB
Parent topic: Preparing the Database for Oracle GoldenGate
Ensuring Row Uniqueness in Source and Target Tables
Oracle GoldenGate requires a unique row identifier on the source and target tables to locate the correct target rows for replicated updates and deletes.
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, depending on the number and type of
constraints that were logged (see Configuring Logging Properties).
-
Primary key if it does not contain any extended (32K)
VARCHAR2/NVARCHAR2
columns. Primary key without invisible columns. -
Unique key: Unique key without invisible columns.
In the case of a non-integrated Replicat, the selection of the unique key is as follows:
-
First unique key alphanumerically with no virtual columns, no UDTs, no function-based columns, no nullable columns, and no extended (32K)
VARCHAR2/NVARCHAR2
columns. To support a key that contains columns that are part of an invisible index, you must use theALLOWINVISIBLEINDEXKEYS
parameter in the Oracle GoldenGateGLOBALS
file. -
First unique key alphanumerically with no virtual columns, no UDTs, no extended (32K)
VARCHAR2/NVARCHAR2
columns, or no function-based columns, but can include nullable columns. To support a key that contains columns that are part of an invisible index, you must use theALLOWINVISIBLEINDEXKEYS
parameter in the Oracle GoldenGateGLOBALS
file.
-
-
Not Nullable Unique keys: At least one column from one of the unique keys must be not nullable. This is because
NOALLOWNULLABLEKEYS
is the default.Note:
ALLOWNULLABLEKEYS
is not valid for integrated Replicat. -
If none of the preceding key types exist (even though there might be other types of keys defined on the table) Oracle GoldenGate constructs a pseudo key of all columns that the database allows to be used in a unique key, excluding virtual columns, UDTs, function-based columns, extended (32K)
VARCHAR2/NVARCHAR2
columns, and any columns that are explicitly excluded from the Oracle GoldenGate configuration by an Oracle GoldenGate user.Unless otherwise excluded due to the preceding restrictions, invisible columns are allowed in the pseudo key.
Note:
If there are other, non-usable keys on a table or if there are no keys at all on the table, Oracle GoldenGate logs an appropriate message to the report file. Constructing a key from all of the columns impedes the performance of Oracle GoldenGate on the source system. On the target, this key causes Replicat to use a larger, less efficient WHERE
clause.
If a table does not have an appropriate key, or if you prefer the existing key(s) not to be used, you can define a substitute key if 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 will override any existing primary or unique key that Oracle GoldenGate finds. For more information, see Reference for Oracle GoldenGate.
Parent topic: Preparing the Database for Oracle GoldenGate