Este tema proporciona información sobre la exportación del esquema y los datos de objetos de base de datos.
Background information
OceanBase Developer Center (ODC) allows you to export schemas and data of database objects in batches.
You can create an export task to export only schemas of database objects, only data of database objects, or both.
- Export both schema and data: Export both the definition statements and data of database objects.
- Export data only: Export only data of table or view objects.
- Export schema only: Export only definition statements of database objects.
Formato de exportación
ODC exporta los datos en un archivo .zip, que contiene el archivo de metadatos MANIFEST.bin, los archivos de definición de esquema de los objetos exportados y los archivos de datos.
Al crear una tarea de exportación, si establece Data Format en SQL Format, el archivo .zip contendrá archivos de definición de esquema con el formato de nombre object name-schema.sql y archivos de datos con el formato de nombre object name.sql. Los nombres de los objetos coinciden con los de la base de datos.

Si establece Data Format en CSV Format, el archivo .zip contendrá archivos de definición de esquema con el formato de nombre object name-schema.sql y archivos de datos con el formato de nombre object name.csv. Los nombres de los objetos coinciden con los de la base de datos.

Considerations
In web ODC, the maximum size of files exported in one batch cannot exceed 2GB before compression. To export data of a larger size, use OceanBase OBDUMPER.
Se admiten hasta cinco tareas de exportación simultáneas. Las tareas posteriores deberán esperar en la cola.
De forma predeterminada, los archivos relacionados con las tareas de exportación se conservan durante 14 días.
- In OceanBase V4.0.0 and earlier versions, configuring the sys tenant account and password in the data source can improve export speed. ODC can calculate the optimal parallel export strategy based on partition locations, and OceanBase V4.0.0 and earlier versions require querying and determining partition locations through the sys tenant.
- For OceanBase versions after V4.0.0, it is not necessary to configure the sys tenant account and password in the data source. ODC supports querying and determining partition locations through the views of the business tenant.
Create an export task
Assume that you want to batch export the schemas and data of the employee and salary stables from the odc_test database to a local disk.
|
Parámetro |
Ejemplo |
|
Data Source |
mysql4.2.4 |
|
Database Name |
odc_test |
|
Table Name |
employee, salary |
-
On the Ticket tab, choose Export > Create New.

-
In the Create Export Task panel, select the content to be exported.

