Prepare Database Connection, System, and Parameter Settings
Learn about configuring database connection, system, and parameter settings for Oracle GoldenGate for Oracle.
Enable GoldenGate Replication and Archive Mode
Step 1: Enable GoldenGate Replication
The database services required to support Oracle GoldenGate Extract and Replicat must be enabled explicitly for Oracle database.
To enable Oracle GoldenGate replication, set the following database initialization parameter. All instances in Oracle RAC must have this value set to TRUE if using Oracle GoldenGate on any of the nodes.
ENABLE_GOLDENGATE_REPLICATION=true
For more information about this parameter, see Initialization Parameters.
Steps 2: Enable the Archive Mode
Oracle Databases must be in
ARCHIVELOG
mode so that Extract can process the log files. To
switch on the ARCHIVELOG
mode, follow the steps provided in Changing the Database Archiving Mode.
Setting Flashback Query
To know about the data that Oracle GoldenGate fetches, see Details of Support for Oracle Data Types and 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. |
Handling Other Database Properties
There are some database properties that may affect Oracle GoldenGate and the parameters used to resolve or work around certain conditions.
The following table lists the database properties and the associated concern/resolution.
Database Property | Concern/Resolution |
---|---|
Table with interval partitioning |
To support tables with interval partitioning, make
certain that the |
Table with virtual columns |
Virtual columns are not logged, and Oracle does not permit DML on virtual columns. You can, however, capture this data and map it to a target column that is not a virtual column by doing the following: Include the table in the Extract
In the Replicat |
Table with inherently updateable view |
To replicate to an inherently updateable view, define
a key on the unique columns in the updateable view by using a
|
Redo logs or archives in different locations |
The |
|
To replicate
|
Sequences |
To replicate DDL for sequences
( To replicate just sequence values, use the
|
Configure a Multitenant Container Database
Note:
Starting with Oracle GoldenGate 23ai, root-level Extract is not supported. This implies that the user privileges are assigned at the PDB level only and thec##ggadmin
user is
not used with Oracle GoldenGate 23ai.
The following diagram shows the configuration for different approaches in a multitenant container database configuration:
Description of the illustration pdb_extract_feedbk.png
Adding Extract directly from the PDB captures from isolated PDBs, managing ownership and responsibility at the PDB level.
Using a per-PDB Extract, you can connect as the local PDB user (for
example, ggadmin
) and then register this Extract with the database.
As you are already logged in as the PDB user, an additional
container
clause is not required. Similarly, the
SOURCECATALOG
or a three-part naming convention is also not
needed.
To set up an Extract, see Add an Online Extract.
Considerations for Multitenant Container Database Configuration
Consider the following guidelines when configuring a multitenant container databases for data replication using Oracle GoldenGate:
-
The different pluggable databases in the multitenant container database can have different character sets. Oracle GoldenGate captures data from any multitenant database with different character sets into one trail file and replicates the data without corruption due to using different character sets.
-
To create and register a per-PDB Extract, you will need to connect to the PDB user such as
ggadmin
created for PDB-level access. Use theUSERIDALIAS
parameter to configure a SQL*Net connection string such asggadmin@pdbeast
. You do not need the container clause or theSOURCECATALOG
to set up the per-PDB Extract. -
To support source CDB 12.2, Extract must specify the trail format as release 12.3. Due to changes in the redo logs, to capture from a multitenant database that is Oracle 12.2 or higher, the trail format release must be 12.3 or higher.
-
DDL replication works as a normal replication for multitenant databases.
See Add Database Connections to add a multitenant container database user in Oracle GoldenGate credentials. See Grant User Privileges for Oracle Database 21c and Lower or Grant User Privileges for Oracle Database 23ai and Higher depending on the Oracle database installation that you need to configure.
Flush Sequence for Multitenant Container Database
You can only use the FLUSH SEQUENCE
command within Oracle
GoldenGate, if the sequence.sql
script applies the database
procedures into the GoldenGate Admin schema of the database.
FLUSH SEQUENCE
command immediately after you
start Extract for the first time during an initial synchronization or a
re-synchronization. This command updates an Oracle sequence, so that initial redo
records are available at the time that Extract starts to capture transaction data.
Normally, redo is not generated until the current cache is exhausted. The flush
gives Replicat an initial start point with which to synchronize to the correct
sequence value on the target system. From then on, Extract can use the redo that is
associated with the usual cache reservation of sequence values.
-
The following Oracle procedures are used by
FLUSH SEQUENCE
:Database Procedure User and Privileges Source
updateSequence
Grants
EXECUTE
to the owner of the Oracle GoldenGate DDL objects, or other selected user if not using DDL support.Target
replicateSequence
Grants
EXECUTE
to the Oracle GoldenGate Replicat user.The
sequence.sql
script installs these procedures. Normally, this script is run as part of the Oracle GoldenGate installation process, but make certain that was done before usingFLUSH SEQUENCE
. Ifsequence.sql
was not run, the flush fails and an error message similar to the following is generated:Cannot flush sequence {0}. Refer to the Oracle GoldenGate for Oracle documentation for instructions on how to set up and run the sequence.sql script. Error {1}.
-
Before using
FLUSH SEQUENCE
, connect to the database using theDBLOGIN
command.
FLUSH SEQUENCE
must be issued at the PDB level, to
create an Oracle GoldenGate user in each PDB for which the sequence replication is
required. Use DBLOGIN
to log into that PDB, and run the
FLUSH SEQUENCE
command.
It is recommended that you use the same schema in each PDB, so that it
works with the GGSCHEMA
GLOBALS parameter file.
In the following example, the environment setup is for Oracle 21c to Oracle 21c Replication, with integrated Extract, parallel Replicat using Oracle GoldenGate 21c (21.3.0).
Source CDB | Target CDB |
---|---|
|
SOUTH |
PDB Name: |
PDB Name: |
Common user: PDB user for sequences: |
PDB User: |
sqlplus system/manager
ALTER SESSION SESSION SET CONTAINER=CERTMISSN;
CREATE USER ggate IDENTIFIED BY password DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON USERS CONTAINER=CURRENT;
@sequence.sql
sqlplus system/manager
ALTER SESSION SET CONTAINER=DBEAST;
@sequence.sql
GGADMIN
FLUSH SEQUENCE
command:DBLOGIN USERIDALIAS ggeast DOMAIN OracleGoldenGate
FLUSH SEQUENCE DBEAST.HR.*
sqlplus system/manager
ALTER SESSION SET CONTAINER =PDBWEST;
@sequence.sql
When prompted, enter the PDB user name ggadmin
.
This also applies to the @sequence.sql
script, which
you must also run on each PDB from where you are going to capture.
Configure the Auto Capture Mode for Extract
The auto capture mode allows automatically capturing the tables that have been enabled for Oracle GoldenGate auto capture.
See How to Capture Supplemental Logging for Oracle GoldenGate in the Oracle Database Utilities guide.
-
Easy to configure captured table set
-
No requirement to update
TABLE
/TABLEEXCLUDE
parameter -
No need to stop or restart Extract when captured table set changes
Enabling Auto Capture Mode for Extract
TRANLOGOPTIONS
:
TRANLOGOPTIONS ENABLE_AUTO_CAPTURE | DISABLE_AUTO_CAPTURE
When Extract is running in the auto capture mode, don't filter an LCR if
the object is not part of exclusion list set by TABLE EXCLUDE
parameter or any inclusion list set by TABLE
parameter.
The LIST TABLES
command shows the
list of tables enabled for AUTO_CAPTURE
.
Note:
Auto capture is available from Oracle GoldenGate 21c with Oracle Database 19.18 data patch and higher. In case of database upgrade , any Extract which was registered prior to Oracle Database 19.18 cannot be converted to auto capture. Only new Extracts that are created after upgrateding to Oracle Database 19.18 and later, can be converted to auto capture Extract.See DML Auto Capture and Details of Support for Objects and Operations in Oracle DDL to know about the DML and DDL considerations.
Also see this article Oracle GoldenGate 21c: Auto Capture of Tables to learn more.
Managing Server Resources
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.
When Automatic (Shared) Memory
Management is enabled (recommended), there is no need to set the
STREAMS_POOL_SIZE
environment variable for Oracle Database.
This is because no minimum memory is required for the Streams Pool. However, if
Automatic (Shared) Memory Management is not enabled, then the Streams Pool can use
up to 10% of the Shared Pool if STREAMS_POOL_SIZE
is not specified
and a root-level Extract (for Downstream Capture) or integrated Replicat (deprecated
in Oracle GoldenGate 23ai) is in use.
If you wish to allocate memory from the
STREAMS POOL explicitly, calculate the STREAMS_POOL_SIZE
by adding
25% to the sum of the MAX_SGA_SIZE
values for each process. For
example, Downstream Capture uses the maximum size of 1GB for the
MAX_SGA_SIZE
parameter, by default. In this case,
STREAMS_POOL_SIZE
might be set to 1.25GB. If there were two
additional integrated Replicats, each with a MAX_SGA_SIZE
of 1GB,
then the STREAMS_POOL_SIZE
would need to be 3.75GB.
Note that Streams pool is also used by other components of the database (like Oracle Stream and Advanced Queuing), so make certain to take them into account while sizing the Streams pool for Oracle GoldenGate.
Also see DOC ID 2998659.1 and the blog GoldenGate: How to manage the Streams Pool in the Oracle Database? to know more.Support for Oracle Sequences
To support Oracle sequences, you must install some database procedures.
From the SQL prompt, run the script
$OGG_HOME/lib/sql/legacy/sequence.sql
on the source and target
database as a DBA.
In a container database (CDB), connect as a local user with DBA privileges in the pluggable database (PDB).
In a non-CDB, connect as DBA for the database.
The Oracle GoldenGate Admin User does not necessarily need DBA
privileges. However, the Oracle GoldenGate Admin User must have the SELECT
ANY DICTIONARY
and the [CREATE |ALTER|DROP] ANY
SEQUENCE
privileges in addition to the privileges granted by the
OGG_CAPTURE
| OGG_APPLY
role for Oracle
Database 23ai and higher or through the procedure call
DBMS_GOLDEN_GATE_AUTH.GRANT_ADMIN_PRIVILEGE
for earlier
database versions.
The following example shows how to login to a CDB as the system user and run the
sequence.sql
script:
sqlplus system/***@cdb23_pdbeast
@sequence.sql
You will be
prompted to provide the Oracle GoldenGate Admin User, such as
ggadmin
.
STATUS OF SEQUENCE SUPPORT
--------------------------------------------------------------
SUCCESSFUL installation of Oracle Sequence Replication support