Replicate data from MongoDB to OCI GoldenGate
Learn to replicate data from MongoDB to Autonomous AI JSON Database using OCI GoldenGate.
Autonomous AI 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 AI Database API for MongoDB), serverless scaling, high performance ACID transactions, comprehensive security, and low pay-per-use pricing. Learn more about Autonomous AI JSON Database.
The OCI GoldenGate Big Data deployment type supports no down-time migrations from MongoDB to Autonomous AI 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 AI JSON Database.
Before you begin
To successfully complete this quickstart, 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.
-
Create connection for target Create an Autonomous AI JSON Database connection.
-
Create a connection to GoldenGate, and then assign this connection to the Big Data deployment.
-
Assign MongoDB and Autonomous AI JSON Database to the Big Data deployment.
Task 2: Create and run the Integrated Extract for MongoDB
-
In the OCI GoldenGate deployment console, ensure that you're on the Extracts page, and then select Add Extract (plus icon).
-
Add an Extract with the following values:
-
On the Extract Information page, under Extract type, select Integrated Extract, enter
MCDCas a Process Name, and then select Next. -
On the Parameter File page, ensure the source mapping includes
TABLE source.*;.
-
-
Select Create and Run.
Task 3: Create and run the Initial Load Extract for MongoDB
-
In the OCI GoldenGate deployment console, ensure that you're on the Extracts page, and then select Add Extract (plus icon).
-
Add an Extract with the following values:
-
On the Extract Information page:
-
For Extract Type, select Initial Load Extract.
-
For for Process Name, enter
MIL.
-
-
On the Parameter File page, make the following changes:
-
Locate the
EXTTRAILline and replace$extfilePathwith 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.
-
-
Select 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
-
In the OCI GoldenGate deployment console, ensure that you're on the Replicats page, and then select Add Replicat (plus icon).
-
Add the Initial Load Replicat with the following values:
-
On the Add Replicat page, under Replicat type, select Classic, enter a Process Name, and then select Next.
-
On the Replication Options page:
-
For Name, enter the name of the Trail from Task 3 (
I1). -
For Domain, select a domain.
-
For Alias, select the Autonomous AI JSON Database connection connection created in Task 1.
-
For Checkpoint Table, select the checkpoint table you created for the target deployment.
-
-
On the Managed Options page, leave the fields as they are, and select Next.
-
On the Replicat Parameters page, you can specify parameters to further configure your Replicat:
MAP *.*, TARGET *.*;
-
-
Select Create and Run:
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 Classic Replicat
-
In the OCI GoldenGate deployment console, ensure that you're on the Replicats page, and then select Add Replicat (plus icon).
-
Add a Replicat with the following values:
-
On the Replicat Information page, under Replicat type, select Classic Replicat, enter
MCDCas a Process Name, and then select Next. -
On the Parameter File page, you specify parameters to further configure your Replicat, and then select Create and Run:
HANDLECOLLISIONS MAP *.*, TARGET *.*;Note: Add
HANDLECOLLISIONSto resolve the issues with duplicate or missing records while applying the replicat.HANDLECOLLISIONSparameter 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, removeHANDLECOLLISIONSand 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.