Skip to main content
Oracle GoldenGate is a managed service that can collect, replicate, and manage transactional data between databases. GoldenGate can use CockroachDB as a sink by leveraging CockroachDB’s PostgreSQL compatibility. This page describes how to: As of this writing, GoldenGate supports the following database sources:
  • MySQL
  • Oracle
  • PostgreSQL
  • SQL Server
  • Db2 z/OS
This page describes GoldenGate at a high level and assumes some familiarity with this tool. For detailed information, refer to the Oracle GoldenGate documentation. For limitations on what PostgreSQL features are supported, refer to Oracle’s Details of Supported PostgreSQL Data Types.

Before you begin

  • Oracle GoldenGate runs as a process separate from CockroachDB and the source database. Ensure your host meets the minimum requirements.
  • Ensure that your Oracle client or client libraries are compatible with the host Oracle version.
  • Ensure that you have installed both required Oracle GoldenGate components:
    1. Oracle GoldenGate for Oracle is required to pull source data and route it to proper trail files.
    2. Oracle GoldenGate for PostgreSQL is required to pull data from the trail files to CockroachDB.
  • For CockroachDB clusters running v22.1 and earlier, enable the following :
    For CockroachDB v22.2 and later, these settings are enabled by default.
  • Ensure libpg is available on the Oracle GoldenGate host.
  • Ensure you have a secure, CockroachDB cluster running the latest , and have created a .

Configure Oracle GoldenGate for PostgreSQL

This section describes how to configure Oracle GoldenGate for PostgreSQL to work with CockroachDB. Oracle GoldenGate for PostgreSQL is the process that pulls data from trail files over to CockroachDB. This is a separate installation from Oracle GoldenGate for Oracle, which will be used to pull source data and route it to proper trail files. For more information, refer to the Oracle GoldenGate for PostgreSQL documentation. The following example uses a CockroachDB Standard cluster.
  1. Edit the ODBC.ini file to set up the ODBC data sources and configuration:
  2. Ensure that all the PostgreSQL libraries are installed and referenced in LD_LIBRARY_PATH. The path should at least include /usr/pgsql-13/lib and /u01/ggs-pg/lib:
  3. Set up the ODBC.ini file for the Oracle GoldenGate host:
    To make this change permanent, you must also add the command to your shell’s configuration file, such as ~/.zshrc.
  4. In the ODBC.ini file, set up the CockroachDB Standard parameters:
    • Replace the login details with your own. Be sure to prefix the database name with .
    • Make sure your CockroachDB Standard cluster’s root CA certificate is in the TrustStore path.
  5. Log in to the database:

Set up Extract to capture data from a source database

Extract is Oracle GoldenGate’s data capture mechanism that is configured to run against the source database.
Complete the steps in this section on a machine and in a directory where Oracle GoldenGate for Oracle is installed.
  1. In the GGSCI terminal, create and open the epos parameter file for the Oracle source:
  2. Edit the parameters that configure Extract to send data to the trail file at ./dirdat/ab on the remote host:
  3. In the GGSCI terminal, run the following and start the Extract service.
  4. Check the status of the Extract by creating a test table OGGADM1.testtable in Oracle and adding a row:
  5. In GGSCI, in another terminal, check that Extract is working correctly:
    You should see an output similar to the following:

Set up Replicat to deliver data to CockroachDB

Replicat is an Oracle process that reads trail files and delivers data to a target database.
Run the steps in this section on a machine and in a directory where Oracle GoldenGate for PostgreSQL is installed.
  1. Log in to the database from GGSCI:
  2. Check the status in the GGSCI terminal:
    You should see the following output:
  3. Open the parameter file:
  4. Edit the parameters to configure the MAP statement, which maps the source (OGGADM1.testtable) to the target (public.testtable):
  5. In the GGSCI terminal, run the following and start the Replicat service:
  6. Test that Extract and Replicat are working properly by adding values to OGGADM1.testtable:
  7. and check that the data was delivered to public.testtable:
  8. Open the GGSCI terminal for Oracle:
  9. Check that Extract is working correctly:
    You should see an output similar to the following:
  10. Open the GGSCI terminal for CockroachDB:
  11. Check that Replicat is working correctly:
    You should see an output similar to the following:

Perform bulk replication

  1. Keep the Extract process running on Oracle and the Replicat process running for CockroachDB.
  2. In the source database, bulk insert some data:
  3. Run the status command on the Extract GGSCI terminal:
    You will see an output similar to the following:
  4. Run the status command on the Replicat GGSCI terminal: The number of inserts takes a few minutes to update. After the process finishes inserting and committing to the database, it will report back the final inserts. During the process, it will show the previous state:
    To verify that the insert is happening, you can run: SELECT COUNT(*) FROM public.testtable;. The query will hang while it’s still inserting.
  5. To track the status of an ongoing replication, view the report:

See also