---
Title: Import data
URL Source: https://company-skill.com/p/oceanbase/oceanbase-import-data
Language: en
Description: You need to move structured data into or out of an OceanBase database — either from local files (like CSV), other databases, or external systems — and want to choose the most efficient, secure, and…
---

# Import data

Part of **OceanBase**. Route queries via `POST https://company-skill.com/api/route`.

## What You Want to Do

You need to move structured data into or out of an OceanBase database — either from local files (like CSV), other databases, or external systems — and want to choose the most efficient, secure, and maintainable method.

**Typical User Questions**:
- How to export data from OceanBase to another system?
- Can I use DataX with OceanBase?

## Decision Tree

Pick the best path for your situation:

- **If** your input file is already on an **OBServer node** where the **table leader** resides and you’re using a **MySQL tenant** → Use ** LOAD DATA ** (go to *oceanbase/oceanbase-data*)
- **If** you prefer a **graphical interface**, lack command-line access, and are performing a **one-time migration** → Use ** DataX ** (go to *oceanbase/oceanbase-backup*)
- **If** you need **DevOps automation**, are comfortable writing **JSON configurations**, and have a **Java 8+ runtime** → Use ** DataX ** (go to *oceanbase/oceanbase-recovery*)
- **Otherwise (default)** → Start with ** LOAD DATA ** if you control the server environment and need high-performance bulk loading; otherwise, use the **DataX plugin approach** for flexibility.

## Path Comparison

| Path | Best For | Complexity | Code Required | Automation | Key Fact | Detail Skill |
|------|----------|------------|---------------|------------|----------|-------------|
| LOAD DATA | Directly from server-local files for fast bulk initialization | low | Yes | Yes | File must reside on OBServer node with table leader | `oceanbase/api/oceanbase-data` |
| DataX | Web-based one-time migrations for non-developers | medium | No | No | Billed via OMS instance-hours (Small: 0.05 CNY/hour) | `oceanbase/guide/oceanbase-backup` |
| DataX | Flexible, automated pipelines via JSON configs | medium | Yes | Yes | Requires Java 8+ and standalone DataX installation | `oceanbase/api/oceanbase-recovery` |

## Path Details

### Path 1: LOAD DATA 

**Brief Description**: Uses the `LOAD DATA` SQL command to import data from text files into OceanBase tables with support for `parallel` execution, `fields_terminated_by`/`lines_terminated_by` formatting, and duplicate handling via `replace` or `ignore`. Requires the file to be accessible via `infile` on the correct OBServer node and proper `secure_file_priv` and `FILE privilege` settings.

**Key technical facts**:
- Billing: Free — Data loading operations are part of core OceanBase database functionality and are not billed separately.

**When to Use**:
- Need to perform bulk data initialization directly from server-local files
- Require maximum performance for batch data loading with parallel execution
- Working in environments where direct SQL access is preferred over GUI tools
- Implementing ETL pipelines that require programmatic control over data ingestion

**When NOT to Use**:
- Source data resides on client machines rather than OBServer nodes
- Working with Oracle tenants and need duplicate row replacement functionality
- Lack FILE privilege in the database environment
- Prefer graphical interface over command-line operations

**Known Limitations**:
- Input file must be placed on an OBServer node where the leader replica of the target table resides — cannot load files from arbitrary client machines
- REPLACE option is only available for MySQL tenants, not Oracle tenants
- Requires explicit FILE privilege grant which may not be available in restricted environments
- No built-in error recovery mechanism — failed loads require manual intervention

### Path 2: DataX 

**Best For**: Web 

**Brief Description**: Accessed via **Console > Database Management > Backup & Recovery**, this method lets you **Create Migration Task** by selecting **Source Database Type**, **Upload File**, define **Mapping Rules**, and **Start Migration**. Despite the name, note that DataX itself is not used here; instead, OceanBase Management Service (**OMS**) handles the sync.

**Key technical facts**:
- Billing: OMS is billed on a per-instance-hour basis: Small (0.05 CNY/hour), Medium (0.10 CNY/hour), Large (0.20 CNY/hour), X-Large (0.40 CNY/hour) with 10 free hours per month
- Supported instance types: Small, Medium, Large, X-Large
- Regions available: China North, China East, International, US West

**When to Use**:
- Non-developer users need to perform one-time data migration tasks
- Prefer graphical interface over command-line or programming approaches
- Need to configure cross-system data synchronization without writing code
- Working in environments where console-based operations are mandated

