OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Diagnostic Tool

V2.6.0
  • Overview
  • Install obdiag
  • Configure obdiag
  • One-click Cluster Inspection
    • Use obdiag to inspect an OceanBase cluster
    • Inspection metrics
  • One-click Information Collection
    • One-click General Information Collection
      • obdiag gather log
      • obdiag gather sysstat
      • obdiag gather plan_monitor
      • obdiag gather stack
      • obdiag gather perf
      • obdiag gather ash
      • obdiag gather tabledump
      • obdiag gather parameter
      • obdiag gather variable
      • obdiag gather clog/obdiag gather slog
      • obdiag gather obproxy_log
      • obdiag gather all
    • One-click Scenario-based Information Collection
      • Overview
      • observer.base
      • observer.backup
      • observer.backup_clean
      • observer.clog_disk_full
      • observer.cluster_down
      • observer.compaction
      • observer.cpu_high
      • observer.delay_of_primary_and_backup
      • observer.io
      • observer.log_archive
      • observer.long_transaction
      • observer.memory
      • observer.perf_sql
      • observer.px_collect_log
      • observer.recovery
      • observer.restart
      • observer.rootservice_switch
      • observer.suspend_transaction
      • observer.unit_data_imbalance
      • observer.perf_sql
      • other.application_error
      • obproxy.restart
      • observer.unknown
  • One-click Diagnostic Analysis
    • obdiag analyze log
    • obdiag analyze flt_trace
    • obdiag analyze parameter default
    • obdiag analyze parameter diff
    • obdiag analyze variable diff
    • obdiag analyze index_space
    • obdiag analyze memory
    • obdiag analyze queue
  • One-click Root Cause Analysis
    • Use obdiag for root cause analysis
    • disconnection
    • major_hold
    • lock_conflict
    • ddl_disk_full
    • clog_disk_full
    • log_error
    • ddl_failure
    • index_ddl_error
    • transaction_disconnection
    • transaction_execute_timeout
    • transaction_not_ending
    • transaction_other_error
    • transaction_rollback
    • transaction_wait_timeout
  • One-click Cluster Display
    • Overview
    • Basic information of a cluster
    • Information about nodes in a cluster
    • Information about units in a cluster
    • Information about zones in a cluster
    • RootService information of a cluster
    • Information about tenants in a cluster
    • Information about events in a cluster
    • Information about locks in a cluster
    • Information about top SQL statements in a cluster
    • Information about slow SQL statements in a cluster
    • Information about tables in a cluster
    • Information about the process list in a cluster
    • Information about the execution plan of an SQL statement
    • Disk usage of a database
    • Disk usage of the specified table in a database
  • Upgrade obdiag by using add-on files
  • Upgrade and uninstall obdiag
  • Telemetry Mode
  • FAQ
  • Release Notes
    • obdiag V2.6.0
    • obdiag V2.5.0
    • obdiag V2.4.0
    • obdiag V2.3.0
    • obdiag V2.2.0
    • obdiag V2.1.0
    • obdiag V2.0.0
    • obdiag V1.6.2
    • obdiag V1.6.1
    • obdiag V1.6.0
    • obdiag V1.5.2
    • obdiag V1.5.1
    • obdiag V1.5.0
    • obdiag V1.4.0
    • obdiag V1.3.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Diagnostic Tool
  3. V2.6.0

obdiag gather tabledump

Last Updated:2026-09-04 08:22:11

Syntax
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Results

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run this command to collect the information about a table, including the schema and data distribution information.

If your OceanBase cluster is deployed by using OceanBase Deployer (obd), you can run obdiag commands on obd to collect diagnostic information of the cluster. For more information about the commands, see obdiag commands.

Syntax

obdiag gather tabledump [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--database Yes string Empty The name of the database to which the table belongs.
--table Yes string Empty The name of the table.
--user Yes string Empty The username of a user in the tenant to which the table belongs.
--password Yes string Empty The password of the user in the tenant to which the table belongs.
--store_dir No string The current path where the command is executed The local path where the results are stored.
-c No string ~/.obdiag/config.yml The path of the configuration file.
--inner_config No string Empty The configurations of obdiag.
--config No string Empty The configurations of the cluster diagnosed by obdiag, in the format of --config key1=value1 --config key2=value2.

Note

For information about the parameters supported by this option, see Configure obdiag.

Examples

Method 1: Use the command out-of-the-box without a configuration file

obdiag gather tabledump --user=<MYUSER> --password=<MYPASSWORD> --database=<MYDATABASE> --table=<MYTABLENAME> \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=***

The output is as follows:

gather_tabledump start ...

Summary:
+-----------+-------------------------------------------------------------------+--------+
| Status    | Result Details                                                    | Time   |
+===========+===================================================================+========+
| Completed | ./obdiag_gather_report/obdiag_tabledump_result_20240808145346.txt | 0.34 s |
+-----------+-------------------------------------------------------------------+--------+


Trace ID: f5b1f66e-5552-11ef-8a9b-00163e01c7ce
If you want to view detailed obdiag logs, please run: obdiag display-trace f5b1f66e-5552-11ef-8a9b-00163e01c7ce

Method 2: Use the command with a configuration file

Before you run the command, make sure that you have configured the logon information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.

obdiag gather tabledump --user=<MYUSER> --password=<MYPASSWORD> --database=<MYDATABASE> --table=<MYTABLENAME>

Results

The command generates a table information report in the specified directory. A sample file path is ./obdiag_gather_report/obdiag_tabledump_result_20240808145346.txt.

obclient > show create table test1.game
+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                                                |
+=========+=============================================================================================================================================================================+
| game    | CREATE TABLE `game` (                                                                                                                                                       |
|         |   `round` int(11) NOT NULL,                                                                                                                                                 |
|         |   `team` varchar(10) DEFAULT NULL,                                                                                                                                          |
|         |   `score` int(11) DEFAULT NULL,                                                                                                                                             |
|         |   PRIMARY KEY (`round`)                                                                                                                                                     |
|         | ) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 |
|         |  partition by hash(round)                                                                                                                                                   |
|         | (partition `p0`,                                                                                                                                                            |
|         | partition `p1`,                                                                                                                                                             |
|         | partition `p2`)                                                                                                                                                             |
+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

obclient > select /*+read_consistency(weak) QUERY_TIMEOUT(60000000) */ table_name , ifnull(num_rows,0) as num_rows from oceanbase.cdb_tables where con_id = '1004' and owner = 'test1' and table_name = 'game' order by num_rows desc limit 1
+--------------+------------+
| table_name   |   num_rows |
+==============+============+
| game         |          6 |
+--------------+------------+

obclient > select /*+read_consistency(weak) QUERY_TIMEOUT(60000000) */ t1.SVR_IP,t1.role,ifnull(t2.data_size,0) as total_data_size from (select SVR_IP,tenant_id, database_name, role, table_id, tablet_id from oceanbase.cdb_ob_table_locations) t1 left join (select tenant_id, tablet_id,data_size from oceanbase.cdb_ob_tablet_replicas) t2 on t1.tenant_id = t2.tenant_id and t1.tablet_id = t2.tablet_id where  t1.tenant_id = '1004' and t1.table_id = '500003' order by total_data_size desc limit 1
+----------------+--------+-------------------+
| SVR_IP         | role   |   total_data_size |
+================+========+===================+
| xx.xxx.xxx.xxx | LEADER |               413 |
+----------------+--------+-------------------+
| xx.xxx.xxx.xxx | LEADER |               713 |
+----------------+--------+-------------------+

Previous topic

obdiag gather ash
Last

Next topic

obdiag gather parameter
Next
on this page
Syntax
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Results