Replicate data from MongoDB to Autonomous JSON Database

Learn to replicate data from MongoDB to Autonomous JSON Database using OCI GoldenGate.

Oracle Autonomous JSON Database is a cloud document database service that makes it simple to develop JSON-centric applications. It features NoSQL-style document APIs (Oracle SODA and Oracle Database API for MongoDB), serverless scaling, high performance ACID transactions, comprehensive security, and low pay-per-use pricing. Learn more about Autonomous JSON Database.

The OCI GoldenGate Big Data deployment type supports no down-time migrations from MongoDB to Autonomous JSON Database. OCI GoldenGate supports both Initial Load Extract and Change Data Capture (CDC) extract from MongoDB.

This quickstart details the process to configure OCI GoldenGate for no down-time migrations from MongoDB to Autonomous JSON Database.

Before you begin

To successfully complete this quicktart, you must have the following:

  • MongoDB replica set configured.
    • OCI GoldenGate Big Data capture uses operations log (oplog) to read the CDC records. The oplog is a capped collection that keeps a rolling record of all operations that modify the data stored in your databases. Oplog files are created in MongoDB when Replicat set is enabled. MongoDB Atlas comes with a preconfigured Replicat set configuration. For on premises MongoDB, you need to deploy a replica set.
  • MongoDB 3.6 & later.
  • OCI GoldenGate support for capture of following operations: INSERT, UPDATE, DELETE.

To learn more, see Using Oracle GoldenGate Capture for MongoDB.

Task 1: Create the OCI GoldenGate resources

This quickstart example requires deployments and connections for both the source and target.
  1. Create an Oracle Autonomous JSON Database.
  2. Create a Big Data deployment for the source MongoDB and target Oracle Autonomous JSON Database.
  3. Create a MongoDB connection.
  4. Create connection for target Create an Autononous JSON Database connection.
  5. Create a connection to GoldenGate, and then assign this connection to the Big Data deployment.
  6. Assign MongoDB and Autonomous JSON connections to the Big Data deployment.

Task 2: Create and run the Integrated Extract for MongoDB

  1. In the OCI GoldenGate deployment console, ensure that you're on the Administration Service Overview page, and then click Add Extract (plus icon).
  2. Add an Extract with the following values:
    1. On the Extract Information page, under Extract type, select Integrated Extract, enter MCDC as a Process Name, and then click Next.
    2. On the Parameter File page, ensure the source mapping includes TABLE source.*;.
  3. Click Create and Run.

Task 3: Create and run the Initial Load Extract for MongoDB

  1. In the OCI GoldenGate deployment console, ensure that you're on the Administration Service Overview page, and then click Add Extract (plus icon).
  2. Add an Extract with the following values:
    1. On the Extract Information page:
      • For Extract Type, select Initial Load Extract.
      • For for Process Name, enter MIL.
    2. On the Parameter File page, make the following changes:
      • Locate the EXTTRAIL line and replace $extfilePath with your trail name. For example:
        EXTFILE I1
      • Define the source mapping as TABLE source.*;.
        Note

        This is the source database/collection mapping. TABLE *.* results in extracting from all the databases/collections.
  3. Click Create and Run.

    When MongoDB Initial Load Extract runs successfully, you will see the statistics in the extract report file.

Task 4: Create and run the Initial Load Replicat

  1. In the OCI GoldenGate deployment console, ensure that you're on the Administration Service Overview page, and then click Add Replicat (plus icon).
  2. Add the Initial Load Replicat.
  3. On the Add Replicat page, under Replicat type, select either Classic or Coordinated, and then click Next.
  4. On the Replicat Options page, complete the following form fields, and then click Next:
    1. For Process Name, enter a name, such as RIL.
    2. For Trail Name, enter the name of the Trail from Task 3 (I1).
    3. For Target, select the target ORACLE_AUTONOMOUS_JSON_DATABASE from the dropdown.
    4. For Available Aliases, select Autonomous JSON connection from the dropdown.
  5. On the Replicat Parameters page, you can specify parameters to further configure your Replicat, and then click Create and Run:
    MAP *.*, TARGET *.*;
You return to the Overview page, where you can review the Replicat details. When Replicat starts successfully, you'll see it in a running state with a green check. You can review the Replicat details and statistics to confirm the replication.

Task 5: Create and run the Coordinated Replicat

  1. In the OCI GoldenGate deployment console, ensure that you're on the Administration Service Overview page, and then click Add Replicat (plus icon).
  2. Add a Replicat with the following values:
    1. On the Replicat Information page, under Replicat type, select Coordinated Replicat, enter MCDC as a Process Name, and then click Next.
    2. On the Parameter File page, you specify parameters to further configure your Replicat, and then click Create and Run:
      HANDLECOLLISIONS
      MAP *.*, TARGET *.*;
      Note

      Add HANDLECOLLISIONS to resolve the issues with duplicate or missing records while applying the replicat.

      HANDLECOLLISIONS parameter has a negative impact on the performance and that’s why it is recommended to use as needed. When your source & target is synced, you can stop the CDC replicat, remove HANDLECOLLISIONS and re-start the replicat.

You return to the Overview page, where you can review the Replicat details. When Replicat starts successfully, you'll see it in a running state with a green check. You can check the Replicat details and statistics confirm the replication.