OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Best Practices

All Versions

  • Deploy
    • Configuration guide for read-write splitting in AP scenarios
    • Best practices for read-write splitting
  • Migrate
    • Data transfer solutions in OceanBase Database
    • Overview on data migration
    • Best practices for importing data files to OceanBase Database
    • Best practice for migrating data from other databases to OceanBase Database
    • Massive data migration strategy
    • Best practices for migrating data from MyCat to OceanBase Database
    • Best practices for migrating PostgreSQL to OceanBase MySQL-compatible mode
  • Route
    • ODP routing best practices
  • Table Design
    • Best practices for table design and index optimization
    • Best practices for creating indexes on large tables
    • Best practices for database development
  • Develop
    • Best practices for connecting Java applications to OceanBase Database
    • Best practices for integrating Spark Catalog with OceanBase Database
    • Best practices for achieving optimal performance in batch DML using JDBC and OBServer
    • Best practices for bulk data cleanup in OceanBase Database
    • Best practices for PDML processing in OceanBase Database
    • Best practices for hot tables in OceanBase Database
    • Best practices for auto-increment columns and sequences in OceanBase Database
  • Manage
    • Best practices for resource throttling
    • Best practices for data load balancing
    • Best practices for security certification
    • Best practices for access control
    • Best practices for data encryption
  • Diagnose
    • Best practices for log interpretation in common scenarios
    • Best practices for end-to-end tracing
    • Best practices for using obdiag to collect performance information
    • Best practices for using obdiag to collect diagnostic information of parallel and slow SQL statements
    • Best practices for troubleshooting OceanBase Database performance issues
  • Performance Tuning
    • Best practices for handling slow queries
    • Best practices for collecting statistics to generate an efficient execution plan
    • Best practices for updating hotspot rows
    • Best practices for large object storage performance
    • Best practices for semi-structured storage performance
    • Best practices for OceanBase materialized views
  • Cloud Database
    • Best practices for achieving high availability through cross-cloud active-active deployment
    • High availability through primary and standby databases across clouds
    • High host CPU usage
    • Best practices for read/write splitting in OceanBase Cloud

Download PDF

Configuration guide for read-write splitting in AP scenarios Best practices for read-write splitting Data transfer solutions in OceanBase Database Overview on data migration Best practices for importing data files to OceanBase Database Best practice for migrating data from other databases to OceanBase Database Massive data migration strategy Best practices for migrating data from MyCat to OceanBase Database Best practices for migrating PostgreSQL to OceanBase MySQL-compatible mode ODP routing best practices Best practices for table design and index optimization Best practices for creating indexes on large tables Best practices for database development Best practices for connecting Java applications to OceanBase Database Best practices for integrating Spark Catalog with OceanBase Database Best practices for achieving optimal performance in batch DML using JDBC and OBServer Best practices for bulk data cleanup in OceanBase Database Best practices for PDML processing in OceanBase Database Best practices for hot tables in OceanBase Database Best practices for auto-increment columns and sequences in OceanBase Database Best practices for resource throttling Best practices for data load balancing Best practices for security certification Best practices for access control Best practices for data encryption Best practices for log interpretation in common scenarios Best practices for end-to-end tracing Best practices for using obdiag to collect performance information Best practices for using obdiag to collect diagnostic information of parallel and slow SQL statements Best practices for troubleshooting OceanBase Database performance issues Best practices for handling slow queries Best practices for collecting statistics to generate an efficient execution plan Best practices for updating hotspot rows Best practices for large object storage performance Best practices for semi-structured storage performance Best practices for OceanBase materialized views Best practices for achieving high availability through cross-cloud active-active deployment High availability through primary and standby databases across clouds High host CPU usage Best practices for read/write splitting in OceanBase Cloud
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Best Practices
  3. master
iconOceanBase Best Practices
master
  • master

Best practice for migrating data from other databases to OceanBase Database

Last Updated:2026-03-18 09:37:39  Updated
share
What is on this page
Data migration process
Performance tuning
Source specifications
Target specifications
OMS optimization
Example