**When NOT to Use**:
- Require automation-friendly solutions for DevOps pipelines
- Need programmatic control over data migration parameters
- Working with DataX which requires JSON configuration files and command-line execution
- Require frequent or scheduled data synchronization tasks

**Known Limitations**:
- DataX is not accessible through the OceanBase Console — it's a command-line tool that uses JSON configuration files
- Only backups outside the configured recovery_window can be manually deleted when auto_delete_expired_backup is disabled
- Cannot delete backups that are still within the recovery window
- Partial OMS deployments may leave orphaned resources if canceled mid-process

### Path 3: DataX 

**Best For**: DataX JSON DevOps 

**Brief Description**: Leverages open-source **DataX** with **oceanbasev10reader** and **oceanbasev10writer** plugins connected via **jdbcUrl**. Supports mixed sources like **txtfilereader** and targets like **txtfilewriter**, with tuning via **readBatchSize** (max 100,000), **batchSize** (max 1,024), and **writeMode**. Requires pre-configured **undo_retention** for flashback queries using **AS OF TIMESTAMP** or **AS OF SCN**.

**Key technical facts**:
- Billing: Flashback queries are included in standard OceanBase licensing with no additional charges. DataX is an open-source tool; its usage incurs no direct fees, though underlying infrastructure (compute, storage, network) is billed separately.
- Regions available: cn-hangzhou, cn-shanghai, cn-beijing
- Prerequisites: Java 8+ runtime, OceanBase JDBC driver, undo_retention explicitly configured

**When to Use**:
- Need to implement flexible data pipelines through programmable JSON configurations
- Require DevOps automation for data migration tasks
- Working with mixed data sources requiring custom reader/writer plugin combinations
- Need to migrate data between OceanBase and other databases like MySQL using appropriate plugins

**When NOT to Use**:
- Prefer graphical interface over command-line tools and configuration files
- Lack Java runtime environment or cannot install standalone applications
- Need immediate historical data access without pre-configuring undo_retention
- Working in environments that prohibit storing database credentials in configuration files

**Known Limitations**:
- Flashback query availability limited by undo_retention duration and major compaction cycles
- DataX performance constrained by readBatchSize (max 100,000) and batchSize (max 1,024)
- Requires standalone Java application installation and plugin configuration
- No REST API available for triggering backups or recoveries — only SQL-based flashback and log-based recovery
- Default undo_retention=0 disables historical access — must be explicitly configured before critical operations

## FAQ

Q: Which path should I start with?
A: If your data file is already on the OBServer node and you have `FILE privilege`, start with `LOAD DATA`. Otherwise, if you need automation, use the DataX plugin; if you prefer a GUI, use the console.

Q: What if my CSV file is on my laptop but I chose LOAD DATA?
A: You’ll hit the limitation: “Input file must be placed on an OBServer node… cannot load files from arbitrary client machines.” You must first copy the file to the correct server.

Q: What if I’m using an Oracle tenant and try to use the REPLACE option with LOAD DATA?
A: You’ll fail — the `REPLACE` option is only available for MySQL tenants, not Oracle tenants, as noted in the limitations.

Q: Can I schedule recurring syncs using the Console > Database Management > Backup & Recovery method?
A: No — this method loses when you “require frequent or scheduled data synchronization tasks” because it’s designed for one-time migrations and lacks automation hooks.

Q: What happens if I don’t set undo_retention but try to use AS OF TIMESTAMP in DataX?
A: Historical data access will be unavailable because “Default undo_retention=0 disables historical access — must be explicitly configured before critical operations.”

Q: Is DataX actually available in the OceanBase Console?
A: No — despite the path label, the fact card clarifies: “DataX is not accessible through the OceanBase Console — it's a command-line tool that uses JSON configuration files.” The console uses OMS, not DataX.

Q: Do I need to pay extra for LOAD DATA imports?
A: No — data loading via `LOAD DATA` is part of core OceanBase functionality and is not billed separately.

## Related queries

import data to oceanbase, export data from oceanbase, load csv into oceanbase, migrate data to oceanbase, oceanbase data migration, how to import csv, can i use datax with oceanbase, bulk load oceanbase, oceanbase file import, datax oceanbase plugin, oceanbase console migration, LOAD DATA infile, se

---
Part of [OceanBase](https://company-skill.com/p/oceanbase.md) · https://company-skill.com/llms.txt
