- Data is migrated to the target .
- This approach utilizes .
- is achieved via failback replication.
Example scenario
You have a moderately-sized (500GB) database that provides the data store for a web application. You want to migrate the entirety of this database to a new CockroachDB cluster. You will divide this migration into four geographic regions (A, B, C, and D). The application runs on a Kubernetes cluster with an NGINX Ingress Controller. Your business could not accommodate major performance issues that could arise after the migration. Therefore, you want to enable failback replication so that you can easily return to using your original database with minimal interruption. Estimated system downtime: 3-5 minutes per region.Before the migration
- Install the tools.
- Review the and documentation.
- and .
- Recommended: Perform a dry run of this full set of instructions in a development environment that closely resembles your production environment. This can help you get a realistic sense of the time and complexity it requires.
- Understand the prerequisites and limitations of the MOLT tools:
Prerequisites
Oracle Instant Client
Install Oracle Instant Client on the machine that will runmolt and replicator. If using the MOLT Replicator binary (instead of Docker), the Oracle Instant Client libraries must be accessible at /usr/lib.
-
On macOS ARM machines, download the Oracle Instant Client. After installation, you should have a new directory at
/Users/$USER/Downloads/instantclient_23_3containing.dylibfiles. Set theLD_LIBRARY_PATHenvironment variable to this directory: -
On Linux machines, install the Oracle Instant Client dependencies and set the
LD_LIBRARY_PATHto the client library path:
Limitations
MOLT Fetch limitations
- Only tables with types of , , or can be sharded with .
-
GEOMETRYandGEOGRAPHYtypes are not supported. -
Migrations must be performed from a single Oracle schema. You must include so that MOLT Fetch only loads data from the specified schema. Refer to .
- Specifying is also strongly recommended to ensure that only necessary tables are migrated from the Oracle schema.
-
Oracle advises against
LONG RAWcolumns and recommends converting them toBLOB.LONG RAWcan only store binary values up to 2GB, and only oneLONG RAWcolumn per table is supported.
MOLT Replicator limitations
- Replication modes require connection to the primary instance (PostgreSQL primary, MySQL primary/master, or Oracle primary). MOLT cannot obtain replication checkpoints or transaction metadata from replicas.
- Running DDL on the source or target while replication is in progress can cause replication failures.
-
TRUNCATEoperations on the source are not captured. OnlyINSERT,UPDATE,UPSERT, andDELETEevents are replicated. - Changes to virtual columns are not replicated automatically. To migrate these columns, you must define them explicitly with .
- Replication will not work for tables or column names exceeding 30 characters. This is a limitation of Oracle LogMiner.
-
The following data types are not supported for replication:
- User-defined types (UDTs)
- Nested tables
VARRAYLONGBLOB/CLOBcolumns (over 4000 characters)
-
If your Oracle workload executes
UPDATEstatements that modify only LOB columns, theseUPDATEstatements are not supported by Oracle LogMiner and will not be replicated. -
If you are using Oracle 11 and execute
UPDATEstatements onXMLTYPEor LOB columns, those changes are not supported by Oracle LogMiner and will be excluded from ongoing replication. - If you are migrating LOB columns from Oracle 12c, use AWS DMS Binary Reader instead of LogMiner. Oracle LogMiner does not support LOB replication in 12c.
MOLT Verify limitations
- MOLT Verify compares 20,000 rows at a time by default, and row values can change between batches, potentially resulting in temporary inconsistencies in data. To configure the row batch size, use the
--row_batch_size. - MOLT Verify checks for collation mismatches on columns. This may cause validation to fail when a is used as a primary key and the source and target databases are using different .
- MOLT Verify might give an error in case of schema changes on either the source or target database.
- cannot yet be compared.
Step 1: Prepare the source database
In this step, you will:- Create a dedicated migration user on your source database.
- Configure the source database for replication.
Create migration user on source database
Create a dedicated migration user (for example,MIGRATION_USER) on the source database. This user is responsible for reading data from source tables during the migration. You will pass this username in the source connection string.
When migrating from Oracle Multitenant (PDB/CDB), this should be a common user. Prefix the username with
C## (e.g., C##MIGRATION_USER).SELECT and FLASHBACK the tables you plan to migrate. The tables should all reside in a single schema (for example, migration_schema). For details, refer to Schema and table filtering.
Oracle Multitenant (PDB/CDB) user privileges
Connect to the Oracle CDB as a DBA and grant the following:Single-tenant Oracle user privileges
Connect to the Oracle database as a DBA and grant the following:Configure source database for replication
Connect to the primary instance (PostgreSQL primary, MySQL primary/master, or Oracle primary), not a replica. Replicas cannot provide the necessary replication checkpoints and transaction metadata required for ongoing replication.
Enable ARCHIVELOG and FORCE LOGGING
EnableARCHIVELOG mode for LogMiner to access archived redo logs:
FORCE LOGGING to ensure all changes are logged:
Create source sentinel table
Create a checkpoint table calledREPLICATOR_SENTINEL in the Oracle schema you will migrate:
Grant LogMiner privileges
Grant LogMiner privileges. In Oracle Multitenant, grant the permissions on the CDB:- Query redo logs from LogMiner.
- Retrieve active transaction information to determine the starting point for ongoing replication.
- Update the internal
REPLICATOR_SENTINELtable created on the Oracle source schema by the DBA.
Verify LogMiner privileges
Query the locations of redo files in the Oracle database:Step 2: Prepare the target database
Define the target tables
Convert the source table definitions into CockroachDB-compatible equivalents. CockroachDB supports the PostgreSQL wire protocol and is largely .-
The source and target table definitions must match. Review to understand which source types can be mapped to CockroachDB types.
For example, an Oracle source table defined as
CREATE TABLE migration_schema.tbl (pk INT PRIMARY KEY);must have a corresponding schema and table in CockroachDB:- MOLT Fetch can automatically define matching CockroachDB tables using the option.
- If you define the target tables manually, review how MOLT Fetch handles . You can use the MOLT Schema Conversion Tool to create matching table definitions.
-
By default, table and column names are case-insensitive in MOLT Fetch. If using the flag, schema, table, and column names must match Oracle’s default uppercase identifiers. Use quoted names on the target to preserve case. For example, the following CockroachDB SQL statement will error:
It should be written as:When using
--case-sensitive, quote all identifiers and match the case exactly (for example, use"CO"."STORES"and"STORE_ID").
-
Every table must have an explicit primary key.
Avoid using sequential keys. To learn more about the performance issues that can result from their use, refer to the . If a sequential key is necessary in your CockroachDB table, you must create it manually, after using to load and replicate the data.
- Review to understand how computed columns and partitioned tables can be mapped to the target, and how target tables can be renamed.
-
By default on CockroachDB,
INTis an alias forINT8, which creates 64-bit signed integers. PostgreSQL and MySQL default to 32-bit integers. Depending on your source database or application requirements, you may need to change the integer size to4. For more information, refer to .
Schema Conversion Tool
The (SCT) converts source table definitions to CockroachDB-compatible syntax. It requires a free .-
Upload a source
.sqlfile to convert the syntax and identify in the table definitions. -
Import the converted table definitions to a CockroachDB cluster:
- When migrating to CockroachDB Cloud, the Schema Conversion Tool automatically .
- When migrating to a self-hosted CockroachDB cluster, and pipe the directly into .
Drop constraints and indexes
To optimize data load performance, drop all non-PRIMARY KEY and on the target CockroachDB database before migrating:
- (you do not need to drop this constraint when using
drop-on-target-and-recreatefor table handling)
Do not drop constraints.
Create the SQL user
Create a SQL user in the CockroachDB cluster that has the necessary privileges. To create a usercrdb_user in the default database (you will pass this username in the target connection string):
migration_schema schema and internal MOLT tables like _molt_fetch_exceptions in the public CockroachDB schema:
Ensure that you are connected to the target database.
drop-on-target-and-recreate will not be used), grant the following privileges on the schema:
public CockroachDB schema:
drop-on-target-and-recreate, and the target schema has pre-existing tables that were created by a different user, you may need to change table ownership to allow the migration user to drop those tables. Make the following alteration for each table:
IMPORT INTO or COPY FROM on the target tables:
IMPORT INTO privileges
Grant SELECT, INSERT, and DROP (required because the table is taken offline during the IMPORT INTO) privileges on all tables being migrated:
EXTERNALIOIMPLICITACCESS :
COPY FROM privileges
Grant privileges to the user:
Set session variable
Ensure that thestatement_timeout is set to 0s for the user:
Replication privileges
Grant permissions to create the staging schema for replication:Configure GC TTL
Before starting the initial data load, configure the on the source CockroachDB cluster to ensure that historical data remains available when replication begins. The GC TTL must be long enough to cover the full duration of the data load. Increase the GC TTL before starting the data load. For example, to set the GC TTL to 24 hours:The GC TTL duration must be higher than your expected time for the initial data load.
Migrate each phase
Steps 3-12 are run for each phase of the data migration. When migrating the first phase, you will run through these steps for Region A. You will repeat these steps for the other regions during each subsequent migration phase.Step 3: Load data into CockroachDB
In this step, you will:- Configure MOLT Fetch with the flags needed for your migration.
- Run MOLT Fetch.
- Understand how to continue a load after an interruption.
Configure MOLT Fetch
The includes detailed information about how to , and how to . When you runmolt fetch, you can configure the following options for data load:
- : Specify URL‑encoded source and target connections.
- : Specify schema and table names to migrate. Important for a phased migration.
- : Export data to cloud storage or a local file server.
- : Specifies whether data will only be loaded into/from intermediate storage.
- : Divide larger tables into multiple shards during data export.
- : Choose between
IMPORT INTOandCOPY FROM. - : Determine how existing target tables are initialized before load.
- : Define any row-level transformations to apply to the data before it reaches the target.
- : Configure metrics collection during initial data load.
molt fetch command and its flags. Follow , especially those related to security.
At minimum, the molt fetch command should include the source, target, data path, and flags. For a phased migration, you may also choose to include or flags:
Run MOLT Fetch
Perform the initial load of the source data.-
Issue the command to move the source data to CockroachDB. This example command passes the source and target connection strings as environment variables, writes intermediate files to S3 storage, and uses the
truncate-if-existstable handling mode to truncate the target tables before loading data. It also limits the migration to a single schema and filters three specific tables to migrate. The defaults toIMPORT INTO. The command assumes an Oracle Multitenant (CDB/PDB) source. specifies the container database (CDB) connection string. -
Check the output to observe
fetchprogress. Astarting fetchmessage indicates that the task has started:data extractionmessages are written for each table that is exported to the location in--bucket-path:data importmessages are written for each table that is loaded into CockroachDB:Afetch completemessage is written when the fetch task succeeds:This message shows the appropriate values for the--backfillFromSCNand--scnflags to use when starting Replicator:
Continue MOLT Fetch after an interruption
If MOLT Fetch fails while loading data into CockroachDB from intermediate files, it exits with an error message, fetch ID, and continuation token for each table that failed to load on the target database.- All data has been exported from the source database into intermediate files on or .
- The initial load of source data into the target CockroachDB database is incomplete.
- The load uses
IMPORT INTOrather thanCOPY FROM.
Only one fetch ID and set of continuation tokens, each token corresponding to a table, are active at any time. See .
Step 4: Verify the initial data load
In this step, you will use to confirm that the source and target data is consistent. This ensures that the data load was successful. Use MOLT Verify’s or to select only the tables that are relevant for the given phase.Run MOLT Verify
-
Run the command, specifying the source and target connection strings and the tables to validate.
With Oracle Multitenant deployments, while
--source-cdbis required forfetch, it is not necessary forverify. -
Check the output to observe
verifyprogress. Averification in progressindicates that the task has started:starting verifymessages are written for each specified table:Afinished row verificationmessage is written after each table is compared. Ifnum_successequalsnum_truth_rowsand the error counters (num_missing,num_mismatch,num_extraneous, andnum_column_mismatch) are all0, the table verified successfully. Any non-zero values in the error counters indicate data discrepancies that need investigation. For details on each field, refer to the page.Averification completemessage is written when the verify task succeeds:
Step 5: Finalize the target schema
Add constraints and indexes
Add any constraints or indexes that you previously removed from the CockroachDB schema to facilitate data load.If you used the
--table-handling drop-on-target-and-recreate option for data load, only and constraints are preserved. You must manually recreate all other constraints and indexes.Step 6: Begin forward replication
In this step, you will:- Configure MOLT Replicator with the flags needed for your migration.
- Start MOLT Replicator.
- Understand how to continue replication after an interruption.
Configure MOLT Replicator (forward replication)
When you runreplicator, you can configure the following options for replication:
- Replication connection strings: Specify URL-encoded source and target database connections.
- Replicator flags: Specify required and optional flags to configure replicator behavior.
- Tuning parameters: Optimize replication performance and resource usage.
- Replicator metrics: Monitor replication progress and performance.
Replication connection strings
MOLT Replicator uses--sourceConn and --targetConn to specify the source and target database connections.
--sourceConn specifies the connection string of the source database:
--sourcePDBConn with the PDB connection string:
--targetConn specifies the target CockroachDB connection string:
Replicator flags
Configure the following flags for continuous replication. For details on all available flags, refer to .| Flag | Description |
|---|---|
Required. Oracle user that owns the tables to replicate. Oracle capitalizes identifiers by default, so use uppercase (for example, MIGRATION_USER). | |
Required. Target schema name on CockroachDB where tables will be replicated. Schema name must be fully qualified in the format database.schema. | |
| Required. Snapshot System Change Number (SCN) for the initial changefeed starting point. | |
| Required. SCN of the earliest active transaction at the time of the snapshot. Ensures no transactions are skipped. | |
Required. Staging schema name on CockroachDB for replication metadata and checkpoints. Schema name must be fully qualified in the format database.schema. | |
| Automatically create the staging schema if it does not exist. Include this flag when starting replication for the first time. | |
Enable Prometheus metrics at a specified {host}:{port}. Metrics are served at http://{host}:{port}/_/varz. | |
| Path to a that enables data filtering, routing, or transformations. For examples, refer to . |
replication-only mode should include the following replicator flags after the initial data load completes.
Tuning parameters
Configure the following to optimize replication throughput and resource usage. Test different combinations in a pre-production environment to find the optimal balance of stability and performance for your workload.The following parameters apply to PostgreSQL, Oracle, and CockroachDB (failback) sources.
| Flag | Description |
|---|---|
| Control the maximum number of concurrent target transactions. Higher values increase throughput but require more target connections. Start with a conservative value and increase based on target database capacity. | |
| Balance throughput and latency. Controls how many mutations are batched into each query to the target. Increase for higher throughput at the cost of higher latency. | |
| Control memory usage during operation. Increase to allow higher throughput at the expense of memory; decrease to apply backpressure and limit memory consumption. | |
| Set larger than by a safety factor to avoid exhausting target pool connections. Replicator enforces setting parallelism to 80% of this value. | |
| Reduce the number of queries to the target by combining multiple mutations on the same primary key within each batch. Disable only if exact mutation order matters more than end state. | |
| Improve apply throughput for independent tables and table groups that share foreign key dependencies. Increases memory and target connection usage, so ensure you increase or reduce . | |
Set to the maximum allowable time between flushes (for example, 10s if data must be applied within 10 seconds). Works with to control when buffered mutations are committed to the target. | |
| Lower this value if constraint violations resolve quickly on your workload to make retries more frequent and reduce latency. Do not lower if constraint violations take time to resolve. | |
Applies to (replicator start) scenarios only. Balance memory usage and throughput. Increase to read more rows at once from the CockroachDB staging cluster for higher throughput, at the cost of memory pressure. Decrease to reduce memory pressure and increase stability. |
Replicator metrics
MOLT Replicator metrics are not enabled by default. Enable Replicator metrics by specifying the flag with a port (orhost:port) when you start Replicator. This exposes Replicator metrics at http://{host}:{port}/_/varz. For example, the following flag exposes metrics on port 30005:
Start MOLT Replicator (forward replication)
With initial load complete, start replication of ongoing changes on the source to CockroachDB using .MOLT Fetch captures a consistent point-in-time checkpoint at the start of the data load (shown as
cdc_cursor in the fetch output). Starting replication from this checkpoint ensures that all changes made during and after the data load are replicated to CockroachDB, preventing data loss or duplication. The following steps use the checkpoint values from the fetch output to start replication at the correct position.replicator command, specifying the backfill and starting SCN from the checkpoint recorded during data load. Use --stagingSchema to specify a unique name for the staging database, and include --stagingCreateSchema to have MOLT Replicator automatically create the staging database. If you filtered tables during the initial load, and specify the path with --userscript.
When , replication performance may decrease because filtered tables are still included in LogMiner queries and processed before being discarded.
Check that replication is working
Verify that Replicator is processing changes successfully. To do so, check the MOLT Replicator logs. Since you enabled debug logging with-v, you should see connection and row processing messages:
When transactions are read from the Oracle source, you should see registered transaction IDs (XIDs):
Continue MOLT Replicator after an interruption (forward replication)
Run theoraclelogminer command using the same --stagingSchema value from your initial replication command.
Replicator will automatically find the correct restart SCN (System Change Number) from the _oracle_checkpoint table in the staging schema. The restart point is determined by the non-committed row with the smallest startscn column value.
When , replication performance may decrease because filtered tables are still included in LogMiner queries and processed before being discarded.
http://localhost:30005/_/varz to track replication progress.
Step 7: Stop application traffic
Once the inital data load has been verified and the target schema has been finalized, it’s time to begin the cutover process. First, stop application traffic to the source for this particular region. If the Kubernetes cluster that deploys the application has pre-region deployments (for example,app-us, app-eu, app-apac), you can scale down only the deployment for that region.
Application downtime begins now, for users in the given region.It is strongly recommended that you perform a dry run of this migration in a test environment. This will allow you to practice using the MOLT tools in real time, and it will give you an accurate sense of how long application downtime might last.
Step 8: Stop forward replication
Before you can cut over traffic to the target, the changes to the source database need to finish being written to the target. Once the source is no longer receiving write traffic, MOLT Replicator will take some seconds to finish replicating the final changes. This is known as drainage.-
Wait for replication to drain, which means that all transactions that occurred on the source database have been fully processed and replicated. There are several ways to determine that replication has fully drained:
-
When replication is caught up, you will not see new
upserted rowslogs. -
If you set up the replication metrics endpoint with in the preceding steps, metrics are available at:
Use the following Prometheus alert expression to observe when the combined rate of upserts and deletes is
0for each schema: - You can also check Prometheus metrics associated with replication lag, including .
-
When replication is caught up, you will not see new
-
Cancel replication by entering
ctrl-cto issue aSIGTERMsignal. This returns an exit code0.
Step 9: Verify the replicated data
Repeat Step 4 to verify the updated data.Step 10: Begin failback replication
In this step, you will:- Prepare both databases for failback replication
- Configure MOLT Replicator with the flags needed for your migration.
- Start MOLT Replicator.
- Understand how to continue replication after an interruption.
Prepare your source and target databases for failback replication
Prepare the CockroachDB cluster
If you are migrating to a CockroachDB self-hosted cluster, on the cluster:The following settings can impact source cluster performance and stability, especially SQL foreground latency during writes. For details, refer to .
Grant target database user permissions
You should have already created a migration user on the target database (your original source database) with the necessary privileges. Refer to Create migration user on source database. For failback replication, grant the user additional privileges to write data back to the target database:Create a CockroachDB changefeed
On the target cluster, create a CockroachDB changefeed to send changes to MOLT Replicator.-
Get the current logical timestamp from CockroachDB, after ensuring that forward replication has fully drained:
-
Create the CockroachDB changefeed pointing to the MOLT Replicator webhook endpoint. Use
cursorto specify the logical timestamp from the preceding step. For details on the webhook sink URI, refer to .The webhook URL path specifies the schema name on the target Oracle database. Oracle capitalizes identifiers by default. For example,Explicitly set a default10svalue in theCREATE CHANGEFEEDstatement. This value ensures that the webhook can report failures in inconsistent networking situations and make crash loops more visible./MIGRATION_SCHEMAroutes changes to theMIGRATION_SCHEMAschema.The output shows the job ID: -
Monitor the changefeed status, specifying the job ID:
To confirm the changefeed is active and replicating changes to the target database, check that
statusisrunningandrunning_statusshowsrunning: resolved={timestamp}.running: resolvedmay be reported even if data isn’t being sent properly. This typically indicates incorrect host/port configuration or network connectivity issues. -
Verify that Replicator is reporting incoming HTTP requests from the changefeed. To do so, check the MOLT Replicator logs. Since you enabled debug logging with
-v, you should see periodic HTTP request successes:These debug messages confirm successful changefeed connections to MOLT Replicator. You can disable verbose logging after verifying the connection.
Configure MOLT Replicator (failback replication)
When you runreplicator, you can configure the following options for replication:
- Connection strings: Specify URL‑encoded source and target connections.
- TLS certificate and key: Configure secure TLS connections.
- Replicator flags: Specify required and optional flags to configure replicator behavior.
- Tuning parameters: Optimize failback performance and resource usage.
- Replicator metrics: Monitor failback replication performance.
Replication connection strings
MOLT Replicator uses--sourceConn and --targetConn to specify the source and target database connections.
For MOLT Replicator, the source is always the replication source, while the target is always the replication target. This is distinct from the migration source and target. In the case of this example migration, the new CockroachDB cluster is the migration target, but because failback replication moves data from the migration target back to the migration source, the replication target is the original source database. In essence, the
--sourceConn and --targetConn strings should be reversed for failback replication.--sourceConn specifies the connection string of the CockroachDB cluster:
--targetConn specifies the original source database:
Secure connections
-
To keep your database credentials out of shell history and logs, follow these best practices when specifying your source and target connection strings:
- Avoid plaintext connection strings.
-
Provide your connection strings as environment variables. For example:
Afterward, reference the environment variables in MOLT commands:
- If possible, use an external secrets manager to load the environment variables from stored secrets.
-
Use TLS-enabled connection strings to encrypt data in transit from MOLT to the database. When using TLS certificates, ensure certificate files are accessible to the MOLT binary on the same machine.
For example, a PostgreSQL connection string with TLS certificates:
-
URL-encode connection strings for the source database and so special characters in passwords are handled correctly.
-
Given a password
a$52&, pass it to themolt escape-passwordcommand with single quotes:Use the encoded password in your connection string. For example:
-
Given a password
-
Remove
sslmode=disablefrom production connection strings.
TLS certificate and key
Always use secure TLS connections for failback replication to protect data in transit. Do not use insecure configurations in production: avoid the--disableAuthentication and --tlsSelfSigned Replicator flags and insecure_tls_skip_verify=true query parameter in the changefeed webhook URI.
Generate self-signed TLS certificates or certificates from an external CA. Ensure the TLS server certificate and key are accessible on the MOLT Replicator host machine via a relative or absolute file path. When you start failback with Replicator, specify the paths with --tlsCertificate and --tlsPrivateKey. For example:
replicator command. This ensures proper TLS handshake between the changefeed and MOLT Replicator. To include client certificates in the changefeed webhook URL, encode them with base64 and then URL-encode the output with jq:
client_cert, client_key, and ca_cert are :
Replicator flags
| Flag | Description |
|---|---|
Required. Staging schema name on CockroachDB for the changefeed checkpoint table. Schema name must be fully qualified in the format database.schema. | |
Required. Network address to bind the webhook sink for the changefeed. For example, :30004. | |
| Path to the server TLS certificate for the webhook sink. Refer to TLS certificate and key. | |
| Path to the server TLS private key for the webhook sink. Refer to TLS certificate and key.Q | |
Enable Prometheus metrics at a specified {host}:{port}. Metrics are served at http://{host}:{port}/_/varz. | |
| Path to a that enables data filtering, routing, or transformations. For examples, refer to . |
- The staging schema is first created during with .
- When configuring a secure changefeed for failback, you must include and , which specify the paths to the server certificate and private key for the webhook sink connection.
Tuning parameters
Configure the following to optimize replication throughput and resource usage. Test different combinations in a pre-production environment to find the optimal balance of stability and performance for your workload.The following parameters apply to PostgreSQL, Oracle, and CockroachDB (failback) sources.
| Flag | Description |
|---|---|
| Control the maximum number of concurrent target transactions. Higher values increase throughput but require more target connections. Start with a conservative value and increase based on target database capacity. | |
| Balance throughput and latency. Controls how many mutations are batched into each query to the target. Increase for higher throughput at the cost of higher latency. | |
| Control memory usage during operation. Increase to allow higher throughput at the expense of memory; decrease to apply backpressure and limit memory consumption. | |
| Set larger than by a safety factor to avoid exhausting target pool connections. Replicator enforces setting parallelism to 80% of this value. | |
| Reduce the number of queries to the target by combining multiple mutations on the same primary key within each batch. Disable only if exact mutation order matters more than end state. | |
| Improve apply throughput for independent tables and table groups that share foreign key dependencies. Increases memory and target connection usage, so ensure you increase or reduce . | |
Set to the maximum allowable time between flushes (for example, 10s if data must be applied within 10 seconds). Works with to control when buffered mutations are committed to the target. | |
| Lower this value if constraint violations resolve quickly on your workload to make retries more frequent and reduce latency. Do not lower if constraint violations take time to resolve. | |
Applies to (replicator start) scenarios only. Balance memory usage and throughput. Increase to read more rows at once from the CockroachDB staging cluster for higher throughput, at the cost of memory pressure. Decrease to reduce memory pressure and increase stability. |
Replicator metrics
MOLT Replicator metrics are not enabled by default. Enable Replicator metrics by specifying the flag with a port (orhost:port) when you start Replicator. This exposes Replicator metrics at http://{host}:{port}/_/varz. For example, the following flag exposes metrics on port 30005:
Start MOLT Replicator (failback replication)
With initial load complete, start replication of ongoing changes on the source to CockroachDB using .MOLT Fetch captures a consistent point-in-time checkpoint at the start of the data load (shown as
cdc_cursor in the fetch output). Starting replication from this checkpoint ensures that all changes made during and after the data load are replicated to CockroachDB, preventing data loss or duplication. The following steps use the checkpoint values from the fetch output to start replication at the correct position.start command to begin failback replication from CockroachDB to your source database. In this example, --metricsAddr :30005 enables a Prometheus endpoint for monitoring replication metrics, and --bindAddr :30004 sets up the webhook endpoint for the changefeed.
--stagingSchema specifies the staging database name (defaultdb._replicator in this example) used for replication checkpoints and metadata. This staging database was created during initial forward replication when you first ran MOLT Replicator with --stagingCreateSchema.
Continue MOLT Replicator after an interruption (failback replication)
Run theoraclelogminer command using the same --stagingSchema value from your initial replication command.
Replicator will automatically find the correct restart SCN (System Change Number) from the _oracle_checkpoint table in the staging schema. The restart point is determined by the non-committed row with the smallest startscn column value.
When , replication performance may decrease because filtered tables are still included in LogMiner queries and processed before being discarded.
http://localhost:30005/_/varz to track replication progress.
Step 11: Cut over application traffic
With the target cluster verified and finalized, it’s time to resume application traffic for the current migration phase.Modify application code
In the application back end, update the application to route traffic for this migration phase to the CockroachDB cluster. A simple example:Resume application traffic
If you halted traffic by scaling down a regional Kubernetes deployment, scale it back up.Step 12: Stop failback replication
After traffic has been cut over to the target, you can maintain failback replication indefinitely. Once you decide that you want to use the CockroachDB cluster as your sole data store going forward, you can end failback replication with the following steps.-
Wait for replication to drain, which means that all transactions that occurred on the source database have been fully processed and replicated. There are several ways to determine that replication has fully drained:
-
When replication is caught up, you will not see new
upserted rowslogs. -
If you set up the replication metrics endpoint with in the preceding steps, metrics are available at:
Use the following Prometheus alert expression to observe when the combined rate of upserts and deletes is
0for each schema: - You can also check Prometheus metrics associated with replication lag, including .
-
When replication is caught up, you will not see new
-
Cancel replication by entering
ctrl-cto issue aSIGTERMsignal. This returns an exit code0.