folded

share

This topic explains how to migrate data from other databases to OceanBase Database. It covers both full and incremental migration methods, along with performance optimization techniques, and provides an example.

We recommend that you use OceanBase Migration Service (OMS) to migrate data from other databases to OceanBase Database. For more information, see OMS documentation.

Data migration process

Perform the following steps to migrate data:

  1. Prepare for data migration.

    Before you migrate data by using OMS, create a user in the source or target database and grant required privileges to the user. For more information, see Create a database user.

  2. Create data sources.

    Log in to the OMS console and create a source data source and a target data source. For more information, see Create a data source.

  3. Create a data migration project.

    Specify the source database, target database, migration types, and migration objects for the data migration task as needed. For more information, see the topics about data migration tasks of the corresponding data source types.

  4. After the precheck is passed, start the data migration project.

  5. View the status of the data migration project.

    After the data migration task is started, it is executed based on the selected migration types. For more information, see View details of a data migration task.

  6. (Optional) Stop and release the data migration project.

    After the data migration task is completed and no further migration is needed between the source and target databases, you can clear the current data migration task. For more information, see End and delete a data migration task.

Performance tuning

This section describes how to improve the data migration efficiency of OMS through performance tuning. You can optimize the performance from three aspects: source specifications, target specifications, and OMS.

Source specifications

Use a monitoring tool to check the source database for performance bottlenecks.

Monitoring metrics

  • CPU utilization: Check whether the CPU resources are used up.
  • Memory usage: Make sure that the memory is sufficient without memory leaks or overflows.
  • Disk I/O: Check for disk bottlenecks, which affect the speed of data reads.
  • Network bandwidth: Make sure that the network transmission speed is not limited.

Optimization methods

  1. Upgrade hardware specifications:

    • Increase the number of CPU cores.
    • Increase the memory capacity.
    • Use a disk with higher performance, such as solid-state disk (SSD).
  2. Optimize database specifications:

    • Adjust the buffer size and modify connection pool parameters.
    • Clear unused indexes and tables.
    • Perform necessary database maintenance operations, such as index rebuild and table analysis.
  3. Optimize queries:

    • Analyze and optimize slow queries.
    • Use indexes to improve the query performance.
    • Split complex queries into several simple queries.

Target specifications

Use a monitoring tool to check the target database for performance bottlenecks.

The following table lists the optimization suggestions for OceanBase Database.

Measure Description
Shuffle leader partitions Shuffle leader partitions to all servers by specifying ALTER TENANT [tenant_name] primary_zone='RANDOM';.
Scale out the OceanBase Database tenant Specify ALTER RESOURCE POOL <resource_pool_name> MODIFY UNIT='UNIT_CONFIG(unit_memory_size, ...)';.
Enable clog compression At the global level: Specify ALTER SYSTEM SET clog_transport_compress_all = 'true'; and ALTER SYSTEM SET clog_transport_compress_func = 'zlib_1.0';.
At the tenant level: Specify ALTER SYSTEM SET enable_clog_persistence_compress='true';.
Adjust the memory usage threshold that triggers write throttling Specify ALTER SYSTEM SET write_throttling_trigger_percentage =80;. When the memory usage reaches the specified threshold, the write speed becomes low.
Adjust the memory usage threshold that triggers freezes Change the value of freeze_trigger_percentage from 20, which is the default value, to 70.
Decrease the memory usage threshold that triggers minor compactions Specify ALTER SYSTEM SET freeze_trigger_percentage=30;. If a large amount of data is to be written, you can decrease the memory usage threshold to trigger minor compactions earlier.
Increase the concurrency of minor and major compactions Specify ALTER SYSTEM SET _mini_merge_concurrency=0; and ALTER SYSTEM SET minor_merge_concurrency=0;. If you set the concurrency to 0, two compaction tasks are performed concurrently by default. When the server has sufficient resources, you can increase the concurrency to accelerate compactions.
Increase the number of threads for major compactions Specify ALTER SYSTEM SET merge_thread_count=64;.
Refresh the execution plan Specify ALTER SYSTEM FLUSH PLAN CACHE TENANT = 'tenant_name';. Data migration may lead to changes in data distribution and statistics. Refreshing the execution plan can ensure that the latest statistics are used, thereby improving the query performance.

