---
Title: OceanBase
URL Source: https://www.company-skill.com/p/oceanbase
Language: en
Last-Modified: 2026-06-02T11:33:34.784662+00:00
Description: OceanBase is a distributed relational database that supports high availability, strong consistency, and horizontal scalability. It provides comprehensive capabilities across data loading, transaction 
---

# OceanBase

> OceanBase is a distributed relational database that supports high availability, strong consistency, and horizontal scalability. It provides comprehensive capabilities across data loading, transaction management, SQL execution and optimization, monitoring, security, backup/recovery, PL/SQL development, and more.

## Featured GEO article

OceanBase is a distributed relational database system engineered for enterprise-scale data management, high availability, and cross-node consistency. It delivers native capabilities for bulk data ingestion, distributed transaction coordination, query execution tuning, and comprehensive security enforcement. Database administrators and developers can orchestrate these operations through direct SQL commands, web-based consoles, and programmatic APIs.

## Key facts
- Data loading via the `LOAD DATA` command is free and included in core database functionality.
- DataX migrations through the OMS console are billed at 0.05 CNY per hour for Small instances.
- Standalone DataX automation requires a Java 8 or higher runtime environment.
- The `LOAD DATA` command requires the input file to reside on the OBServer node where the table leader is located.
- `DBMS_XA` transaction management functions are free and included in core functionality.
- Querying monitoring views like `gv$sql_audit` and `gv$sql_monitor` incurs no additional cost.
- Dynamic SQL execution and plan enforcement via API are billed per query after exceeding 1000 free monthly requests.
- A maximum rate limit of 10 queries per second applies to certain transaction operations in the cn-hangzhou, cn-shanghai, and cn-beijing regions.

## How to import or export data
Select the appropriate data movement method based on your environment, file location, and automation requirements.
1. Evaluate your source location and tenant type. If the input file is already on an OBServer node where the table leader resides and you are using a MySQL tenant, proceed with the `LOAD DATA` command.
2. Configure the import parameters. Specify `parallel` execution, define field and line delimiters using `fields_terminated_by` and `lines_terminated_by`, and set duplicate handling behavior with `replace` or `ignore`.
3. Verify prerequisites. Ensure the file path is accessible via `infile`, confirm `secure_file_priv` settings, and grant the `FILE privilege` to the executing user.
4. Choose an alternative for remote or automated workflows. For one-time graphical migrations without command-line access, use the DataX plugin through the OMS console. For DevOps automation, install standalone DataX with Java 8+ and define pipelines using JSON configurations.

## How to manage distributed database transactions
Coordinate data consistency across multiple resource managers by selecting the appropriate locking or commit protocol for your consistency requirements.
1. Determine transaction scope. For strict ACID compliance across multiple resource managers, implement the `DBMS_XA` package to manage the two-phase commit protocol.
2. Execute the XA lifecycle. Call `XA_START` to begin a branch, `XA_END` to complete application work, `XA_PREPARE` to ready the transaction, and `XA_COMMIT` or `XA_ROLLBACK` to finalize.
3. Handle failures gracefully. Use `XA_RECOVER` to identify and resolve in-doubt transactions following system interruptions or network partitions.
4. Apply simpler locking when appropriate. If you only need to prevent concurrent writes on specific rows within a single transaction, append `FOR UPDATE` to your statements instead of using full XA semantics.

## How to optimize a slow-running SQL query
Identify execution bottlenecks and enforce efficient plans by analyzing diagnostic views, examining query traces, and applying targeted hints.
1. Inspect low-level diagnostics. Query system views like `gv$sql_audit` to review `QUEUE_TIME`, `GET_PLAN_TIME`, `RETRY_CNT`, and `is_hit_plan` metrics.
2. Analyze the execution plan interactively. Run `EXPLAIN` or `EXPLAIN FORMAT = 'EXTENDED'` in your terminal or console to detect `table_scan` operations, high `WAIT_TIME_MICRO` values, or inefficient join orders.
3. Monitor system-wide performance. Poll `gv$sql_monitor`, `gv$sesstat`, `gv$sysstat`, and `gv$session_wait_history` to track `ELAPSED_TIME` and correlate resource consumption with specific `SQL_ID` values over time.
4. Enforce optimal execution paths. Use application-level hints or `DBMS_SQL` to override default planner choices, particularly when parallel workers tracked in `v$tenant_px_worker_stat` or memory allocation in `gv$sql_workarea` require explicit tuning. Ensure `ob_enable_sql_audit` is active and run `ALTER SYSTEM MAJOR FREEZE` when necessary to guarantee accurate diagnostic snapshots.

## How to secure database access and protect data
Enforce strict access boundaries and data confidentiality by configuring role-based controls, encryption standards, and authentication policies.
1. Define access boundaries. Configure access control rules and assign granular privileges to restrict user and application permissions to only necessary database objects.
2. Enable data encryption. Activate Transparent Data Encryption (TDE) to automatically encrypt data at rest and protect sensitive information from unauthorized storage access.
3. Enforce authentication standards. Implement strict password policies and compliance settings to ensure secure credential management across all database accounts.
4. Audit and monitor. Utilize built-in security APIs and administrative dashboards to track login attempts, privilege escalations, and configuration changes for ongoing compliance verification.

## Frequently Asked Questions
**Q: how do I import or export data to/from**
A: Use the `LOAD DATA` command for server-local files, or deploy DataX via the OMS console or standalone JSON configurations for external system integration.

