Migrate MongoDB to Oracle
Beta — live-tested pathThe converter maps 15 MongoDB column types to Oracle. 6 of them change kind on the way (ObjectId becomes VARCHAR2(24 CHAR), Boolean becomes NUMBER(1), Array becomes CLOB, and more); the table below lists every one. Documents become rows: the schema is inferred by sampling the collection, and nested data lands in JSON columns. DBShifts creates the inferred tables, copies the documents in parallel batches and checks the result with row counts.
Free tier · no credit card
MongoDB vs Oracle
MongoDB
the leading document database.
Oracle
Oracle Database, the long-standing enterprise standard.
MongoDB to Oracle data type mapping
Pulled directly from DBShifts's own conversion rules — not a general reference table, this is what actually runs.
| MongoDB | Oracle |
|---|---|
| ObjectId (_id) | VARCHAR2(24 CHAR) |
| String | VARCHAR2(n CHAR) or CLOB |
| Int32 / Int64 | NUMBER(19) |
| Double | BINARY_DOUBLE |
| Decimal128 | NUMBER(38,9) |
| Boolean | NUMBER(1) |
| Date | TIMESTAMP |
| Embedded document / Array | CLOB |
| Binary | BLOB |
Example: MongoDB to Oracle conversion
MongoDB
{
_id: ObjectId("64f1b2c3d4e5f6a7b8c9d0e1"),
name: "Ada Lovelace",
is_active: true,
created_at: ISODate("2026-01-15T00:00:00Z")
}Oracle
CREATE TABLE "users" (
"_id" VARCHAR2(24 CHAR),
"name" VARCHAR2(64 CHAR),
"is_active" NUMBER(1),
"created_at" TIMESTAMP,
CONSTRAINT pk_users PRIMARY KEY ("_id")
);String sizes come from the sample
A string field becomes VARCHAR2 sized from the sampled values, up to 4,000 characters, or CLOB beyond that. If the sample saw only short values and a longer one exists elsewhere in the collection, that document fails with ORA-12899 at load time.
Free-text fields deserve a check before the load: an aggregation taking $max of $strLenCP on each one, with $ifNull for documents that lack it, finds the longest value. Fields near the limit are safer forced to CLOB from the start.
Empty strings and booleans
MongoDB distinguishes an empty string from a missing field and from null. Oracle stores '' as NULL, so all three end up as the same NULL, and a query for documents whose field was empty finds nothing afterwards.
Boolean becomes NUMBER(1), holding 0 or 1. Oracle before 23ai has no boolean column, and queries test is_active = 1 rather than the bare field.
Arrays and subdocuments become CLOB
Nested data is stored as JSON text in a CLOB. Oracle's JSON_VALUE reads a single value and JSON_TABLE turns an array into rows, both available since 12c. A CLOB cannot be compared with = or used in ORDER BY, so a nested field that has to be filtered or sorted on is better pulled out into its own column.
MongoDB → Oracle conversion notes
Engine-specific rules baked into the conversion and transfer pipeline — verified by live certification of this exact pair.
- Schema is inferred by sampling documents — null values don't poison type inference (a nullable int stays an int column).
- Decimal128 maps to exact DECIMAL on SQL targets, never a float round-trip.
- Nested documents and arrays land as JSON/JSONB columns with data preserved byte-for-byte.
- _id becomes the primary key; ObjectId converts to its 24-character hex form.
- CHAR columns use character semantics, so multi-byte UTF-8 doesn't overflow byte-sized columns.
- Booleans land as NUMBER(1) with values bound as integers (Oracle drivers can't bind Python booleans to NUMBER).
- DROP TABLE … CASCADE CONSTRAINTS wrappers handle re-runs without manual cleanup.
Frequently asked questions
Is MongoDB to Oracle migration production-ready in DBShifts?
MongoDB to Oracle is in beta. It runs on real servers in the certification suite, which checks it by row counts; the content checks that certify the SQL pairs do not yet compare documents with rows. Every migration still ends with a fidelity report to audit before cutover.
What happens to MongoDB types that Oracle doesn't have?
Each gets the nearest Oracle type the converter treats as safe: ObjectId becomes VARCHAR2(24 CHAR), Boolean becomes NUMBER(1), Array becomes CLOB, Object / subdocument becomes CLOB, UUID becomes VARCHAR2(36 CHAR). Every such decision is in the migration plan before anything runs, and any mapping can be overridden per column.
Can I keep MongoDB and Oracle in sync after the initial migration?
Yes, until you cut over. DBShifts follows a change stream from a resume token taken before the first document is copied. Change streams need a replica set or a sharded cluster; a standalone server cannot stream.
Which MongoDB data types need a second look when moving to Oracle?
The table above carries a note on 5 of them: ObjectId (VARCHAR2(24 CHAR)), Decimal128 (NUMBER(38,9)), Array (CLOB), Object / subdocument (CLOB) and more. Analysis flags the same columns on your own schema before any data moves.
Go deeper
Migrating MongoDB to SQL (and Back) Without Losing Your Schema
How relational structure is inferred from collections, and what happens to Decimal128 and nested documents.
How We Live-Certified All 49 Migration Paths
The certification harness behind this page's claims.
Database Porting: What Actually Has to Move When You Change DBMS
The five jobs in a port — schema, data, application SQL, database code, behaviour — and how hard each pair is.
Reference
Compared with other tools
Ready to move MongoDB to Oracle?
Set up in under two minutes. Validation and rollback included.
Start Free Migration