OMS optimization

If you confirm that the source and target have no bottlenecks, you can adjust OMS components and concurrency to improve the performance.

Optimize OMS server resources

  • Make sure that the CPU, memory, and network bandwidth resources on the OMS server are sufficient so that you can set a higher task concurrency for links.
  • Deploy OMS on multiple servers to distribute the tasks of various components to these servers, so as to improve the overall performance.

Notice

The higher the OMS migration performance, the higher the pressure caused by massive data reads on the source database.

Components for performance tuning

  1. Concurrency

    OMS allows you to adjust the concurrency to limit the CPU usage. OMS does not support forcible CPU resource isolation. Therefore, severe CPU resource contention may occur in an environment with a high pressure on multiple links. You can increase the number of concurrent OMS tasks to accelerate data transmission.

    The concurrency is generally related to the number of CPU cores. You can set the maximum concurrency to four times the number of CPU cores. When you set the concurrency, take into consideration whether other tasks are running on the server. For full migration, we recommend that you modify the concurrency of tasks performed at the target, where bottlenecks occur more easily. You can adjust the concurrency of tasks performed at the source only when a bottleneck occurs at the source.

    The following figure shows how to modify the concurrency for full migration tasks.

    migration-6-en

    The following figure shows how to modify the concurrency for incremental synchronization tasks.

    migration-7-en

    Run ./connector_utils.sh metrics in the connector task directory to view the metrics. In DISPATCHER: wait record:0, ready batch:0, if the value of wait record is 0 or a small value such as 100, a bottleneck occurs at the source. If the value of ready batch is large, a bottleneck occurs at the target. If the value of wait record is large but that of ready batch is 0, hotspot data may exist.

  2. Task splitting

    Split the data migration task of a large or complex table into multiple smaller tasks to improve the transmission efficiency.

  3. Incremental synchronization parameters

    Adjust the parameters of the Store and Incr-Sync/Full-Import components to improve the incremental synchronization performance. OMS provides the Store and Writer components for incremental synchronization. The Store component parses logs in the source and the Writer component writes data to the target. The Store component is started when a full migration task begins and the Writer component is started after the full migration task ends.

    If an error occurs when the Store component parses logs, you can adjust the following parameters:

    deliver2store.logminer.fetch_arch_logs_max_parallelism_per_instance=Size of daily archive logs/500 GB + 1
    deliver2store.logminer.max_actively_staged_arch_logs_per_instance=Value of the previous parameter x 2
    deliver2store.logminer.staged_arch_logs_in_memory=true  //You need to adjust the JVM memory together with this parameter. For large transactions, you can set this parameter to true to reduce logs stored on the disk.
    deliver2store.logminer.max_num_in_memory_one_transaction=3000000  //This parameter is available only when the previous parameter is set to true.
    deliver2store.logminer.only_fetch_archived_log=true  //Only archive logs are parsed.
    deliver2store.logminer.enable_flashback_query=false
    deliver2store.parallelism=32
    

The following table lists the empirical values of related parameters in OMS.

Parameter Empirical value
datasource.connections.max 200
light-thread 200
batch_select 300
batch_insert 200
ob max_allowed_packet 512M

Note

After the data migration is completed, restore the system variables and parameters to their default settings.

Example

