molt fetch
Bulk data migration from source databases (PostgreSQL, MySQL, Oracle, MSSQL) to CockroachDB.
Basic Structure
Storage Backends (pick one)
Cloud auth: pass --use-implicit-auth for IAM/ADC/managed identity, or set AWS_ACCESS_KEY_ID/GOOGLE_APPLICATION_CREDENTIALS env vars.
Table Handling (--table-handling)
Import Mode
IMPORT INTO (default): Table goes OFFLINE during load. Highest throughput.
COPY FROM (--use-copy): Table stays ONLINE. Use with --direct-copy. Cannot use compression.
Key Flags
Source-Specific Prerequisites
MySQL: GTID mode required (gtid_mode=ON, enforce_gtid_consistency=ON). ONLY_FULL_GROUP_BY must be off. Or use --ignore-replication-check.
Oracle: Binary must be built with CGO_ENABLED=1 -tags="cgo source_all". Oracle Instant Client in LD_LIBRARY_PATH.
PostgreSQL: Replication privileges needed, or --ignore-replication-check.
Common Workflows
1. Full migration with schema creation
drop-on-target-and-recreate drops any existing target tables first; run this only against a fresh or empty target.
2. Resume after failure
Error Recovery
Gotchas
- COPY mode: cannot use
--compression gzip; must use--compression none(or omit, default is none with copy) - Table is offline during IMPORT INTO — use
--use-copyfor zero downtime - Schema changes between runs require starting from scratch
--fetch-idcontinuation tokens live in the target's exceptions table- For MySQL,
--ignore-replication-checkskips GTID validation but replication-dependent features won't work - After fetch, run
molt verifyto confirm data integrity
See flags reference [blocked] for the full flag list.


