Command-line options

2026-03-03 02:45:20  Updated

OBDUMPER specifies the information to be exported by using command-line options. For more information about the options and usage examples, see Options and Usage examples.

Overview

Option styles

OBDUMPER supports command-line options in Unix and GNU styles.

  • Unix style: An option is prefixed with a hyphen and each option is a single character, such as ps -e. In this style, you can omit the space between an option and its value, such as -p******.

  • GNU style: An option is prefixed with double hyphens and each option is a single character or a string, such as ps --version. An option and its value must be separated with a space, such as --table 'test'.

Option categories

Command-line options in OBDUMPER are classified into basic options and advanced options.

  • Basic options: general options of OBDUMPER, including connection options (such as the database connection method), feature options (such as the file format, database object type, and storage path), and other options.

  • Advanced options: feature options (such as the timestamp format, allowlist- and blocklist-based table/column filtering settings, and error handling method) and performance options.

Required options

When using OBDUMPER to export data, you must specify at least the connection options, format options, database object type options, and storage path options.

Example:

$./obdumper -h xx.x.x.x -P 2883 -u test@mysql#cluster_a -p ****** -D USERA --csv --table '*' -f /output

In this example, -h, -P, -u, -p, and -D are connection options; --csv is a file format option; --table is a database object type option; and -f specifies the storage path.

Basic options

Connection options

OBDUMPER commands can read and write data only after connecting to OceanBase Database. You can specify the following options to connect to OceanBase Database.

Export type