-
Select a database.
Select the database where the object to export resides. The data source name of the target database of the task is also displayed.
Importante OceanBase Database does not support the export feature for built-in databases in MySQL mode. -
Select the export range.
You can select Partial Export or Full Export.
If you select Partial Export, you can select the objects you want to export in the Select Objects pane in the Export Objects section. You can use the search field to search for desired objects.
- If you select Full Export, all objects in the database are exported.
-
Go to the Export Settings panel.
Click Next: Export Settings to specify the file export settings.
-
Configure the data files.
NotaIf you set Export Content to Export Schema Only, you do not need to configure a data file.
Parámetro
Descripción
Data Format
ODC admite la exportación de datos a archivos en formato CSV y SQL. Si especifica Export Schema Only para Export Content, solo podrá exportar datos a archivos en formato SQL.
File Encoding
ODC admite las siguientes codificaciones de archivo: ASCII, ISO-8859-1, GB2312, GBK, GB18030, Unicode (UTF-8), Unicode (UTF-16), Unicode (UTF-32) y BIG5.
Maximum Size of a Single File
Si establece Export Content en Export Schema Only, no necesita configurar este parámetro.
Puede seleccionar el tamaño máximo de un archivo de datos de tabla única. Si el tamaño de un archivo supera el máximo establecido, el archivo se divide automáticamente en partes más pequeñas para la exportación. Si no especifica el tamaño máximo, los archivos no se dividirán.
CSV Settings
Si selecciona el formato CSV para la exportación y establece Export Content en Export Schema and Data, puede especificar la siguiente información:
Include Column Header: indica si se incluyen los encabezados de columna al exportar datos en formato CSV. Esta opción está seleccionada de forma predeterminada.
Convert Empty Character String into Null Value: esta opción está seleccionada de forma predeterminada y determina si se convierten las cadenas vacías de la tabla en valores NULL al exportar datos en formato CSV.
Field Separator: especifica el separador entre campos. Se admiten los siguientes signos: comas (,), punto y coma (;) y dos puntos (:). También puede utilizar cualquier otro carácter como separador.
Text Identifier: especifica el identificador para el contenido de texto. Se admiten comillas simples (') y comillas dobles (").
Line Break Symbol: especifica el símbolo de salto de línea. Se admiten los siguientes caracteres: \n, \r y \r\n.
Batch Commit Quantity (SQL Format)
Al exportar datos en formato SQL, después de especificar este campo, se ejecuta una instrucción
COMMITcuando el número de filas de datos exportadas alcanza la cantidad especificada.Use Global Snapshot
Tras seleccionar esta opción, ODC exportará los datos de la instantánea global más reciente para la tabla especificada. Puede seleccionar esta opción para garantizar la coherencia global de los datos.
-
Configure schema files.
If you set Export Content to Export Schema Only, you can select whether to merge the export results into one SQL file. If you select this option, the DDL statements are merged into and exported as an SQL file.
Choose whether to select Add DROP TABLE Statement before CREATE TABLE Statement. If you select this option, a
DROPstatement is added before the correspondingCREATEstatement of an object when the schema files of the object are exported.
-
Specify the task execution method.
Select Execute Immediately or Timed Execution.
-
Retain the current configuration.
After specifying all information, select Retain Current Configuration in the lower-left corner of the panel to save the configuration of the current data files and schema files.
-
Generate an export task.
After you specify all preceding information, you can click Export in the lower-right corner of the panel to create an export task.
View an export task
Task list
- The tasks in the last 48 hours are displayed in the task list.
- ODC allows you to run up to three export tasks in parallel, while subsequent tasks wait in the queue.
Una vez generada la tarea de exportación, aparece automáticamente la pestaña Tickets. En la lista de tareas puede consultar el estado de aprobación y la información básica de la tarea, así como descargar los archivos de datos y esquemas exportados.

La siguiente tabla describe las columnas de la lista de tareas de exportación.
|
Columna |
Descripción |
|
No. |
The ID of the export task. |
|
Type |
The type of the task specified when you created the task. |
|
Ticket Description |
The description that you entered when you initiated the task. |
|
Current Reviewer |
The reviewer of the task. Click the |
|
Created By |
The user who created the export task. You can click the search icon |
|
Created At |
The date and time when the task was generated. |
|
Status |
The current status of the task. ODC provides different management actions for tasks in different states. |
|
Actions |
Click View to go to the Task Details page to view the task information and task logs. |
Task information
As shown in the preceding figure, click View in the Export task list.
-
In the Task Details panel, click the Task Information tab to view the basic information of the task, export files, and export objects.

Parámetro
Descripción
Basic task information
Se muestra el estado de ejecución, ID, base de datos, tipo, nivel de riesgo, método de ejecución, creador y hora de creación de la tarea.
Export file information
Se muestra el contenido de exportación, formato de datos, estándar de codificación de archivos, configuración de exportación de datos, configuración de exportación de esquema y método de gestión de errores.
Export object information
Displays the information about the objects during data export, including Object Name, Object Type, Schema Processing Status, Processed Quantity, and Data Processing Status.
Task process
En el panel Task Details de la tarea deseada, haga clic en la pestaña Task Process para consultar la información de inicio, aprobación y ejecución de la tarea.

Task logs
En el panel Task Details de la tarea deseada, haga clic en la pestaña Task Logs para consultar todos los registros y registros de alertas de la tarea.
|
Parámetro |
Descripción |
|
All Logs |
Displays the complete information of all task logs, including INFO, ERROR, and WARN logs. |
|
Alert logs |
Displays the ERROR and WARN logs of the task. When a task fails, you can view the error message in the alert logs. |
In addition, the toolbar provides the following buttons:
|
Botón |
Descripción |
|
Find |
Click this button to search for logs. |
|
Download |
Click this button to download logs. |
|
Copy |
Click this button to copy logs. |

Exportación del archivo generado
En el panel Task Details de la tarea deseada, haga clic en Download en la esquina inferior derecha para exportar el archivo generado a su disco local.

