OBDUMPER specifies the information to be exported through command-line options. For more information about the options and their usage, see Options and Usage examples.
Overview of options
Option styles
OBDUMPER supports two styles for parameter design: Unix and GNU.
In the Unix style, a single hyphen (-) is added before the parameter, and the option is a single character. For example:
ps -e. In this style, a space is not required between the option and the parameter. For example:-p******.In the GNU style, two hyphens (--) are added before the long parameter, and the option can be a single character or a string. For example:
ps --version. In this style, a space is required between the option and the parameter. For example:--table 'test'.
Option categories
OBDUMPER command-line options are divided into basic options and advanced options.
Basic options: These are the commonly used options of OBDUMPER, including connection options (database mode), feature options (file format, database object type, storage path), and other options.
Advanced options: These include feature options (timestamp format, table/column blocklist and allowlist filtering, error handling) and performance options.
Required options
When you use OBDUMPER to export data, you must specify at least the connection options, format options, database object type options, and storage path options.
Sample statement:
$./obdumper -h xx.x.x.x -P 2883 -u test@mysql#cluster_a -p ****** -D USERA --csv --table '*' -f /output
In this statement, -h, -P, -u, -p, and -D are connection options; --csv is a file format option; --table is a database object type option; and -f is a storage path option.
Basic options
Connection options
The OBDUMPER command needs to be connected to OceanBase Database to read and write data. You can specify the following options to connect to OceanBase Database.
Export types
| Export type | Related command-line options |
|---|---|
| OceanBase Database |
|
| Cloud Database OceanBase | --public-cloud Indicates that the database objects or table data of the OceanBase cluster where OceanBase Database is deployed are to be exported to a file. If this option is specified on the command line, the tenant name and cluster name connection options ( -u <user>@<tenant>#<cluster>) are not required, and the --no-sys option is enabled by default. For more information about the --no-sys option, see the description of this option. |
| ODP (Sharding) logical database |
|
Feature options
File formats
| Format (command-line option) | Related command-line options | Scenarios |
|---|---|---|
| --csv Specifies the data file in the CSV format. |
|
Applies to almost all scenarios. |
| --cut Specifies the data file in the CUT format. |
|
Refer to CSV. It is recommended to export data in the CSV format. |
| POS (--cut) Fixed-length format. Unlike the CSV format, the fixed-length format stores data in fields of predefined lengths. NoticeThe command-line option remains CUT. When you use this option, you must specify the column delimiter (--column-splitter) as an empty string and set the column lengths through the control file. |
|
Applies to data unloading platforms that support only the fixed-length format. |
| --sql Specifies the data file in the SQL format. |
|
Applies to almost all scenarios. |
| --par Specifies the data file in the Parquet format. |
|
Applies to backup scenarios that require high data compression and export performance. The import and export performance is similar to that of the CSV format. The compression rate is high. NoteIn an experimental environment, the expected compression rate is about 20%. The distribution of data greatly affects the compression rate. For example, data with a high rate of repetition compresses more. We recommend that you enable parallel writes to achieve the best performance. |
| --orc Specifies the data file in the ORC format. |
|
Applies to scenarios that require extreme data compression. The import and export performance is slightly worse than that of the CSV format. Due to known issues with the Apache ORCWriter component, the memory required for export may be high. The compression rate is generally higher than that of Parquet, but it still depends on the data distribution. We recommend that you enable parallel writes to achieve the best performance. |
| --ddl Specifies the DDL file. |
|
Applies to logical backup. |
| --avro Specifies the data file in the Avro format. |
|
Applies to big data scenarios, including AP offline migration. |
Note
For more information about the command-line options, see the description of Options.
Compress and export
In DataArts Studio V4.3.0 and later, you can compress and export readable file formats such as CSV, CUT, POS, and SQL. You can configure the following command-line options.
--compress
A boolean value that specifies whether to compress the exported data.
--compression-algo
A string that specifies the compression algorithm. Valid values: zstd, zlib, gzip, and snappy. Default value: zstd.
--compression-level
An integer that specifies the compression level of the specified compression algorithm. The supported compression levels vary with the compression algorithm:
For zstd, the supported values range from 1 to 22. Default value: 3.
For zlib, the supported values range from -1 to 9. Default value: -1.
For gzip and snappy, you cannot specify the compression level.
Database object types
--all
Specifies to export the definitions of all database objects and the data of all tables. It is a collection of database object types such as
--triggerand--view. The usage restrictions vary with the specific database object type.When used with the
--ddloption, it specifies to export the definitions of all database objects. For database object types such as--triggerthat apply only to the Oracle compatible mode of OceanBase Database, if--all --ddlis specified in the MySQL compatible mode of OceanBase Database, triggers cannot be exported.When used with any data format option such as
--csv,--sql, or--cut, it specifies to export the data of all tables in the corresponding format. If you want to export the definitions of all database objects and the data of all tables, you can specify the--allor--ddloption in combination with any data format option.
Notice
The
--alloption is mutually exclusive with any database object option. You cannot specify both the--alloption and any database object option at the same time. If you specify both the--alloption and any database object option, the--alloption takes precedence.--table-group 'table_group_name [,table_group_name...]' | --table-group '*'
Specifies to export the definitions of table groups. Except for not supporting data export, the description is the same as that of the
--tableoption.--table 'table_name [,table_name...]' | --table '*'
Specifies to export the definitions or data of tables. When used with the
--ddloption, it specifies to export only the definitions of tables. When used with any data format option such as--csv,--sql, or--cut, it specifies to export only the data of tables in the corresponding format. If multiple tables are to be exported, the table names are separated with commas (,). By default, the names of tables in an Oracle-compatible tenant of OceanBase Database are exported in uppercase, and the names of tables in a MySQL-compatible tenant of OceanBase Database are exported in lowercase. For example, in the Oracle compatible mode of OceanBase Database, both--table 'test'and--table 'TEST'specify the TEST table; in the MySQL compatible mode of OceanBase Database, both--table 'test'and--table 'TEST'specify the test table. If you want to distinguish the cases, enclose the table name in square brackets ([ ]). For example,--table '[test]'specifies the test table, and--table '[TEST]'specifies the TEST table. If the table name is specified as an asterisk (*), all table definitions or data are exported.Note
- OBDUMPER does not support the export of internal tables or internal views of OceanBase Database.
- OBDUMPER V4.1.0 and later support the export of temporary table definitions in the Oracle compatible mode of OceanBase Database.
--view 'view_name [, view_name...]' | --view '* '
Specifies to export the definitions of views. Except for not supporting data export, the description is the same as that of the
--tableoption.--trigger 'trigger_name [, trigger_name...]' | --trigger '*'
Specifies to export the definitions of triggers. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.--obj-user 'user_name [, user_name...]' | --obj-user '*'
Specifies to export the definitions of users. Except for not supporting data export, the description is the same as that of the
--tableoption.Notice
In
--public-cloudmode, the--obj-useroption is not supported.The privileges of a user in the Oracle compatible mode of OceanBase Database do not include
BECOME USER, which is skipped by default.
User requirements: The login user must be an administrator or a user with the
dba_usersprivilege in the Oracle compatible mode of OceanBase Database; or the login user must be an administrator or a user with themysql.usertable privilege in the MySQL compatible mode of OceanBase Database.By default, the following users are ignored:
In the MySQL compatible mode of OceanBase Database:
root,proxyro,standbyro,ORAAUDITOR, and__oceanbase_inner_drc_user.In the Oracle compatible mode of OceanBase Database:
SYS,proxyro,standbyro,PUBLIC,ORAAUDITOR,LBACSYS, and__OCEANBASE_INNER_DRC_USER.
--role 'role_name [, role_name...]' | --role '*'
Specifies to export the definitions of roles. Except for not supporting data export, the description is the same as that of the
--tableoption.Notice
In
--public-cloudmode, the--roleoption is not supported.User requirements: It applies only to the Oracle compatible mode of OceanBase Database. The login user must be an administrator or a user with the
dba_usersprivilege.By default, the following roles are ignored:
CONNECT,RESOURCE,DBA,PUBLIC, andSTANDBY_REPLICATION.
--sequence 'sequence_name [, sequence_name...]' | --sequence '*'
Specifies to export the definitions of sequences. Except for not supporting data export, the description is the same as that of the
--tableoption.Notice
OBDUMPER V4.0.0 and earlier versions apply only to the Oracle compatible mode of OceanBase Database. OBDUMPER V4.1.0 and later apply to both the MySQL compatible mode and the Oracle compatible mode of OceanBase Database.
The optional
--sequence-policyoption can have the valuesrestartandpreserve, withpreserveas the default.By default or when
preserveis specified, the start value is set to the current value of the sequence during export.When
restartis specified, the start value is set to the original definition of the sequence, and the sequence is exported as is.
--synonym 'synonym_name [, synonym_name...]' | --synonym '*'
Specifies to export the definitions of synonyms. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.--type 'type_name [, type_name...]' | --type '*'
Specifies to export the definitions of types. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.Note
Only OceanBase Database V2.2.77 and later in the Oracle compatible mode support the export of type definitions.
--type-body 'typebody_name [, typebody_name...]' | --type-body '* '
Specifies to export the definitions of type bodies. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.Note
This option must be used in combination with
--type. The type body file is saved in the type file.--package 'package_name [, package_name...]' | --package '*'
Specifies to export the definitions of packages. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.--package-body 'packagebody_name [, packagebody_name...]' | --package-body '*'
Specifies to export the definitions of package bodies. Except for not supporting data export, the description is the same as that of the
--tableoption. It applies only to the Oracle compatible mode of OceanBase Database.--function 'function_name [, function_name...]' | --function '*'
Specifies to export the definitions of functions. Except for not supporting data export, the description is the same as that of the
--tableoption.Note
Function definitions can be exported in all versions of OceanBase Database in the Oracle compatible mode. Function definitions can be exported in OceanBase Database V2.2.30 and later in the MySQL compatible mode.
--procedure 'procedure_name [, procedure_name...]' | --procedure '*'
Specifies to export the definitions of stored procedures. Except for not supporting data export, the description is the same as that of the
--tableoption.Note
Stored procedure definitions can be exported in all versions of OceanBase Database in the Oracle compatible mode. Stored procedure definitions can be exported in OceanBase Database V2.2.30 and later in the MySQL compatible mode.
Storage path
-f 'file_path', --file-path= 'file_path'
Specifies the absolute path on the local disk where the data file is stored.
Note
When you use OBDUMPER V4.2.7 or later, you can specify a specific file name for
-fwhen you export a single file.- If you specify
--query-sql, the default file nameCUSTOM_SQLwill be replaced. - The
logdirectory will be generated in the parent directory of the path specified by-f.
OBDUMPER allows you to export database object definitions and table data to a local disk, Alibaba Cloud OSS, Amazon S3, Tencent Cloud Object Storage (COS), and Huawei Cloud Object Storage Service (OBS). The syntax is as follows:
[scheme://host]path[?parameters] parameters: key[=value]&...Component Description scheme The supported storage type. Valid values: OSS, S3, COS, and OBS.
If the specified scheme is not OSS, S3, COS, or OBS, an error will be returned.host The name of the storage space.
When you export data to OSS, S3, COS, or OBS, host represents the bucket name. For more information, see OSS bucket.path The resource path of the storage space. The path must start with /.parameters The parameters required for the request.
parameters can be a single key or a key-value pair.The supported parameters are as follows:
Parameter Whether a value is required Description Supported storage types The version of the data export tool that first supports this parameter endpoint Yes - The endpoint of the region where the host is located.
- The domain name endpoint for accessing OSS/S3/COS/OBS.
oss://ssmp-xxxx-xxxx/test?endpoint=oss-cn-shenzhen-internal.aliyuncs.com.OSS/S3/COS/OBS - OSS: V4.2.0
- S3: V4.2.5
- COS/OBS: V4.3.0
region Yes The region where the endpoint is located. OSS/S3/COS/OBS - OSS/S3: V4.2.0
- COS/OBS: V4.3.0
storage-class Yes The Amazon S3 storage class. S3 4.2.0 access-key Yes The access account for the storage. OSS/S3/COS/OBS - OSS/S3: V4.2.0
- COS/OBS: V4.3.0
secret-key Yes The access key for the storage. OSS/S3/COS/OBS - OSS/S3: V4.2.0
- COS/OBS: V4.3.0
Here are some examples:
Export data to a local disk
-f '/home/admin/foo/bar'Export data to S3
-f 's3://bucket/path?region={region}&access-key={accessKey}&secret-key={secretKey}'Export data to OSS
-f 'oss://mybucket/foo/bar?endpoint=myendpoint&access-key=myak&secret-key=mysk'Export data to COS
-f 'cos://mybucket/foo?region=ap-shanghai&access-key=myak&secret-key=mysk' -f 'cos://mybucket/foo?endpoint=yourendpoint&access-key=myak&secret-key=mysk'Export data to OBS
-f 'obs://mybucket/foo?region=cn-north-1&access-key=myak&secret-key=mysk' -f 'obs://mybucket/foo?endpoint=yourendpoint&access-key=myak&secret-key=mysk'
- If you specify
--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 is exported, the system preprocesses the data based on the configured functions. For example, the system can convert the case of characters and check for empty values. For more information about control files, see Data processing. When you specify this option on the command line, enclose the parameter value in single quotation marks. For example:
--ctl-path '/home/controls/'.--log-path 'log_path'
Specifies the output directory for OBDUMPER running logs. If you do not specify this option on the command line, OBDUMPER running logs are output to the directory specified by the
-foption. In most cases, you do not need to use redirection to output logs.--no-nested-dir
Specifies to export a flat directory structure. All files are exported to the directory specified by
-fwithout generating any subdirectories.By default, OBDUMPER uses the multipart upload method to export data to an object storage system and uses the local file system as the temporary directory (which can be changed by using the
--tmp-pathoption) to store file fragments. You can modify the following parameters in the OBDUMPER startup script to adapt to the actual data export environment.upload.buffer.type
Specifies the buffer type. Valid values:
diskandbytebuffer.diskis the default value. It uses disks to store file fragments and is limited by the maximum available disk space.bytebufferuses memory to store file fragments, which offers better performance but consumes a large amount of JVM heap memory.upload.buffer.size
Specifies the size of each file fragment in bytes. The default value is 64 MB.
upload.active.blocks
Specifies the maximum number of file fragments that can exist simultaneously for each write thread (which may be in the process of uploading or waiting in the queue for upload). The default value is 2. When the number of file fragments exceeds this value, the program will block until one of the file fragments is uploaded and removed from the waiting queue.
The
--threadoption limits the maximum number of write threads. You can use the formulathread * active.blocks * buffer.sizeto estimate the space that the buffer may occupy during program operation.
Other options
-H, --help
Displays the help information for the command-line tool.
-V, --version
Displays the version number of the current release.
Advanced options
Feature options
Timestamp formats
--flashback-timestamp 'timestamp_string'
Specifies the flashback point after which data is exported. This option can be used only with any one of the data format options and cannot be used with the
--query-sqloption. This option applies only to the Oracle compatible mode of OceanBase Database.--nls-date-format 'date-format-string'
Specifies the nls_date_format session variable in the Oracle compatible mode of OceanBase Database. This option does not indicate that data of the DATE type is exported in the specified format. Default value: YYYY-MM-DD HH24:MI:SS.
--nls-timestamp-format 'timestamp-format-string'
Specifies the nls_timestamp_format session variable in the Oracle compatible mode of OceanBase Database. This option does not indicate that data of the TIMESTAMP type is exported in the specified format. 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 the Oracle compatible mode of OceanBase Database. This option does not indicate that data of the TIMESTAMP WITH TIME ZONE type is exported in the specified format. Default value: YYYY-MM-DD HH24:MI:SS:FF9 TZR.
--date-value-format
Specifies the export format for the DATE type. In the MySQL compatible mode of OceanBase Database, the default format for the DATE type is yyyy-MM-dd. In the Oracle compatible mode of OceanBase Database, the default format for the DATE type is yyyy-MM-dd HH:mm:ss.
Note
- This option can be used only with the
--csvor--cutoption. - In the MySQL compatible mode of OceanBase Database, if the DATE value is zero, this option does not support setting the format for the DATE type.
- This option can be used only with the
--time-value-format
Specifies the export format for the TIME type. In the MySQL compatible mode of OceanBase Database, the default format for the TIME type is HH:mm:ss, and the precision is the same as that in the table definition.
Note
- This option can be used only with the
--csvor--cutoption. - In the MySQL compatible mode of OceanBase Database, if the TIME value is zero, this option does not support setting the format for the TIME type.
- This option can be used only with the
--datetime-value-format
Specifies the export format for the DATETIME type. In the MySQL compatible mode of OceanBase Database, the default format for the DATETIME type is yyyy-MM-dd HH:mm:ss, and the precision is the same as that in the table definition.
Note
- This option can be used only with the
--csvor--cutoption. - In the MySQL compatible mode of OceanBase Database, if the DATETIME value is zero, this option does not support setting the format for the DATETIME type.
- This option can be used only with the
--timestamp-value-format
Specifies the export format for the TIMESTAMP type. In the MySQL compatible mode of OceanBase Database, the default format for the TIMESTAMP type is yyyy-MM-dd HH:mm:ss.SSSSSS, and the precision is the same as that in the table definition.
Note
- This option can be used only with the
--csvor--cutoption. - In the MySQL compatible mode of OceanBase Database, if the TIMESTAMP value is zero, this option does not support setting the format for the TIMESTAMP type.
- This option can be used only with the
--timestamp-tz-value-format
Specifies the export format for the TIMESTAMP WITH TIME ZONE type. In the Oracle compatible mode of OceanBase Database, the default format for the TIMESTAMP WITH TIME ZONE type is yyyy-MM-dd HH:mm:ss.SSSSSS, and the precision is the same as that in the table definition.
Note
This option can be used only with the
--csvor--cutoption.--timestamp-ltz-value-format
Specifies the export format for the TIMESTAMP WITH LOCAL TIME ZONE type. In the Oracle compatible mode of OceanBase Database, the default format for the TIMESTAMP WITH LOCAL TIME ZONE type is yyyy-MM-dd HH:mm:ss, and the precision is the same as that in the table definition.
Note
This option can be used only with the
--csvor--cutoption.--preserve-zero-datetime
Specifies to retain the original format of zero values of date and time types during export. If this option is specified, the
NULLvalues of non-nullable date and time columns are exported as0, and theNULLvalues of nullable columns are still exported asNULL. This option applies to the DATE, DATETIME, and TIMESTAMP types in the MySQL compatible mode.
Blocklist and allowlist filtering
Table-level filtering
--exclude-table 'table_name [, table_name...]'
Specifies the tables to be excluded when exporting table definitions or data. The table name supports fuzzy matching.
Example:
--exclude-table 'test1,test*,*test,te*st'The preceding option specifies the following tables to be excluded:
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 the data types to be excluded when exporting data.
--add-extra-message
Specifies whether to include additional information in the exported table definition. For example, if you specify the
--add-extra-messageoption to export a table definition, the program will export the name of the table group to which each table belongs. By default, OBDUMPER does not export additional information in the table definition.Notice
If you specify the
--add-extra-messageoption to export a table definition, the program will export the name of the table group to which each table belongs. This option depends on the privileges in the sys tenant. If OBDUMPER does not have the privileges in the sys tenant, do not specify this option.--retain-empty-files
Specifies whether to generate empty files when exporting data in specific scenarios. If you specify the
--partitionoption to export data in a specific partition or the--whereoption to export data based on a query condition, and you also specify the--retain-empty-fileoption, an empty file will be generated if the partition is empty or the query result set is empty.
Column-level filtering
--include-column-names 'column_name [, column_name...]'
Specifies the columns to export based on the specified column names.
--exclude-column-names 'column_name [, column_name...]'
Specifies the columns to be excluded when exporting data. The column name does not support fuzzy matching.
Notice
- The specified column names must be in the same case as the column names in the table definition.
- The control file cannot be used together with the
--exclude-column-namesoption. The control file includes the functionality of the--exclude-column-namesoption.
--where 'where_condition_string'
Specifies the data to be exported based on the specified condition. This option can be used only with any one of the data format options and cannot be used with the
--query-sqloption.If you specify the
--whereoption to export data based on a query condition and you also specify the--retain-empty-fileoption, an empty file will be generated if the query result set is empty.--partition 'partition_name [, partition_name...]'
Specifies the partition to export data from. The parameter value is the partition name, and multiple partition names are separated with commas. This option can be used only with any one of the data format options and cannot be used with the
--query-sqloption.Notice
- When you specify a partition to export data from, for a subpartitioned table, you must specify the subpartition name, and you cannot export data based on the partition name. For a template subpartition, the partition name is the partition name plus s plus the subpartition name.
- If you specify the
--partitionoption to export data from a partition, you must specify the subpartition name for a composite partitioned table. OBDUMPER cannot export data from a partition. If the specified partition name does not exist, OBDUMPER will return an error. - If you specify the
--partitionoption to export data from a partition and you also specify the--retain-empty-fileoption, an empty file will be generated if the partition is empty.
--query-sql
Directly specify the query statement
--query-sql '<select_statement>'. For example,--query-sql 'select c1,c2 from test where c1 is not null'.Specifies whether to export the result data of a custom query statement. This option cannot be used with the
--partitionor--whereoption. You must ensure the correctness and query performance of the custom query statement. If you export the result set of a large query statement, the waiting time for a response from the database may be long. If you need to preprocess the data using a control file, you must use the--tableand--ctl-pathoptions. The table name specified by the--tableoption must be in the same case as the file name specified by the--ctl-pathoption. If no preprocessing is required, you can specify any table name for the--tableoption.Specify the file that stores the query statement
--query-sql 'file://xxxx'. For example,--query-sql 'file:///home/admin/t1.sql'.OBDUMPER identifies the
file://protocol header and reads the SQL statements from the file. This option supports only one very long SQL statement and does not support multiple SQL statements in one file.
--exclude-virtual-columns
Specifies whether to exclude data of generated columns (by default, data of generated columns is exported).
--enable-hidden-pk
Specifies to use the hidden primary key
__pk_incrementfor tables without a primary key to improve the export speed. In OceanBase Database of a version earlier than V4.0.0, you must use a special user to export data when you specify this option. Example:# In MySQL compatible mode of OceanBase Database, create a special user and grant privileges to the user. create user '__oceanbase_inner_drc_user'@'%' IDENTIFIED BY 'u*******'; grant ALL on *.* to '__oceanbase_inner_drc_user' WITH GRANT OPTION; # In Oracle compatible mode of OceanBase Database, create a special user and grant privileges to the user. create user '__OCEANBASE_INNER_DRC_USER'@'%' IDENTIFIED BY u*******; grant ALL to '__OCEANBASE_INNER_DRC_USER';Notice
If you use OceanBase Database V3.x's partitioned tables, we recommend that you set LOCAL indexes. The syntax is:
create index "your index" on `your table` ("__pk_increment") local;--fetch-size 'int_num'
Specifies the number of rows to read from the database cursor in Oracle compatible 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 to resume the export task from the last failed position.
Notice
The dump.ckpt file is a save point file generated during the operation of the tool and is stored in the directory specified by
-f. If the dump.ckpt file does not exist, this option cannot be used.--weak-read
Specifies to export data from the standby replica. For more information about weak-consistency reads, see Weak-consistency read.
--max-file-size int_num
Specifies the maximum amount of data that a process can export. The export stops when the amount of data to be exported exceeds the value specified by this option.
--skip-check-dir
Specifies to skip checking whether the directory for the exported data is empty. If the directory is not empty, the program stops exporting data.
Note
- If this option is not specified, OBDUMPER checks whether the directory is empty. If the directory is not empty, OBDUMPER reports an error and exits.
- If this option is specified, OBDUMPER skips checking whether the directory is empty. However, the exported files may overwrite the data of the files with the same name in the directory.
--remove-newline
Specifies to forcibly delete carriage returns or line breaks from the data during the export. For example, ***
\r***, ***\n***, and ***\r\n***. This option only applies to data read into the memory and does not directly modify the data in the source table. This option can be used only with the--cutoption.Notice
If the data in the source table contains carriage returns or line breaks, the data exported by specifying this option is inconsistent with the data in the source table. Before using this option, confirm that deleting
\r,\n, and\r\ncharacters will not affect your business. If you do not need to delete carriage returns or line breaks from the data, do not specify this option on the command line to avoid business data inconsistency.--snapshot
Specifies to export historical version data. This option can be used only with any one of the data format options. The purpose of exporting historical version data is to ensure global consistency of the exported data. If this option is not specified on the command line, the exported real-time data in the memory may not be a global consistent data snapshot.
Performance options
--page-size int_num
Specifies the size of a task page, that is, the number of rows to be queried at a time. The default value is 1,000,000. For example, you can specify this option as 1,000,000 to query 1 million rows at a time. This option is supported in OBDUMPER V4.0.0 and later.
--thread int_num
Specifies the number of concurrent threads. This option directly corresponds to the number of export threads. The default value is
CPU × 2. If the number of CPU cores exceeds 16, the maximum number of threads is 32. If you export definitions of multiple database objects, we recommend that you do not set the value of this option to exceed 4. Too many concurrent threads may cause the tool to fail to access system tables in the sys tenant and cause a timeout error during export.--block-size
Specifies the threshold for splitting files. It applies to the LONG and STRING data types. If the size of the exported data file exceeds the threshold, other logical subfiles are generated in sequence. If you specify this option, you do not need to explicitly specify the unit. The default unit is MB. The default value is 0, which indicates an unlimited size (only one file is generated for an object). 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-sizeis in the unit of MB or ROW. For example,--block-size 256ROWspecifies that the size of each file does not exceed 256 rows.--block-size 1024or--block-size 1024MBspecifies that the size of each file does not exceed 1024 MB. The 1024M and 1 GB formats are not supported.Notice
If you use
--block-size, you must specify path address for-f.--parallel-macro int_num
Specifies the number of macroblocks processed by one thread. The default value is 8.
--mem
Specifies the memory size of the JVM. This parameter is supported in OBDUMPER V4.3.2 and later. The supported units are K, M, G, and T. The default value is 4G.
Other options
--session-config
Specifies the connection configuration file. A default configuration file named
session.config.jsonis provided in the configuration file directory:<tool root directory>/conf/. This configuration file takes effect without any configuration. We recommend that you specify this option only when you need to load multiple connection configurations by using the same configuration file directory.--retain-schema
Specifies to retain the schema information of the exported tables and synonyms. By default, the exported DDL statements do not contain schema information but only table names. You can specify the
--retain-schemaoption to retain theschema.tablename.
Options
| Option | Required | Description | Introduced in | Deprecated |
|---|---|---|---|---|
| -h(--host) | Yes | The IP address of the ODP or OceanBase physical node. If the IP address is an IPv6 address, enclose it in brackets ([]). For example, [2001:0db8:85a3:xxxx:xxxx:8a2e:0370:7334]. |
||
| -P(--port) | Yes | The port number of the ODP or OceanBase physical node. | ||
| -u(--user) | Yes | The database username, tenant name, and cluster name. Format: <user>@<tenant>#<cluster>. |
Yes | |
| -p(--password) | No | The database password. | ||
| -D(--database) | Yes | The database name.
NoteOBDUMPER can export data from only one database at a time. |
||
| -f(--file-path) | Yes | The directory for exporting data. | ||
| --no-nested-dir | No | Specifies to export data without any directory hierarchy. | V4.2.7 | |
| --sys-user | No | The username under the sys tenant. | ||
| --sys-password | No | The password of the specified user under the sys tenant. | ||
| -t | No | Specifies to export data from the specified tenant of OceanBase Database.
NoticeWhen you perform direct load from the cloud, you must use the |
||
| --public-cloud | No | Specifies to export data from the specified tenant of OceanBase Database.
NoticeWhen you perform direct load from the cloud, you must use the |
||
| --log-path | No | The directory for storing log files. | ||
| --ddl | No | Specifies to export DDL files. A DDL file is a file that stores the definitions of database objects. The file name is in the format of object name-schema.sql. When you specify this option on the command line, only the definitions of database objects are exported, and no data is exported. When you export definitions of multiple table objects, we recommend that you set the value of the --thread option to no more than 4. A large number of concurrent threads will affect access to internal views under the sys tenant and cause a timeout error during export. |
||
| --csv | No | Specifies to export data in the CSV format. (Recommended) A CSV file is a file that stores data in the standard CSV format. The file name is in the format of table name.csv. For more information about the CSV format, see RFC 4180. In CSV files, errors are most likely to occur with delimiters. Single quotation marks (') and double quotation marks (") are commonly used as delimiters. If the data contains a delimiter, it must be escaped. To do so, specify an escape character. We recommend that you use the CSV format. We recommend that you use this option in combination with the --table option. When you use this option in combination with the --all option, OBDUMPER exports only table data and does not export database object definitions. |
||
| --sql | No | Specifies to export data in the SQL format. (Different from DDL files) An SQL file is a file that stores data in the INSERT statement format. The file name is in the format of table name.sql. The content of an SQL file is an INSERT statement for each row of table data. SQL files are clearly different from DDL files. We recommend that you use this option in combination with the --table option. When you use this option in combination with the --all option, OBDUMPER exports only table data and does not export database object definitions. |
||
| --orc | No | Specifies to export data in the ORC format. An ORC file is a file that stores data in the columnar format. The file name is in the format of table name.orc. For more information about the ORC format, see Apache ORC. |
V4.0.0 | |
| --par | No | Specifies to export data in the Parquet format. A Parquet file is a file that stores data in the columnar format. The file name is in the format of table name.parquet. For more information about the Parquet format, see Apache Parquet. |
V4.0.0 | |
| --cut | No | Specifies to export data in the CUT format. CUT files are files that store data in the format where data is separated by strings. The file name is in the format of table name.dat. We recommend that you use this option in combination with the --table option. When you use this option in combination with the --all option, OBDUMPER exports only table data and does not export database object definitions.
NoticeIn the CUT format, data is stored in full rows. If the field separator is a single character, OBDUMPER escapes special characters in the data, such as separators, carriage returns, and line breaks. For example, if the data is |
||
| --all | No | Specifies to export all supported database object definitions and table data. | ||
| --table-group | No | Specifies to export definitions of table groups. | V3.1.0 | |
| --table | No | Specifies to export definitions of tables or data of tables. | ||
| --view | No | Specifies to export definitions of views. | ||
| --function | No | Specifies to export definitions of functions. | ||
| --procedure | No | Specifies to export definitions of stored procedures. | ||
| --trigger | No | Specifies to export definitions of triggers. | ||
| --obj-user | No | Specifies to export definitions of users. | ||
| --role | No | Specifies to export definitions of roles. | ||
| --sequence | No | Specifies to export definitions of sequences. | ||
| --synonym | No | Specifies to export definitions of synonyms. (Not supported in MySQL compatible mode) | ||
| --type | No | Specifies to export definitions of types. | V4.0.0 | |
| --type-body | No | Specifies to export definitions of type bodies. | ||
| --package | No | Specifies to export definitions of packages. | ||
| --package-body | No | Specifies to export definitions of package bodies. | ||
| --drop-object | No | Specifies to add a DROP statement before the DDL statements when you export DDL statements. This option can be used only in combination with the --ddl option. |
||
| --distinct | No | Specifies to export non-repeated data in the table. | Yes | |
| --with-trim | No | Specifies to delete leading and trailing spaces. | V4.2.0 | |
| --weak-read | No | Specifies to export data from the standby replica. (Different from standby clusters) | ||
| --query-sql | No | Specifies to export the result set of a custom query SQL statement. | ||
| --snapshot | No | Specifies to export data from the last major compaction. | ||
| --where | No | Specifies to export data that meets the specified conditions. | ||
| --partition | No | Specifies to export data in the specified partition. | ||
| --skip-header | No | Specifies whether to ignore the file header (first row of field names) of the CSV file. The value is of the BOOLEAN type. | ||
| --trail-delimiter | No | Specifies to delete the last column delimiter at the end of a row. | ||
| --null-string | No | Specifies that the column value will be treated as NULL when the column value is the specified character. Default value: \N. This option can be used only in combination with the --csv or --cut option. |
||
| --empty-string | No | Specifies that the column value will be treated as an empty character ('') when the column value is the specified character. Default value: \E. This option can be used only in combination with the --csv or --cut option. |
||
| --line-separator | No | Specifies The line separator. When you export CSV, CUT, POS, or SQL files, you can specify the line separator in the data file. The default value of this option depends on the system platform and includes only three possible values: \r, \n, and \r\n. |
||
| --file-encoding | No | Specifies the file encoding. (Different from the database encoding) When you specify this option on the command line, add single quotation marks (' ') before and after the parameter value. For example: --file-encoding 'GBK'. Default value: UTF-8. |
||
| --column-separator | No | Specifies The column separator in CSV files, which is different from the column separator in CUT files. This option supports only single-character values and can be used only with the --csv option. Default value: comma. |
||
| --escape-character | No | Specifies the escape character. This option can be used only with the --csv or --cut option.
NoteIf you want to specify a special (invisible) character, use the hexadecimal (HEX) representation. For example, you can use '\x09' to specify the invisible tab character. |
||
| --column-delimiter | No | Specifies the column delimiter. This option can be used only with the --csv option. Default value: single quotation mark ('). |
||
| --column-splitter | No | Specifies the column separator string in CUT files, which is different from the column separator in CSV files. | ||
| --flashback-scn | No | Specifies to export data after the specified flashback transaction point. This option can be used only with one data format option and cannot be used with the --query-sql option. |
||
| --flashback-timestamp | No | Specifies to export data after the specified flashback timestamp. (Supported only in OceanBase Database V2.2.70 and later in the Oracle compatible mode) | ||
| --nls-date-format | No | Specifies the session-level datetime format. (Supported only in OceanBase Database in the Oracle compatible mode) | ||
| --nls-timestamp-format | No | Specifies the session-level timestamp format. (Supported only in OceanBase Database in the Oracle compatible mode) | ||
| --nls-timestamp-tz-format | No | Specifies the session-level timestamp with time zone format. (Supported only in OceanBase Database in the Oracle compatible mode) | ||
| --retry | No | Specifies to re-export data from the most recent savepoint. | ||
| --ctl-path | No | Specifies the directory where the control file is stored. | ||
| --exclude-table | No | Specifies to exclude the specified table definition and table data from export. | ||
| --include-column-names | No | Specifies to export data based on the specified column names. | ||
| --exclude-column-names | No | Specifies to exclude data corresponding to the specified column names from export. | ||
| --exclude-data-types | No | Specifies to exclude data corresponding to the specified data types from export. | ||
| --remove-newline | No | Specifies to forcibly remove line breaks and carriage returns from data. (Only applicable to the CUT format) | ||
| --max-file-size | No | Specifies the maximum amount of data that a process can export. Unit: Byte. | ||
| --skip-check-dir | No | Specifies to skip checking whether the export directory is empty. (The export directory must be empty.) | ||
| --retain-empty-files | No | Specifies to generate an empty file by default when an empty table is exported. | ||
| --add-extra-message | No | Specifies to export additional information, such as table groups, in the CREATE TABLE statement. | ||
| --page-size | No | Specifies the page size for query statement export. Default value: 1000000. | ||
| --thread | No | Specifies the number of concurrent threads for export tasks. | ||
| --block-size | No | Specifies the size of a file segment. 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 the Oracle compatible mode of OceanBase Database. | V4.2.0 | |
| -V(--version) | No | Specifies to view the version number of OBDUMPER. | ||
| --date-value-format | No | Specifies the format for exporting data of the DATE type. | V3.2.0 | |
| --time-value-format | No | Specifies the format for exporting data of the TIME type in the MySQL compatible mode of OceanBase Database. | V3.2.0 | |
| --datetime-value-format | No | Specifies the format for exporting data of the DATETIME type in the MySQL compatible mode of OceanBase Database. | V3.2.0 | |
| --timestamp-value-format | No | Specifies the format for exporting data of the TIMESTAMP type in the MySQL compatible mode of OceanBase Database. | V3.2.0 | |
| --timestamp-tz-value-format | No | Specifies the format for exporting data of the TIMESTAMP WITH TIME ZONE type in the Oracle compatible mode of OceanBase Database. | V3.2.0 | |
| --timestamp-ltz-value-format | No | Specifies the format for exporting data of the TIMESTAMP WITH LOCAL TIME ZONE type in the Oracle compatible mode of OceanBase Database. | V3.2.0 | |
| --exclude-virtual-columns | No | Specifies not to export data of virtual columns (data of virtual columns is exported by default). | V3.2.0 | |
| --no-sys | No | Specifies that the sys tenant password cannot be provided in the OceanBase Database environment. | 3.3.0 | |
| --logical-database | No | Specifies to export data from a logical database (sharding) of ODP. | V3.3.0 | |
| --character-set | No | Specifies the character set when you create a database connection. Default value: the value of session variable jdbc.url.character.encoding in the session.properties file. The value specified by the --character-set option overrides the value of jdbc.url.character.encoding. This option supports the following character sets: binary, gbk, gb18030, utf16, and utf8mb4. |
V4.2.4 | |
| --preserve-zero-datetime | No | Specifies to retain the original format of zero values of time types when data is exported. | V4.2.4 | |
| --enable-hidden-pk | No | Specifies to use a hidden primary key for tables without a primary key. | V4.2.5 | |
| --session-config | No | Specifies the connection configuration file. | V4.2.6 | |
| --retain-schema | No | Specifies to retain schema information for exported tables and synonyms. | ||
| -H(--help) | No | Specifies to view the help information of the OBDUMPER command-line tool. | ||