Export type Related command-line options
OceanBase Database
  • -h host_name, --host= host_name
    The IP address or domain name of the host that is used to connect to the physical node of OceanBase Database.

    Note

    Starting from OBDUMPER 4.2.6, you can specify multiple IP addresses or domain names, separated by commas.

  • -P port_num, --port= port_num
    The port number of the host that is used to connect to the physical node of OceanBase Database.

    Note

    • Starting from OBDUMPER 4.2.6, you can specify one or more port numbers, separated by commas.
    • If you specify only one port number, all hosts use the same port number.
  • -u,--user
    The username, tenant name, and cluster name for connecting to the target database. The format is: <user>@<tenant>#<cluster>. Example: -u user@tenant#cluster.
    • If the specified username is incorrect, OBDUMPER cannot connect to the database.
    • If you do not specify the cluster name in the command line, the current connection is to the physical node of the database, and the related options (such as -h/-P) specify the IP address and port number of the physical node of the database. If you specify the cluster name in the command line, the current connection is to the ODP service, and the related options (such as -h/-P) specify the IP address and port number of the ODP service.
  • -D database_name, --database= database_name
    Specifies the database from which database object definitions and table data are exported.
  • -p 'password', --password='password'
    The username and password for connecting to OceanBase Database. If you do not specify this option in the command line, the database account does not have a password. If you specify this option in the command line, you must enclose the parameter value in single quotation marks. Example: -p'******'.

    Note

    On Windows, you must enclose the parameter value in double quotation marks. If the parameter value of other options is a string, you must enclose it in double quotation marks.

  • --sys-user sys_username
    The username of the user in the sys tenant that has specific privileges. Example: root or proxyro. OBDUMPER must query the metadata in system tables from the sys tenant. Default value: root. This option is not required for OceanBase Database 4.0.0 and later.
  • --sys-password 'sys_password'
    The password of the user in the sys tenant that has specific privileges. This option is used with the --sys-user option. By default, the password of the root user in the sys tenant is empty. If you specify this option in the command line, you must enclose the parameter value in single quotation marks. Example: --sys-password '******'. This option is not required for OceanBase Database 4.0.0 and later.

    Note

    If you do not specify this option, OBDUMPER cannot query the metadata in system tables, which may greatly affect the export performance.

  • --no-sys
    Indicates that the sys tenant password is not provided in the OceanBase Database environment. This option is used to export database objects or table data from the OceanBase cluster deployed with OceanBase Database to a file. The difference between this option and the --public-cloud option is that when you use this option, you must specify the tenant name in the command line (such as -u <user>@<tenant>), and add the cluster option (such as -u <user>@<tenant>#<cluster>) when you connect to the ODP service. In OceanBase Database 4.0.0 and earlier, if you do not specify the --public-cloud or --no-sys option, you must specify the --sys-user and --sys-password options.
Cloud OceanBase Database --public-cloud
Indicates that database objects or table data in the OceanBase cluster deployed with Cloud OceanBase Database are exported to a file. If you specify this option in the command line, you do not need to specify the tenant name and cluster name in the connection option (such as -u <user>@<tenant>#<cluster>). In this case, the export program automatically opens the --no-sys option. For more information about the --no-sys option, see the corresponding option description.
ODP (Sharding) logical database
  • -h host_name, --host= host_name
    The IP address of the ODP host.
  • -P port_num, --port= port_num
    The port number of the ODP host.
  • --logical-database
    Indicates that the ODP (Sharding) logical database is connected for export. If you specify the --logical-database option in the command line, the definition of a random physical shard is exported and cannot be directly imported to the database. You need to manually convert the physical shard schema to the logical shard schema before you can import it to the database for business use.

    Note

    If you specify the --logical-database option in the command line, the definition of a random physical shard is exported and cannot be directly imported to the database. You need to manually convert the physical shard schema to the logical shard schema before you can import it to the database for business use.

Features

File formats

Format (CLI option) Related CLI options Applicable scenarios
--csv
Specifies the CSV format for the exported data file.
  • --skip-header
    Specifies whether to ignore the header of the exported table as the CSV file header.
  • --column-delimiter 'column_delimiter_char'
    Specifies the string delimiter.
  • --line-separator 'line_separator_string'
    Specifies the line separator string.
  • --escape-character 'escape_char'
    Specifies the escape character.
  • --column-separator 'column_separator_char'
    Specifies the column separator string.
  • --with-trim
    Removes leading and trailing spaces from the data.
  • --character-set 'character_set_string'
    Specifies the character set when creating the database connection.
  • --null-string 'null_replacer_string'
    Specifies the string to replace the current column value when it is NULL. For example, if the column value in the database is NULL and the --null-string test option is used, the column will be exported as test.
  • --empty-string 'empty_replacer_string'
    Specifies the character to replace the empty character (space).
  • --file-encoding 'encode_name'
    Specifies the file encoding used when exporting the data file, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Exports data after the SCN transaction point.
Applicable to almost all business scenarios.
--cut
Specifies the CUT format for the exported data file.
  • --column-splitter 'split_string'
    Specifies the column separator string.
  • --trail-delimiter
    Specifies whether the exported data rows end with a delimiter.
  • --line-separator 'line_separator_string'
    Specifies the line separator string.
  • --with-trim
    Removes leading and trailing spaces from the data.
  • --character-set 'character_set_string'
    Specifies the character set when creating the database connection.
  • --null-string 'null_replacer_string'
    Specifies the string to replace the current column value when it is NULL. For example, if the column value in the database is NULL and the --null-string test option is used, the column will be exported as test.
  • --escape-character 'escape_char'
    Specifies the escape character.
  • --empty-string 'empty_replacer_string'
    Specifies the character to replace the empty character (space).
  • --file-encoding 'encode_name'
    Specifies the file encoding used when exporting the data file, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Exports data after the SCN transaction point.
Similar to CSV. It is generally recommended to export data in CSV format.
POS ( --cut )
POS format is also known as Fixed-Length (fixed-length) format. Unlike CSV format, it uses fields of fixed length to store data, with each field's length being predefined.

Notice

The CLI option for this format is still CUT. When using this format, you need to set the column delimiter ( --column-splitter ) to an empty character and specify the column lengths through a control file.

  • --column-splitter 'split_string'
    Specifies the column separator string.
  • --line-separator 'line_separator_string'
    Specifies the line separator string.
  • --escape-character 'escape_char'
    Specifies the escape character.
  • --file-encoding 'encode_name'
    Specifies the file encoding used when exporting the data file, which is different from the database encoding.
  • --trail-delimiter
    Specifies whether the exported data rows end with a delimiter.
Used to interact with data unloading platforms that only support fixed-length formats.
--sql
Specifies the SQL format for the exported data file.
  • --line-separator 'line_separator_string'
    Specifies the line separator string.
  • --character-set 'character_set_string'
    Specifies the character set when creating the database connection.
  • --null-string 'null_replacer_string'
    Specifies the string to replace the current column value when it is NULL. For example, if the column value in the database is NULL and the --null-string test option is used, the column will be exported as test.
  • --file-encoding 'encode_name'
    Specifies the file encoding used when exporting the data file, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Exports data after the SCN transaction point.
Applicable to almost all business scenarios.
--mix
Specifies the MIX file format.
  • --character-set 'character_set_string'
    Specifies the character set when creating the database connection.
  • --file-encoding 'encode_name'
    Specifies the file encoding used when exporting the data file, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Exports data after the SCN transaction point.
  • --compact-schema
    Exports the table definition directly using the result of the SHOW CREATE TABLE statement.
Applicable for exporting SQL files in any format. It offers better compatibility but has significantly lower performance compared to --sql.
The current implementation reads all text into memory before parsing, making it unsuitable for handling large data files.
--par
Used to identify Parquet format data files.
  • --character-set 'character_set_string'
    Used to specify the character set when creating a database connection.
  • --file-encoding 'encode_name'
    Used to specify the file encoding when exporting data files, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Used to export data after the SCN transaction point.
Backup scenarios that require a balance between data compression and export performance.
The import and export performance is similar to CSV. The compression rate is relatively high.

Note

In experimental environments, the expected compression rate is around 20%. The distribution characteristics of the data significantly affect the compression rate. For example, data with higher repetition rates have higher compression rates. We recommend that you enable parallel writing to achieve optimal performance.

--orc
Used to identify ORC format data files.
  • --character-set 'character_set_string'
    Used to specify the character set when creating a database connection.
  • --file-encoding 'encode_name'
    Used to specify the file encoding when exporting data files, which is different from the database encoding.
  • --flashback-scn 'scn_number'
    Used to export data after the SCN transaction point.
Scenarios that require extreme data compression.
The import and export performance is slightly worse than CSV. Due to known issues with third-party components (Apache ORCWriter), the memory required during export may be higher. The compression rate is generally higher than that of Parquet. However, it still depends on the data distribution. We recommend that you enable parallel writing to achieve optimal performance.
--ddl
Used to export DDL files.
  • --character-set 'character_set_string'
    Used to specify the character set when creating a database connection.
  • --file-encoding 'encode_name'
    Used to specify the file encoding when exporting data files, which is different from the database encoding.
  • --drop-object
    Used to insert DROP statements before the database object creation statements when exporting DDL files.
  • --flashback-scn 'scn_number'
    Used to export data after the SCN transaction point.
Logical backup.

Note

For more information about the command-line options, see the Options section.

Database object types

  • --all

    This option is used to export all database object definitions and table data. It is a collection of database object types such as --trigger and --view. The usage restrictions apply to specific database object types.

    • When used with --ddl, this option indicates exporting all database object definitions. For database object types applicable only to OceanBase Database Oracle mode, such as --trigger, even if you specify --all --ddl, the DDL of triggers cannot be exported in an OceanBase Database MySQL tenant.

    • When used with --csv, --sql, or --cut, this option indicates exporting all data in tables in the specified format. If you need to export all database object definitions and table data, you can specify --all and --ddl with any data format option.

    Notice

    --all is mutually exclusive with any other database object option. If both --all and any other database object option are specified, --all takes precedence.

  • --table-group 'table_group_name [,table_group_name...]' | --table-group '*'

    This option is used to export the definitions of table groups. Except for not supporting data export, the description is the same as that of the --table option.

  • --table 'table_name [,table_name...]' | --table '*'

    This option is used to export the definitions or data of tables. When used with --ddl, this option indicates exporting only the table definitions. When used with any data format option, this option indicates exporting only the table data. If multiple tables are specified, separate the table names with commas (,). By default, the names of tables in OceanBase Database Oracle mode are exported in uppercase, and the names of tables in OceanBase Database MySQL mode are exported in lowercase. For example, in OceanBase Database Oracle mode, --table 'test' and --table 'TEST' both indicate the TEST table. In OceanBase Database MySQL mode, --table 'test' and --table 'TEST' both indicate the test table. If you want to distinguish between uppercase and lowercase, enclose the table name in brackets ([ ]). For example, --table '[test]' indicates the test table, and --table '[TEST]' indicates the TEST table. If the table name is specified as an asterisk (*), all table definitions or data are exported.

    Note

    OBDUMPER 4.1.0 and later versions support exporting the definitions of temporary tables in OceanBase Database Oracle mode.

  • --view 'view_name [, view_name...]' | --view '* '

    This option is used to export the definitions of views. Except for not supporting data export, the description is the same as that of the --table option.

  • --trigger 'trigger_name [, trigger_name...]' | --trigger '*'

    This option is used to export the definitions of triggers. Except for not supporting data export, the description is the same as that of the --table option. Currently, this option applies only to OceanBase Database Oracle mode.

  • --sequence 'sequence_name [, sequence_name...]' | --sequence '*'

    This option is used to export the definitions of sequences. Except for not supporting data export, the description is the same as that of the --table option.

    Notice

    OBDUMPER 4.0.0 and earlier versions apply only to OceanBase Database Oracle mode. OBDUMPER 4.1.0 and later versions apply to both OceanBase Database MySQL and OceanBase Database Oracle modes.

  • --synonym 'synonym_name [, synonym_name...]' | --synonym '*'

    This option is used to export the definitions of synonyms. Except for not supporting data export, the description is the same as that of the --table option. Currently, this option applies only to OceanBase Database Oracle mode.

  • --type 'type_name [, type_name...]' | --type '*'

    This option is used to export the definitions of types. Except for not supporting data export, the description is the same as that of the --table option. This option applies only to OceanBase Database Oracle mode.

    Note

    Only OceanBase Database Oracle 2.2.77 and later versions support exporting type definitions.

  • --type-body 'typebody_name [, typebody_name...]' | --type-body '* '

    This option is used to export the definitions of type bodies. Except for not supporting data export, the description is the same as that of the --table option. This option applies only to OceanBase Database Oracle mode.

    Note

    This option must be used with --type. The exported type body files are saved in the type files.

  • --package 'package_name [, package_name...]' | --package '*'

    This option is used to export the definitions of packages. Except for not supporting data export, the description is the same as that of the --table option. This option applies only to OceanBase Database Oracle mode.

  • --package-body 'packagebody_name [, packagebody_name...]' | --package-body '*'

    This option is used to export the definitions of package bodies. Except for not supporting data export, the description is the same as that of the --table option. This option applies only to OceanBase Database Oracle mode.

  • --function 'function_name [, function_name...]' | --function '*'

    This option is used to export the definitions of functions. Except for not supporting data export, the description is the same as that of the --table option.

    Note

    All versions of OceanBase Database Oracle support exporting function definitions. OceanBase Database MySQL 2.2.30 and later versions support exporting function definitions.

  • --procedure 'procedure_name [, procedure_name...]' | --procedure '*'

    This option is used to export the definitions of stored procedures. Except for not supporting data export, the description is the same as that of the --table option.

    Note

    All versions of OceanBase Database Oracle support exporting stored procedure definitions. OceanBase Database MySQL 2.2.30 and later versions support exporting stored procedure definitions.

File path

  • -f 'file_path', --file-path= 'file_path'

    Specifies the absolute path on the local disk where data files are stored.

    Note

    Starting from OBDUMPER 4.2.7, you can specify -f as a specific file name when you export a single file.

    • If you specify --query-sql, the default file name CUSTOM_SQL will be replaced.
    • The log directory will be generated in the parent directory of the path specified by -f.

  • --storage-uri 'storage_uri_string'

    Specifies the uniform resource locator (URL) of the storage. Starting from OBDUMPER 4.2.0, you can export data to an Aliyun OSS bucket or an Amazon S3 bucket.

    ' storage_uri_string ' has the following syntax:

    [scheme://host]path[?parameters]
    
    parameters: key[=value],...
    

    The following table describes the components in the syntax.

    Component Description
    scheme The storage type. Valid values: Aliyun OSS/Amazon S3.
    If the specified scheme is not an OSS or S3 bucket, an error is returned.
    host The name of the storage bucket.
    When you export data to an OSS or S3 bucket, host specifies the bucket. For more information, see OSS Bucket.
    path The resource path of the storage bucket. The path must start with /.
    parameters The parameters required for the request.
    Parameters can be a single key or a key-value pair.

    Example: Export data to an S3 bucket.

    --storage-uri 's3://bucket/path?region={region}&access-key={accessKey}&secret-key={secretKey}'
    
    • s3: the scheme is s3.
    • bucket: the name of the S3 bucket.
    • path: the resource path of the S3 bucket.
    • ?region={region}&access-key={accessKey}&secret-key={secretKey}: the values of the region, access-key, and secret-key parameters.

    The following table describes the supported parameters.

    Parameter Whether a value is required Description Supported storage types Supported versions
    endpoint Yes
    • Specifies the endpoint of the OSS bucket.
    • Specifies the domain name endpoint of the S3 bucket.
    • OSS
    • S3
    • 4.2.0
    • 4.2.5
    region Yes Specifies the physical location of the S3 bucket. S3 4.2.0
    storage-class Yes Specifies the Amazon S3 storage class. S3 4.2.0
    access-key Yes Specifies the access account of the storage. OSS/S3 4.2.0
    secret-key Yes Specifies the access key of the storage. OSS/S3 4.2.0

    Notice

    • When you export the definitions of database objects and table data to an Aliyun OSS bucket, you must specify the endpoint, access-key, and secret-key parameters.
    • When you export the definitions of database objects and table data to an Amazon S3 bucket, you must specify the region, access-key, and secret-key parameters.
  • --ctl-path 'control_path'

    Specifies the absolute path on the local disk where the control file is stored. You can configure built-in processing functions in the control file. Before data export, the system will preprocess data based on the configured functions. For example: case conversion, null check, etc. For more information about the control file, see Data processing. When you specify this option in the command line, you must enclose the parameter value in single quotation marks. For example: --ctl-path '/home/controls/'.

  • --log-path 'log_path'

    Specifies the output directory of the OBDUMPER running logs. If you do not specify this option, the OBDUMPER running logs are output to the directory specified by the -f option by default. In most cases, you do not need to use redirection to output logs.

  • --no-nested-dir

    Exports data to a flat directory structure. All files are exported to the directory specified by -f or --storage-uri, and no subdirectories are created.

Other options

  • -H, --help

    Displays the help information for the CLI tool.

  • -V, --version

    Displays the version number of the current tool.

Advanced options

Feature options

Time stamp format

  • --flashback-timestamp 'timestamp_string'

    Specifies the timestamp for flashback. This option can be used only with any data format option, and cannot be used with the --query-sql option. This option is applicable only to OceanBase Database in Oracle mode.

  • --nls-date-format 'date-format-string'

    Specifies the nls_date_format session variable in OceanBase Database in Oracle mode. This option does not specify the export format for DATE type data. Default value: YYYY-MM-DD HH24:MI:SS.

  • --nls-timestamp-format 'timestamp-format-string'

    Specifies the nls_timestamp_format session variable in OceanBase Database in Oracle mode. This option does not specify the export format for TIMESTAMP type data. Default value: YYYY-MM-DD HH24:MI:SS:FF9.

  • --nls-timestamp-tz-format 'timestamp-tz-format-string'

    Specifies the nls_timestamp_tz_format session variable in OceanBase Database in Oracle mode. This option does not specify the export format for TIMESTAMP WITH TIME ZONE type data. Default value: YYYY-MM-DD HH24:MI:SS:FF9 TZR.

  • --date-value-format

    Specifies the export format for DATE type data. In OceanBase Database in MySQL mode, the default export format for DATE type data is yyyy-MM-dd. In OceanBase Database in Oracle mode, the default export format for DATE type data is yyyy-MM-dd HH:mm:ss.

    Note

    • This option can be used only with the --csv or --cut option.
    • In OceanBase Database in MySQL mode, this option does not support setting the export format for DATE type data when the value is zero.
  • --time-value-format

    Specifies the export format for TIME type data. In OceanBase Database in MySQL mode, the default export format for TIME type data is HH:mm:ss. The precision value is consistent with the precision value defined in the table.

    Note

    • This option can be used only with the --csv or --cut option.
    • In OceanBase Database in MySQL mode, this option does not support setting the export format for TIME type data when the value is zero.
  • --datetime-value-format

    Specifies the export format for DATETIME type data. In OceanBase Database in MySQL mode, the default export format for DATETIME type data is yyyy-MM-dd HH:mm:ss. The precision value is consistent with the precision value defined in the table.

    Note

    • This option can be used only with the --csv or --cut option.
    • In OceanBase Database in MySQL mode, this option does not support setting the export format for DATETIME type data when the value is zero.
  • --timestamp-value-format

    Specifies the export format for TIMESTAMP type data. In OceanBase Database in MySQL or Oracle mode, the default export format for TIMESTAMP type data is yyyy-MM-dd HH:mm:ss.SSSSSS. The precision value is consistent with the precision value defined in the table.

    Note

    • This option can be used only with the --csv or --cut option.
    • In OceanBase Database in MySQL mode, this option does not support setting the export format for TIMESTAMP type data when the value is zero.
  • --timestamp-tz-value-format

    Specifies the export format for TIMESTAMP WITH TIME ZONE type data. In OceanBase Database in Oracle mode, the default export format for TIMESTAMP WITH TIME ZONE type data is yyyy-MM-dd HH:mm:ss.SSSSSS. The precision value is consistent with the precision value defined in the table.

    Note

    This option can be used only with the --csv or --cut option.

  • --timestamp-ltz-value-format

    Specifies the export format for TIMESTAMP WITH LOCAL TIME ZONE type data. In OceanBase Database in Oracle mode, the default export format for TIMESTAMP WITH LOCAL TIME ZONE type data is yyyy-MM-dd HH:mm:ss. The precision value is consistent with the precision value defined in the table.

    Note

    This option can be used only with the --csv or --cut option.

  • --preserve-zero-datetime

    Specifies the original format of zero values of DATE, TIME, DATETIME, and TIMESTAMP types during export. If you specify this option, the values of non-nullable DATE, TIME, DATETIME, and TIMESTAMP columns that are NULL are exported as 0. The values of nullable DATE, TIME, DATETIME, and TIMESTAMP columns that are NULL are exported as NULL. This option supports setting the export format for DATE, DATETIME, and TIMESTAMP types in MySQL mode.

Allowlist- and blocklist-based filtering

  • Table-level filtering

    • --exclude-table 'table_name [, table_name...]'

      Specifies tables to be excluded when exporting table definitions or data. Table names support pattern matching.

      Example: --exclude-table 'test1,test*,*test,te*st'

      The preceding parameter specifies the following tables to be excluded when exporting table definitions or data:

      • test1

      • All tables whose names start with test.

      • All tables whose names end with test.

      • All tables whose names start with te and end with st.

    • --exclude-data-types 'datatype [, datatype...]'

      Specifies data types to be excluded when exporting data.

    • --add-extra-message

      Specifies whether to export additional information in table definitions. For example, when you specify the --add-extra-message option, the program exports the table group name of each table. By default, OBDUMPER does not export additional information in table definitions.

      Notice

      When you specify the --add-extra-message option, the program exports the table group name of each table. This option depends on the privileges of the sys tenant. If OBDUMPER does not have the privileges of the sys tenant, do not specify this option.

    • --retain-empty-files

      Specifies whether to generate an empty file when exporting an empty table. If you do not specify this option, no file is generated when exporting an empty table.

  • Column-level filtering

    • --include-column-names 'column_name [, column_name...]'

      Specifies columns and their order to be exported.

    • --exclude-column-names 'column_name [, column_name...]'

      Specifies columns to be excluded when exporting data. Column names do not support pattern matching.

      Notice

      The specified column names must match the case of the column names in the table definition.

    • --where 'where_condition_string'

      Specifies data to be exported that meets the specified conditions. This option can be used only with any of the data format options, not with the --query-sql option.

    • --partition 'partition_name [, partition_name...]'

      Specifies partitions to be exported. The parameter value is the partition name, and multiple partition names are separated by commas. This option can be used only with any of the data format options, not with the --query-sql option.

      Notice

      • When you specify partitions to be exported, for a subpartitioned table, you must specify the subpartition name. You cannot export data by using the partition name. For a subpartitioned table based on a template, the partition name is the partition name + s + subpartition name.
      • When you specify the --partition option to export data in a partition, for a composite partitioned table, you must specify the subpartition name. OBDUMPER cannot export data in the partition. If the specified partition name does not exist, OBDUMPER returns an error.
    • --query-sql 'select_statement'

      Specifies a custom query statement to be exported. This option cannot be used with the --partition or --where option. You must ensure the correctness and performance of the custom query statement. If you export the result set of a large query statement, you may have to wait for a long time for the database to respond. If you need to preprocess data by using a control file during the export, you must specify the --table and --ctl-path options. The table name specified by the --table option must match the file name specified by the --ctl-path option in case. If you do not need to preprocess data, you can specify any table name for the --table option.

    • --exclude-virtual-columns

      Specifies whether to export generated columns (generated columns are exported by default).

    • --enable-hidden-pk

      Specifies whether to use the hidden primary key __pk_increment for tables without a primary key to improve the export speed. In OceanBase Database versions earlier than 4.0.0, you must use a special user to export data by specifying this option. Example:

      # In MySQL mode of OceanBase Database, create a special user and grant privileges to it as the root user.
      create user '__oceanbase_inner_drc_user'@'%' IDENTIFIED BY 'u*******';
      grant ALL on *.* to '__oceanbase_inner_drc_user' WITH GRANT OPTION;
      
      # In Oracle mode of OceanBase Database, create a special user and grant privileges to it as the SYS user.
      create user '__OCEANBASE_INNER_DRC_USER'@'%' IDENTIFIED BY u*******;
      grant ALL to '__OCEANBASE_INNER_DRC_USER';
      
    • --fetch-size 'int_num'

      Specifies the number of rows to be read from the database cursor in Oracle mode of OceanBase Database. Default value: 1000. For more information, see OceanBase FetchSize.

      Note

      You must install the OceanBase JDBC driver.

Error handling

  • --retry

    Specifies whether to continue the export task from the position where the previous export failed.

    Notice

    The dump.ckpt file is a checkpoint file generated during the tool run. The file is stored in the directory specified by the -f option. If the dump.ckpt file does not exist, you cannot use this option.

  • --weak-read

    Specifies whether to export data from a standby replica. For more information about weak-consistency reads, see Weak-consistency reads.

  • --max-file-size int_num

    Specifies the maximum amount of data that can be exported by a process. The export task is stopped when the exported data exceeds this value.

  • --skip-check-dir

    Specifies whether to skip the check of whether the export data directory is empty. If the export directory is not empty, the export task is stopped.

    Note

    • If you do not specify this option, OBDUMPER checks whether the directory is empty. If the export directory is not empty, OBDUMPER returns an error and exits.
    • If you specify this option, OBDUMPER skips the check of whether the directory is empty. However, the exported files may overwrite the data of files with the same name in the directory.
  • --remove-newline

    Specifies whether to forcibly delete carriage return characters or line break characters from the exported data. For example, ***\r***, ***\n***, or ***\r\n***. This option modifies only the data read into memory and does not modify the data in the source table. This option can be used only with the --cut option.

    Notice

    If the source table contains carriage return characters or line break characters, the exported data will be inconsistent with the source table data. Before you use this option, make sure that deleting \r, \n, and \r\n characters will not affect your business. If you do not want to delete carriage return characters or line break characters from the data, do not specify this option in the command line to avoid data inconsistency.

  • --snapshot

    Specifies whether to export data of historical versions. This option can be used only with a data format option. Exporting data of historical versions ensures global consistency of the exported data. If you do not specify this option, the exported data may not be a globally consistent snapshot.

Performance options

  • --page-size int_num

    Specifies the size of the task shard for OBDUMPER 4.0.0 and later. Default value: 1000000.

  • --thread int_num

    Specifies the number of concurrent threads. This option directly corresponds to the number of export threads. The default value is CPU multiplied by 2. If the CPU count exceeds 16, the maximum value is 32. When exporting the definitions of multiple database objects, we recommend that you set the value of the --thread option to no more than 4. If the number of concurrent threads is too large, the tool may fail to access system tables in the sys tenant. In this case, a timeout error occurs during the export.

  • --block-size

    Specifies the threshold for splitting a file block. This option supports the LONG and STRING data types. If the size of the exported data file exceeds the threshold, other logical subfiles are generated sequentially. The unit of this option is MB by default. The default value is 1024 MB. This option does not take effect for the ORC and Parquet formats.

    OBDUMPER V4.1.0 and later support splitting files based on the number of rows. The value of --block-size is specified in MB or rows. For example, --block-size 256ROW specifies that the size of a single file does not exceed 256 rows. --block-size 1024 or --block-size 1024MB specifies that the size of a single file does not exceed 1024 MB. The 1024M or 1GB format is not supported.

  • --parallel-macro int_num

    Specifies the number of macroblocks that a thread can process. Default value: 8.

Other options

  • --session-config

    Specifies the connection configuration file. A default configuration file, session.config.json, is provided in the <tool root directory>/conf/ directory. You do not need to configure it. We recommend that you specify this option only when you want to use the same package to load multiple connection configurations.

Options

Option Required Description Version Deprecated
-h(--host) Yes The IP address of the host to which you connect to the ODP or OceanBase physical node.
-P(--port) Yes The port of the host to which you connect to the ODP or OceanBase physical node.
-u(--user) Yes The username of the database user, the tenant name, and the cluster name. The format is: user@tenant#cluster. Yes
-p(--password) No The password of the database user.
-D(--database) Yes The name of the database.

Note

OBDUMPER can export data of only one database at a time.

-f(--file-path) Yes The directory to which the data is exported.
--no-nested-dir No Specifies that no directory is exported. 4.2.7
--sys-user No The username of the sys tenant.
--sys-password No The password of the sys tenant.
--public-cloud No The running environment of cloud databases of OceanBase.
--log-path No The directory to which the log file is exported.
--ddl No Exports a DDL file.
A DDL file is a definition file of the exported database objects. The naming convention is object name-schema.sql. If you specify this option, only the definitions of the database objects are exported, and no data is exported. When you export the definitions of multiple table objects, we recommend that you set the value of the --thread option to no more than 4. Otherwise, the number of concurrent connections to the internal views of the sys tenant will be too large, which will cause a timeout error when you export data.
--csv No Exports data in CSV format. (Recommended)
A CSV file stores data in standard CSV format. The naming convention is table name.csv. For more information about the CSV format, see the definition in RFC 4180. The most common delimiter is a single quotation mark or a double quotation mark. If the data contains a delimiter, you must escape it by specifying an escape character. We recommend that you use the CSV format. We recommend that you use this option with the --table option. If you use this option with the --all option, OBDUMPER exports only the data in the tables, and does not export the definitions of the database objects.
--sql No Exports data in SQL format. (Different from a DDL file)
An SQL file stores data in INSERT statement format. The naming convention is table name.sql. Each line of data in the file corresponds to an executable INSERT statement. The content format of an SQL file is clearly different from that of a DDL file. We recommend that you use this option with the --table option. If you use this option with the --all option, OBDUMPER exports only the data in the tables, and does not export the definitions of the database objects.
--orc No Exports data in ORC format.
An ORC file stores data in columnar format. The naming convention is table name.orc. For more information about the ORC format, see the definition in Apache ORC.
4.0.0
--par No Exports data in Parquet format.
A Parquet file stores data in columnar format. The naming convention is table name.parquet. For more information about the Parquet format, see the definition in Apache Parquet.
V4.0.0
--cut No Exports data in CUT format.
A CUT file stores data in string-separating format. The naming convention is table name.dat. We recommend that you use this option with the --table option. If you use this option with the --all option, OBDUMPER exports only the data in the tables, and does not export the definitions of the database objects.

Notice

In CUT format, data is stored in rows. If the field separator is a single character, OBDUMPER escapes the separator, carriage return, or line break in the data. For example, if the data is abc|def and the separator is |, the exported data is abc\|def.

--all No Exports the definitions of all supported database objects and the data in all tables.
--table-group No Exports the definition of a table group. 3.1.0
--table No Exports the definition or data of a table.
--view No Exports the definition of a view.
--function No Exports the definition of a function.
--procedure No Exports the definition of a stored procedure.
--trigger No Exports the definition of a trigger.
--sequence No Exports the definition of a sequence.
--synonym No Exports the definition of a synonym. (Not supported for MySQL tenants)
--type No Exports the definition of a type. 4.0.0
--type-body No Exports the definition of a type body.
--package No Exports the definition of a package.
--package-body No Exports the definition of a package body.
--drop-object No When exporting DDL statements, adds the DROP statement at the beginning. This option is only used with the --ddl option.
--distinct No Exports non-repeating data from a table. Yes
--with-trim No Removes leading and trailing whitespace characters from data. 4.2.0
--weak-read No Exports data from a standby replica. (Different from a standby cluster)
--query-sql No Exports the result set of a custom query SQL statement.
--snapshot No Exports data from the latest major compaction version.
--where No Exports data that meets the specified conditions.
--partition No Exports data from a specified partition.
--skip-header No Ignores the fields in the exported table for CSV format.
--trail-delimiter No Removes the last column delimiter at the end of a row.
--null-string No When the value of the current column is NULL, the value of the column is replaced with the specified string. Default value: \N. This option is only used with the --csv or --cut option. Default value: \N.
--empty-string No Replaces the empty character (' ') with the specified character. Default value: \E. This option is only used with the --csv or --cut option. Default value: \E.
--line-separator No Specifies the line separator. The default value varies with the system platform and can be one of the following: \r, \n, or \r\n.
--file-encoding No Specifies the file encoding. (Different from the database encoding)
When specifying this option on the command line, enclose the parameter value in single quotes. For example: --file-encoding 'GBK'. Default value: UTF-8.
--column-separator No Specifies the column separator. This option supports only single-character separators and is only used with the --csv option. Default value: comma. (Different from the column separator string in CUT format)
--escape-character No Specifies the escape character. This option supports only single-character escape characters and can be used only with the --csv or --cut option. Default value: \.

Note

To specify this option as a special (invisible) character, use the HEX representation.

--column-delimiter No Specifies the column delimiter. This option supports only single-character column delimiters and can be used only with the --csv option. Default value: single quote (').
--column-splitter No Specifies the column separator string. (Different from the column delimiter in the CSV format)
--flashback-scn No Specifies the data to be exported after the flashback transaction point.
This option can be used only with any data format option and cannot be used with the --query-sql option.
--flashback-timestamp No Specifies the data to be exported after the flashback timestamp. (Supported only in OceanBase Database Oracle mode 2.2.70 and later)
--nls-date-format No Sets the session-level date and time format. (Supported only in OceanBase Database Oracle mode)
--nls-timestamp-format No Sets the session-level timestamp format. (Supported only in OceanBase Database Oracle mode)
--nls-timestamp-tz-format No Sets the session-level timestamp format with time zone. (Supported only in OceanBase Database Oracle mode)
--retry No Exports data from the last savepoint.
--ctl-path No Specifies the directory where the control file is stored.
--exclude-table No Excludes the export of the specified table definition and table data.
--exclude-column-names No Excludes the export of data corresponding to the specified column names.
--exclude-data-types No Excludes the export of data corresponding to the specified data types.
--include-column-names No Exports data in the specified column order.
--remove-newline No Forces the removal of newline or carriage return characters from the data. (Applicable only to the CUT format)
--max-file-size No Sets the maximum amount of data that can be exported by a process. Unit: Byte.
--skip-check-dir No Skips checking whether the export directory is empty. (The export directory must be empty.)
--retain-empty-files No Generates an empty file when exporting an empty table.
--add-extra-message No Exports additional information such as table groups in the CREATE TABLE statement.
--page-size No The page size for query statements. Default value: 1000000.
--thread No The concurrency level of the export task.
--block-size No Specifies the file split size. Default value: 1024 MB.
--parallel-macro No Specifies the number of macroblocks processed by each export thread.
--fetch-size No Specifies the number of rows read from the database cursor each time in OceanBase Database Oracle mode. 4.2.0
-V(--version) No Displays the version of the OBDUMPER tool.
--date-value-format No Sets the export format for DATE type. 3.2.0
--time-value-format No Sets the export format for TIME type in OceanBase Database MySQL mode. 3.2.0
--datetime-value-format No Sets the export format for DATETIME type in OceanBase Database MySQL mode. 3.2.0
--timestamp-value-format No Specifies the export format of the TIMESTAMP type in OceanBase Database in MySQL or Oracle mode. 3.2.0
--timestamp-tz-value-format No Specifies the export format of the TIMESTAMP WITH TIME ZONE type in OceanBase Database in Oracle mode. 3.2.0
--timestamp-ltz-value-format No Specifies the export format of the TIMESTAMP WITH LOCAL TIME ZONE type in OceanBase Database in Oracle mode. 3.2.0
--exclude-virtual-columns No Indicates whether to exclude the data of generated columns (the data of generated columns is exported by default). 3.2.0
--no-sys No Indicates that the sys tenant password cannot be provided in the OceanBase Database environment. 3.3.0
--logical-database No Indicates whether to connect to the ODP (Sharding) logical database for export. 3.3.0
--storage-uri No Specifies the uniform resource locator (URL) of the storage. 4.2.0
--character-set No Specifies the character set when creating a database connection.
Default value: the value of the jdbc.url.character.encoding parameter in the session variables section of the session.properties file. The value specified by the --character-set option overrides the value of the jdbc.url.character.encoding parameter. The supported character sets include binary, gbk, gb18030, utf16, and utf8mb4.
4.2.4
--preserve-zero-datetime No Indicates whether to preserve the original format of the zero value of the time type during export. 4.2.4
--enable-hidden-pk No Use a hidden primary key for tables without a primary key. 4.2.5
--session-config No Specifies the connection configuration file. 4.2.6
--compact-schema No Export the table definition based on the result returned by SHOW CREATE TABLE.

Note

Using this option may result in missing some table creation information, such as the primary zone. We recommend that you use this option only when performance issues occur.

4.2.8
-H(--help) No View the help information of the OBDUMPER CLI tool.

Contact Us