You can specify command-line options for OBDUMPER to export data.
Example command
The following statement shows an example of an OBDUMPER command. For more information, see the following command-line options and the Scenarios topic. Notice
When you connect OBDUMPER to an OceanBase cluster through OBProxy, use the -h and -P options to specify the IP address and port number of the OBProxy host. Then, use the -c option to specify the name of the cluster to connect to. When you directly connect OBDUMPER to an OBServer, you do not need to use the -c option to specify the cluster name.
[admin@localhost]>./obdumper -h <host IP address> -P <port number> -u <username> -p <password> --sys-password <password of a user under the sys tenant> -c <cluster name> -t <tenant name> -D <database name> [--ddl] [--csv|--sql|--cut] [--all|--table 'table name'] -f <data directory>
Command-line options
| Option | Required | Description |
|---|---|---|
| -h (--host) | Yes | Specifies the IP address of the OBProxy server or OBServer to connect to. |
| -P (--port) | Yes | Specifies the port number of the OBProxy server or OBServer to connect to. |
| -c (--cluster) | No | Specifies the database cluster name. You do not need to specify this option if OBDUMPER is directly connected to an OBServer. |
| -t (--tenant) | No | Specifies the name of the current tenant. |
| -u (--user) | Yes | Specifies the username that you use to log on to the database. |
| -p (--password) | No | Specifies the password that you use to log on to the database. |
| -D (--database) | Yes | Specifies the name of the database. |
| -f (--file-path) | Yes | Specifies the directory where data is exported to. |
| --sys-user | No | Specifies the username of a user under the sys tenant. Default value: root@sys. |
| --sys-password | No | Specifies the password of the user specified by the --sys-user option. Default value: null. |
| --public-cloud | No | Specifies whether to use the limited mode to export data. You do not need to specify the --sys-user option in limited mode. |
| --log-path | No | Specifies the directory where the log files are stored. |
| --file-encoding | No | Specifies the file encoding format. Default value: UTF-8. |
| --exclude-table | No | Specifies whether to export tables. |
| --nls-date-format | No | Specifies the date and time format in Oracle mode. Default value: YYYY-MM-DD HH24:MI:SS. |
| --nls-timestamp-format | No | Specifies the timestamp format in Oracle mode. Default value: YYYY-MM-DD HH24:MI:SS:FF9. |
| --nls-timestamp-tz-format | No | Specifies the timestamp + timezone format in Oracle mode. Default value: YYYY-MM-DD HH24:MI:SS:FF9 TRZ. This option is supported in OBDUMPER V2.1.11 and later. |
| --csv | No | Specifies to export CSV files (recommended). Default file extension: .csv. |
| --sql | No | Specifies to export SQL files. Default file extension: .sql. |
| --ddl | No | Specifies to export DDL files. Default file extension: -schema.sql. |
| --all | No | Specifies to export all the database objects. By default, the database objects include tables, views, triggers, functions, stored procedures, sequences, and synonyms. |
| --table | No | Specifies the tables to be exported. Separate multiple tables with commas (,). You can use '*' to represent all the tables in the database specified by the -D option. |
| --view | No | Specifies the views to be exported. Separate multiple views with commas (,). You can use '*' to represent all the views in the database specified by the -D option. |
| --trigger | No | Specifies the triggers to be exported. Separate multiple triggers with commas (,). You can use '*' to represent all the triggers in the database specified by the -D option. |
| --function | No | Specifies the functions to be exported. Separate multiple functions with commas (,). You can use '*' to represent all the functions in the database specified by the -D option. |
| --procedure | No | Specifies the stored procedures to be exported. Separate multiple stored procedures with commas (,). You can use '*' to represent all the stored procedures in the database specified by the -D option. |
| --sequence | No | Specifies the sequences to be exported. Separate multiple sequences with commas (,). You can use '*' to represent all the sequences in the database specified by the -D option. |
| --synonym | No | Specifies the synonyms to be exported. Separate multiple synonyms with commas (,). You can use '*' to represent all the synonyms in the database specified by the -D option. |
| --type-body | No | Specifies the type bodies to be exported. Separate multiple type bodies with commas (,). You can use '*' to represent all the type bodies in the database specified by the -D option. |
| --package | No | Specifies the program packages to be exported. Separate multiple program packages with commas (,). You can use '*' to represent all the program packages in the database specified by the -D option. |
| --package-body | No | Specifies the package bodies to be exported. Separate multiple package bodies with commas (,). You can use '*' to represent all the package bodies in the database specified by the -D option. |
| --drop-object | No | Specifies whether to prepend or append a DROP statement when DDL statements are exported. |
| --pl-delimiter | No | Specifies the delimiter that separates multiple PL statements. Default value: $$ |
| --snapshot | No | Specifies whether to export data snapshots. You can use this option to export the snapshot taken after the last major compaction. |
| --page-size | No | Specifies the number of record rows to return in a query. Default value: 10,000. |
| --where | No | Specifies the global conditions. Only data that meet the conditions will be exported. Example: --where 'age>16 and age<65'. |
| --partition | No | Specifies the partitions from which the data is exported, for example, -- partition 'p0,p1,p2'. |
| --flashback-scn | No | Specifies to export data from the most recent valid system change number (SCN). This option is supported in OceanBase Database V2.2.70 and later. |
| --flashback-timestamp | No | Specifies to export data from the most recent valid time point. This option is supported in OceanBase Database V2.2.70 and later in Oracle mode. Example: --flashback-timestamp '2020-11-03 19:30:00'. |
| --block-size | No | Specifies the size of an exported file. Default value: 256 MB. |
| --max-file-size | No | Specifies the maximum size in MB for data that can be exported from a table. By default, the value of this option is not limited. Example: --max-file-size 512. |
| --thread | No | Specifies the number of threads for data export. Default value: CPU × 2. |
| --parallel-macro | No | Specifies the number of macroblocks that a thread can read. This option can affect the performance. |
| --exclude-data-types | No | Specifies the data types to skip during data export, for example, the BLOB type. |
| --retry | No | Specifies whether to resume the data export job from the last saved point. |
| --skip-header | No | Specifies whether to generate a header row for a CSV file. By default, the header row is generated. |
| --trail-delimiter | No | Specifies to delete the last column delimiter if the data ends with column delimiters. |
| --null-string | No | Specifies the string to replace NULL values. Default value: \N. |
| --empty-string | No | Specifies the escape character for an empty string (' '). Default value: \E. |
| --line-separator | No | Specifies the line separator. Default value: '\n'. |
| --column-separator | No | Specifies the column separator. Default value: , (comma). |
| --escape-character | No | Specifies the escape character. Default value: \ (backslash) |
| --column-delimiter | No | Specifies whether to use single quotation marks or double quotation marks. Default value: ' ' (single quotation marks). |
| --ctl-path | No | Specifies the directory where the control file is stored. Default file extension: .ctrl. |
| --cut | No | Specifies to export files in the CUT format in which data is separated by a string. |
| --column-splitter | No | Specifies the column splitter. Unlike in the CSV format where the separator is a single character, this option allows you to use a string, which can have several characters, to separate data. |
| --distinct | No | Specifies to deduplicate data in the table before the export. |
