# Migration Overview

The MOLT (Migrate Off Legacy Technology) toolkit enables safe, minimal-downtime database migrations to CockroachDB. MOLT combines schema transformation, distributed data load, continuous replication, and row-level validation into a highly configurable workflow that adapts to diverse production environments.

This page provides an overview of the following:

- Overall migration sequence
- MOLT tools
- Supported migration flows

## Migration sequence

Tip:

Before you begin the migration, review Migration Strategy.

A migration to CockroachDB generally follows this sequence:

1. Prepare the source database: Configure users, permissions, and replication settings as needed.
2. Convert the source schema: Use the Schema Conversion Tool to generate CockroachDB-compatible DDL. Apply the converted schema to the target database. Drop constraints and indexes to facilitate data load.
3. Load data into CockroachDB: Use MOLT Fetch to bulk-ingest your source data.
4. (Optional) Verify consistency before replication: Use MOLT Verify to confirm that the data loaded into CockroachDB is consistent with the source.
5. Finalize target schema: Recreate indexes or constraints on CockroachDB that you previously dropped to facilitate data load.
6. Replicate ongoing changes: Enable continuous replication with MOLT Replicator to keep CockroachDB in sync with the source.
7. Verify consistency before cutover: Use MOLT Verify to confirm that the CockroachDB data is consistent with the source.
8. Cut over to CockroachDB: Redirect application traffic to the CockroachDB cluster.

For more details, refer to Migration flows.

## MOLT tools

MOLT (Migrate Off Legacy Technology) is a set of tools for schema conversion, data load, replication, and validation. Migrations with MOLT are resilient, restartable, and scalable to large data sets.

MOLT Fetch, Replicator, and Verify are CLI-based to maximize control, automation, and visibility during the data load and replication stages.

Tool | Usage | Tested and supported sources | Release status
--- | --- | --- | ---
Schema Conversion Tool | Schema conversion | PostgreSQL, MySQL, Oracle, SQL Server | GA (Cloud only)
Fetch | Initial data load | PostgreSQL 11-16, MySQL 5.7-8.0+, Oracle Database 19c (Enterprise Edition) and 21c (Express Edition), CockroachDB | GA
Replicator | Continuous replication | CockroachDB, PostgreSQL 11-16, MySQL 5.7+ and 8.0+, Oracle Database 19c+ | GA
Verify | Schema and data validation | PostgreSQL 12-16, MySQL 5.7-8.0+, Oracle Database 19c (Enterprise Edition) and 21c (Express Edition), CockroachDB | Preview

Note:

For CockroachDB-to-CockroachDB migrations, contact your account team for guidance.

### Schema Conversion Tool

The MOLT Schema Conversion Tool converts a source database schema to a CockroachDB-compatible schema. The tool performs the following actions:

- Identifies unimplemented features.
- Rewrites unsupported DDL syntax.
- Applies CockroachDB schema best practices.

### Fetch

MOLT Fetch performs the initial data load to CockroachDB. It supports:

- Multiple migration flows via `IMPORT INTO` or `COPY FROM`.
- Data movement via cloud storage, local file servers, or direct copy.
- Concurrent data export from multiple source tables and shards.
- Schema transformation rules.
- After exporting data with `IMPORT INTO`, safe continuation to retry failed or interrupted tasks from specific checkpoints.

### Replicator

MOLT Replicator provides continuous replication capabilities for minimal-downtime migrations. It supports:

- Continuous replication from source databases to CockroachDB.
- Multiple consistency modes for balancing throughput and transactional guarantees.
- Failback replication from CockroachDB back to source databases.
- Performance tuning for high-throughput workloads.

### Verify

MOLT Verify checks for data and schema discrepancies between the source database and CockroachDB. It performs the following verifications:

- Table structure.
- Column definition.
- Row-level data.

## Migration flows

MOLT supports various migration flows using MOLT Fetch for data loading and MOLT Replicator for ongoing replication.

Migration flow | Tools | Description | Best for
--- | --- | --- | ---
Bulk load | MOLT Fetch | Perform a one-time bulk load of source data into CockroachDB. | Testing, migrations with planned downtime
Data load and replication | MOLT Fetch + MOLT Replicator | Load source data with Fetch, then replicate subsequent changes continuously with Replicator. | Minimal downtime migrations
Resume replication | MOLT Replicator | Resume replication from a checkpoint after interruption. | Resuming interrupted migrations, post-load sync
Failback | MOLT Replicator | Replicate changes from CockroachDB back to the source database. | Rollback scenarios

### Bulk load

For migrations that tolerate downtime, use MOLT Fetch in `data-load` mode to perform a one-time bulk load of source data into CockroachDB. Refer to Bulk Load.

### Migrations with minimal downtime

To minimize downtime during migration, use MOLT Fetch for initial data loading followed by MOLT Replicator for continuous replication. Instead of loading all data during a planned downtime window, you can run an initial load followed by continuous replication. Writes are paused only briefly to allow replication to drain before the final cutover. The duration of this pause depends on the volume of write traffic and the replication lag between the source and CockroachDB.

Refer to Load and Replicate for detailed instructions.

### Recovery and rollback strategies

If the migration is interrupted or cutover must be aborted, MOLT Replicator provides safe recovery options:

- Resume a previously interrupted replication stream. Refer to Resume Replication.
- Use failback mode to reverse the migration, synchronizing changes from CockroachDB back to the original source. This ensures data consistency on the source so that you can retry the migration later. Refer to Migration Failback.

## See also

- Migration Strategy
- MOLT Releases