This section takes a migration task that migrates data from an Oracle database to OceanBase Database as an example. Assume that the source Oracle database has totally 15 partitioned tables with 2.2 billion data records to be migrated to the target OceanBase database. Before optimization, it takes 11 hours to migrate all the data records at a speed of 55,000 records per second, which is too slow to meet the expectation of the customer.

  1. Optimize related parameters in OMS.

    -- Fine-tune related parameters in OMS to increase the concurrency.
    ## Read threads
    source.workerNum: The concurrency is related to the number of CPU cores and its maximum value can be four times the number of CPU cores.
    ## Write threads
    sink.workerNum: The concurrency is related to the number of CPU cores and its maximum value can be four times the number of CPU cores.
    ## Batch size for query by using the sharding column
    source.sliceBatchSize: The value is usually set to 1000 for a large table.
    ## Maximum number of connections
    source.databaseMaxConnection
    limitator.platform.threads.number  32 --> 64
    limitator.select.batch.max         1200 --> 2400
    limitator.image.insert.batch.max   200  --> 400
    -- Increase the number of connections.
    limitator.datasource.connections.max 50  --> 200
    -- Optimize the JVM memory.
    -server -Xms16g -Xmx16g -Xmn8g -Xss256k --> -server -Xms64g -Xmx64g -Xmn48g -Xss256k
    11
    

    After the preceding adjustments, about 130 clog files are generated per minute. The size of each log file is 64 MB, adding up to about 8.5 GB in total. In this case, the CPU is fully loaded and the volume of data egress reaches 500 MB. This situation can be seen as a bottleneck at the target OceanBase database.

  2. Optimize the target OceanBase database.

    -- Enable log compression.
    ALTER SYSTEM SET clog_transport_compress_all = 'true';
    ALTER SYSTEM SET clog_transport_compress_func = 'zlib_1.0';
    -- Enable log compression at the tenant level.
    ALTER SYSTEM SET enable_clog_persistence_compress='true';
    -- Increase the number of threads for minor compactions.
    ALTER SYSTEM SET _mini_merge_concurrency=32;
    ALTER SYSTEM SET minor_merge_concurrency=32;
    -- Increase the number of threads for major compactions.
    ALTER SYSTEM SET merge_thread_count=64;
    -- Enable write throttling.
    ALTER SYSTEM SET writing_throttling_trigger_percentage =80;
    -- Decrease the memory usage threshold to trigger minor compactions earlier.
    ALTER SYSTEM SET freeze_trigger_percentage=30;
    

    After the kernel parameters are adjusted, the number of log files generated per minute decreases to 20, but the CPU utilization is still high due to the checksum task overhead resulted from a TRUNCATE operation performed on a large partitioned table. If checksum task maintenance is started but the import task is not started in OMS, the CPU utilization can reach 50% on the OBServer node.

  3. Manually clear the internal tables.

    -- Clear the metadata of the truncated partitioned table.
    DELETE FROM __all_sstable_checksum WHERE sstable_id IN 
    (SELECT table_id FROM __all_virtual_table_history WHERE table_name='table_namexxx' minus 
    SELECT table_id FROM __all_virtual_table WHERE table_name='table_namexxx');
    -- Distribute the leader partitions of the tenant to three zones.
    ALTER TENANT tenant_name SET primary zone='RANDOM';
    

    By adjusting the deployment architecture of OceanBase Database and leveraging multi-point writing, about 70,000 data records are migrated per second and the time required for full migration is reduced to about 7 hours, significantly improving the migration performance.

  4. Analyze slow SQL queries.

    SELECT * FROM gv_plan_cache_plan_explain WHERE ip=xxx.xx.xx.x AND port=2882 AND plan_id=160334 AND tenant_id=1004;
    

    You can convert a partitioned table into a non-partitioned table to avoid slow SQL queries. For a table that contains no more than 1 billion rows or 2,000 GB of data, you do not need to partition the table. You can temporarily drop the secondary indexes and retain only the primary key, and then rebuild the secondary indexes after the full migration is completed.

    After you optimize the schema, convert the partitioned table into a non-partitioned table, and drop secondary indexes, which are to be rebuilt after full migration, full migration can be completed within 3 hours, which significantly shortens the time required for data migration.

Previous topic

Best practices for importing data files to OceanBase Database
Last

Next topic

Massive data migration strategy
Next
What is on this page
Data migration process
Performance tuning
Source specifications
Target specifications
OMS optimization
Example