5 Configuring Oracle GoldenGate in a Multitenant Container Database

This chapter contains additional configuration instructions when configuring Oracle GoldenGate using the per-PDB capture mode or the CDB root capture mode.


5.1 Using CDB Root Capture from PDB

To capture from a multitenant database, you must use an Extract that is configured at the root level using a c## account. To apply data into a multitenant database, a separate Replicat is needed for each PDB, because a Replicat connects at the PDB level and doesn't have access to objects outside of that PDB

One Extract group can capture from multiple pluggable databases to a single trail. In the parameter file, source objects must be specified in TABLE and SEQUENCE statements with their fully qualified three-part names in the format of container.schema.object.

As an alternative to specifying three-part names, you can specify a default pluggable database with the SOURCECATALOG parameter, and then specify only the schema.object in subsequent TABLE or SEQUENCE parameters. You can use multiple instances of this configuration to handle multiple source pluggable databases. For example:

TABLE phoenix.tab;
SEQUENCE phoenix.seq;
TABLE dallas.tab;
SEQUENCE dallas.seq;

5.1.1 Applying to Pluggable Databases

Replicat can only connect and apply to one pluggable database. To specify the correct one, use a SQL*Net connect string for the database user that you specify with the USERID or USERIDALIAS parameter. For example: GGADMIN@FINANCE. In the parameter file, specify only the schema.object in the TARGET portion of the MAP statements. In the MAP portion, identify source objects captured from more than one pluggable database with their three-part names or use the SOURCECATALOG parameter with two-part names. The following is an example of this configuration.

MAP schema_1.tab, TARGET 1;
MAP schema_1.seq, TARGET 1;
MAP schema_2.tab, TARGET 2;
MAP schema_2.seq, TARGET 2;

The following is an example without the use of SOURCECATALOG to identify the source pluggable database. In this case, the source objects are specified with their three-part names.

MAP pdb1.schema_1.tab, TARGET 1;
MAP pdb1.schema_1.seq, TARGET 1;

To configure replication from multiple source pluggable databases to multiple target pluggable databases, you can configure parallel Extract and Replicat streams, each handling data for one pluggable database. Alternatively, you can configure one Extract capturing from multiple source pluggable databases, which writes to one trail that is read by multiple Replicat groups, each applying to a different target pluggable database. Yet another alternative is to use one Extract writing to multiple trails, each trail read by a Replicat assigned to a specific target pluggable database :

5.1.2 Excluding Objects from the Configuration

To exclude pluggable databases, schemas, and objects from the configuration, you can use the CATALOGEXCLUDE, SCHEMAEXCLUDE, TABLEEXCLUDE, MAPEXCLUDE, and EXCLUDEWILDCARDOBJECTSONLY parameters.

5.2 Mining Mode Toggling

Mining mode toggling is not supported. This implies that after you create mining in ROOT, then the session will stay mining in ROOT and if the you choose to create mining in PDB, then the session will stay mining in that particular PDB.

However, for a specific need if you need to migrate some previous Oracle GoldenGate session mining in CDB$ROOT to mining in specific PDB, then there is a migration process that you can follow:
  1. Register a new per-PDB Extract. For example, the SCN returned is X.

  2. Let the old ROOT Extract mine the past X (RECOVERYSCN X).

  3. Stop the old Extract

  4. Alter the new Extract so that its current SCN is set to be Y.

  5. Start the new Extract.

This new Extract picks up from where the old Extract left off.


There may be some duplicate transactions at SCN Y, if there were multiple txs committing at the same SCN Y. However, Replicat can handle duplicate txs by default.

5.3 Other Requirements for Multitenant Container Databases

This topic describes the special requirements that apply to replication to and from multitenant container databases.

The requirements are:

  • 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.

  • Extract must connect to the root container (cdb$root) as a common user in order to interact with the logmining server. To specify the root container, use the appropriate SQL*Net connect string for the database user that you specify with the USERID or USERIDALIAS parameter. For example: C##GGADMIN@FINANCE. See Establishing Oracle GoldenGate Credentials for how to create a user for the Oracle GoldenGate processes and grant the correct privileges.

  • 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.

  • The dbms_goldengate_auth.grant_admin_privilege package grants the appropriate privileges for capture and apply within a multitenant container database. This includes the container parameter, which must be set to ALL, as shown in the following example:

    exec dbms_goldengate_auth.grant_admin_privilege('C##GGADMIN',container=>'all')
  • DDL replication works as a normal replication for multitenant databases. However, DDL on the root container should not be replicated because Replicats must not connect to the root container, only to PDBs.

FLUSH SEQUENCE for Multitenant Database

FLUSH SEQUENCE must be issued at the PDB level, so the user will need to create an Oracle GoldenGate user in each PDB that they wish to do sequence replication for, and then use DBLOGIN to log into that PDB, and then perform 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. Here is an example:

Environment Information OGG 18.1 Oracle 12c to Oracle 12c Replication, Integrated Extract, Parallel Replicat
Source OGG Configuration
    Container User: C##GGADMIN
    PDB User for Sequences: GGATE
sqlplus / as sysdbao 
SQL> alter session set container=CERTMISSN;
SQL> create user ggate identified by password default tablespace users temporary tablespace temp quota unlimited on users container=current;
Run @sequence
sqlplus / as sysdba
SQL> alter session set container=CERTMISSN;
SQL> @sequence
When prompted enter

Target Oracle GoldenGate Configuration:
Run @sequence
sqlplus / as sysdba
SQL> alter session set container=CERTDSQ;
SQL> @sequence

When prompted enter GGATE.

This also applies to the @sequence.sql script, which must also be run at each PDB that you are going to capture from.