OceanBase logo

OceanBase

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

Product Overview
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

OceanBase

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

Product Overview
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 Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    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 Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Migrate data from a MySQL database in OceanBase Database to a MySQL database using ChunJun

    Last Updated:2026-04-15 08:25:14  Updated
    Share
    What is on this page
    Scenario description
    Prerequisites
    Procedure
    Step 1: Prepare the ChunJun environment
    Step 2: Configure the json file
    Step 3: Run the json configuration file
    Step 4: Incrementally modify data in OceanBase Database
    Step 5: View the migration results
    References

    folded

    Share

    ChunJun (formerly known as FlinkX) is a stable, user-friendly, and efficient data integration framework that supports batch and stream processing. Currently, it uses the real-time computing engine Flink to synchronize data and perform computations among various heterogeneous data sources. OceanBase Binlog Service (OceanBase Binlog Service, shortly Binlog Service) collects transaction logs from OceanBase Database and converts them into MySQL Binlog. It is mainly used in real-time data subscription scenarios.

    ChunJun Connector for OceanBase CDC integrates oblogclient internally to connect to the Binlog Service, retrieve relevant log data, and migrate incremental data from OceanBase Database.

    This topic will guide you through the process of using ChunJun in Local mode to migrate data from a MySQL database in OceanBase Database to a MySQL database.

    Scenario description

    Migrate data from the test_tbl1 table in OceanBase Database to the tbl1 table in MySQL Database. The databases are configured as follows:

    OceanBase Database (source database)
    Example value
    Cluster name test4000
    Host address 10.10.10.2
    Port number 2881
    IP address of the Binlog service 10.10.10.3
    Port number of the Binlog service 2983
    Name of the business tenant (MySQL mode) mysql001
    Username root
    Password ******
    Schema database name test_data
    Table name test_tbl1
    MySQL Database (target database)
    Example value
    Host address 10.10.10.1
    Port number 3306
    Username root
    Password ******
    Schema database name test_ob_to_mysql
    Table name tbl1

    Prerequisites

    • JDK 1.8 has been installed, and the JAVA_HOME environment variable has been configured.
    • The Binlog service has been installed and deployed. For more information, see Create a Binlog cluster.

    Procedure

    Step 1: Prepare the ChunJun environment

    1. Download and decompress the ChunJun package.

      Download chunjun-dist.tar.gz.

      wget https://github.com/DTStack/chunjun/releases/download/v1.12.6/chunjun-dist.tar.gz
      

      Decompress the package to the /chunjun_Home/chunjun directory.

      mkdir /ChunJun_Home/chunjun && tar zxvf chunjun-dist.tar.gz -C /ChunJun_Home/chunjun
      
    2. Configure the ChunJun environment variables.

      export ChunJun_HOME=/ChunJun_Home/chunjun-dist
      

    Step 2: Configure the json file

    Configure the json file to migrate the data from the test_tbl1 table in OceanBase Database to the tbl1 table in MySQL Database based on the environment information.

    Here is an example:

    [root@xxx /]
    $cd /ChunJun_Home/chunjun-dist/chunjun-examples/json
    
    [root@xxx /ChunJun_Home/chunjun-dist/chunjun-examples/json]
    $mkdir test_data
    
    [root@xxx /ChunJun_Home/chunjun-dist/chunjun-examples/json]
    $cd mkdir test_data
    
    [root@xxx /ChunJun_Home/chunjun-dist/chunjun-examples/json/test_data]
    $vi test_ob_to_mysql.json
    
    {
      "job": {
        "setting": {
          "errorLimit": {
            "record": 0,
            "percentage": 0.02},
          "speed": {"bytes": 0,
          "channel": 1}
        },
        "content": [
          {
            "reader": {
              "name": "oceanbasecdcreader",
              "table": {
                "tableName": "test_tbl1"},
              "parameter": {
                "logProxyHost": "10.10.10.3",
                "logProxyPort": 2983,
                "obReaderConfig": {
                  "rsList": "10.10.10.2:2882:2881",
                  "username": "root",
                  "password": "******"
                },
                "cat": "insert,delete,update",
                "column": [
                  "*"
                ]
              }
            },
            "writer": {
              "name": "mysqlwriter",
              "parameter": {
                "column": [
                  "*"
                ],
                "connection": [
                  {
                    "jdbcUrl": "jdbc:mysql://10.10.10.1:3306/test_ob_to_mysql",
                    "table": [
                      "tbl1"
                    ]
                  }
                ],
                "username": "root",
                "password": "******"
              }
            }
          }
        ]
      }
    }
    

    Step 3: Run the json configuration file

    Start a JVM process to run the ChunJun task.

    Go to the /ChunJun_Home/chunjun-dist directory and run the following command:

    [root@xxx /]
    $cd /ChunJun_Home/chunjun-dist
    
    [admin@xxx /ChunJun_Home/chunjun-dist]
    $sh bin/chunjun-local.sh -job chunjun-examples/json/test_data/test_ob_to_mysql.json
    
              #                               #
              #                               #
              #
      #####   ######   #     #  # ####     ####   #     #  # ####
     #        #     #  #     #  ##    #       #   #     #  ##    #
     #        #     #  #     #  #     #       #   #     #  #     #
     #        #     #  #    ##  #     #       #   #    ##  #     #
      #####   #     #   #### #  #     #       #    #### #  #     #
                                              #
                                          ####
    
    Reference site: https://dtstack.github.io/chunjun
    
    chunjun is starting ...
    CHUNJUN_HOME is auto set /ChunJun_Home/chunjun-dist/
    FLINK_HOME is empty!
    HADOOP_HOME is empty!
    ...
    <ellipsis>
    ...
    *********************************************
    numWrite                  |  3
    last_write_num_0          |  0
    conversionErrors          |  0
    writeDuration             |  20149
    duplicateErrors           |  0
    numRead                   |  3
    snapshotWrite             |  0
    otherErrors               |  0
    readDuration              |  95
    byteRead                  |  389
    last_write_location_0     |  0
    byteWrite                 |  389
    nullErrors                |  0
    nErrors                   |  0
    *********************************************
    
    2023-01-06 20:34:47,448 - 50317 INFO  [main] com.dtstack.chunjun.Main:program Flink_Job execution success
    

    Step 4: Incrementally modify data in OceanBase Database

    Log in to OceanBase Database (MySQL mode) and insert a row into the test_tbl1 table.

    [admin@xxx /home/admin]
    $obclient -h10.10.10.2 -P2881 -uroot@mysql001 -p****** -Dtest_data
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the OceanBase.  Commands end with ; or \g.
    Your OceanBase connection id is 3221709678
    Server version: OceanBase 4.0.0.0 (r101000022022120716-0d7927892ad6d830e28437af099f018b0ad9a322) (Built Dec  7 2022 16:22:15)
    
    Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    obclient [test_data]> INSERT INTO test_tbl1 VALUES(4,'Macao',853);
    Query OK, 1 row affected
    

    Step 5: View the migration results

    Log in to MySQL Database to view the migration results.

    [admin@xxx /home/admin]
    $mysql -h10.10.10.1 -P3306 -uroot -p******
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MySQL connection id is 189769
    Server version: 5.7.26-log MySQL Community Server (GPL)
    
    <ellipsis>
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MySQL [(none)]> use test_ob_to_mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    MySQL [test_ob_to_mysql]> SELECT * FROM tbl1;
    +------+-----------+------+
    | col1 | col2      | col3 |
    +------+-----------+------+
    |    1 | China     |   86 |
    |    2 | Taiwan    |  886 |
    |    3 | Hong Kong |  852 |
    |    4 | Macao     |  853 |
    +------+-----------+------+
    4 rows in set
    

    References

    • For more information about how to get started with ChunJun, see Quick start.
    • For more information about the JSON configuration file of the target MySQL database, see MySQL Sink.
    • For more script examples, see the /chunjun-dist/chunjun-examples folder in the project.

    Previous topic

    Use Flink CDC to migrate data from OceanBase Database to a MySQL database
    Last

    Next topic

    Use OMS to migrate data from an Oracle database to a MySQL tenant of OceanBase Database
    Next
    What is on this page
    Scenario description
    Prerequisites
    Procedure
    Step 1: Prepare the ChunJun environment
    Step 2: Configure the json file
    Step 3: Run the json configuration file
    Step 4: Incrementally modify data in OceanBase Database
    Step 5: View the migration results
    References