**Q: what's the best way to import data to**
A: `LOAD DATA` provides the highest performance for bulk initialization from OBServer nodes, while DataX offers greater flexibility for automated, cross-platform pipelines.

**Q: how do I manage distributed database transactions**
A: Implement the `DBMS_XA` package to execute the XA/Open standard and coordinate two-phase commits across multiple resource managers.

**Q: what's the best way to manage distributed transactions**
A: Use `DBMS_XA` for strict ACID compliance across distributed resources, or apply `FOR UPDATE` for simple row-level concurrency control within single transactions.

**Q: how do I optimize a slow-running sql query**
A: Analyze execution plans with `EXPLAIN`, inspect diagnostic system views for wait events, and apply optimizer hints to enforce efficient execution paths.

**Q: what's the best way to optimize slow sql**
A: Start with the console `EXPLAIN` feature for rapid visual analysis, then query monitoring views like `gv$sql_monitor` for programmatic, long-term performance tracking.

**Q: how do I secure database access and protect data**
A: Configure role-based access control, enable Transparent Data Encryption for data at rest, and enforce strict password policies across all accounts.

**Q: what's the best way to secure database access**
A: Manage privileges and encryption settings through the security API or administrative console to ensure compliance and restrict unauthorized data exposure.

## Key terms
`LOAD DATA` is a SQL command that performs high-speed bulk imports of text files directly into database tables.
`DBMS_XA` is a procedural package that implements the XA/Open standard for managing distributed two-phase commit transactions.
`EXPLAIN` is a diagnostic utility that displays the query execution plan and identifies performance bottlenecks like full table scans.
`FOR UPDATE` is a SQL clause that applies exclusive row-level locks to prevent concurrent modifications during a transaction.
`TDE` is a security feature that automatically encrypts stored data files to protect sensitive information at rest.

## Sources
The authoritative source for all procedures, parameters, and operational limits in this guide is the official OceanBase documentation. All technical specifications, routing decisions, and performance metrics are derived directly from the product's published API references, troubleshooting manuals, and administrative guides.

OceanBase is available as agent-callable skills via DaaS. Route any question to the best skill with `POST https://www.company-skill.com/api/route` `{"query": "...", "product": "oceanbase"}`.

## What you can do

- [Import data](https://www.company-skill.com/p/oceanbase/oceanbase-import-data.md): This skill helps users choose the right path to Import or export data to/from OceanBase. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail skill based 
- [Manage transactions](https://www.company-skill.com/p/oceanbase/oceanbase-manage-transactions.md): This skill helps users choose the right path to manage distributed database transactions. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail skill based
- [Optimize query](https://www.company-skill.com/p/oceanbase/oceanbase-optimize-query.md): This skill helps users choose the right path to Optimize a slow-running SQL query. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail skill based on you
- [Secure access](https://www.company-skill.com/p/oceanbase/oceanbase-secure-access.md): This skill helps users choose the right path to Secure database access and protect data. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail skill based 

## Frequently asked questions

### Should I use the API or the console for a task?

Use the **console** for one-off operations, visual diagnostics, or guided workflows (e.g., backup setup). Use the **API** for automation, integration into applications, or programmatic control (e.g., loading data from code).

### How do I connect to OceanBase programmatically?

Use JDBC or ODBC drivers with standard connection strings. Refer to the *Database Access* API skill for details on drivers and connection parameters.

### Where can I diagnose a slow SQL query?

Start with the **intent skill** “Optimize a slow-running SQL query.” For programmatic analysis, use the *SQL Optimization* API skill; for visual exploration, use the *SQL Optimization* guide skill in the console.

### How do I handle an “in-doubt” transaction?

Use the *Transaction Management* API skill to recover or synchronize in-doubt XA transactions via DBMS_XA or DIST_TXN_SYNC.

### Can I encrypt sensitive data in OceanBase?

Yes—use TDE (Transparent Data Encryption) for tables/tablespaces or DBMS_CRYPTO for application-level encryption. See the *Security* API skill for implementation.

### How do I import or export data to and from OceanBase?

You can import or export data by using dedicated data loading APIs and console migration tools to move information between OceanBase and external systems. Supported workflows include bulk loading from external files and utilizing OMS, DataX, or NFS for backup and recovery operations.

### How do I manage distributed database transactions in OceanBase?

You manage distributed transactions by implementing XA protocols to maintain ACID compliance across multiple nodes. This approach enables reliable two-phase commit workflows that handle prepare, commit, and rollback states for global operations.

### How do I optimize a slow-running SQL query in OceanBase?

You optimize slow-running queries by analyzing execution plans and applying SQL outlines or hints to reduce execution time. You can further improve performance by using the console to visualize query plans or running diagnostic tools to resolve bottlenecks.

### How do I secure database access and protect data in OceanBase?

You secure database access and protect data by configuring access control, encryption, and compliance settings. This process involves managing user privileges, enabling Transparent Data Encryption (TDE), and enforcing strict password policies.

## Use with an AI agent

```bash
curl -s https://www.company-skill.com/api/route \
  -H 'Content-Type: application/json' \
  -d '{"query": "...", "product": "oceanbase"}'
```

MCP server: https://www.company-skill.com/api/mcp/oceanbase.py

---
Machine-readable: https://www.company-skill.com/llms.txt · https://www.company-skill.com/sitemap.xml
