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

V1.4.0
  • Overview
  • Install obdiag
  • Configure obdiag
  • Use `obdiag gather` commands to collect diagnostic information of OceanBase Database
  • Use `obdiag analyze` commands to analyze diagnostic information of OceanBase Database
  • Use `obdiag check` commands to inspect an OceanBase cluster
  • FAQ

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Diagnostic Tool
  3. V1.4.0

Use `obdiag gather` commands to collect diagnostic information of OceanBase Database

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

Prerequisites
gather commands
Syntax
obdiag gather log
obdiag gather sysstat
obdiag gather clog
obdiag gather slog
obdiag gather plan_monitor
obdiag gather stack
obdiag gather perf
obdiag gather obproxy_log
obdiag gather all

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can use obdiag gather commands to collect diagnostic information of OceanBase Database.

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.

Prerequisites

A Zip tool is installed on the target nodes whose information is to be collected.

gather commands

Syntax

obdiag gather <gather type> [options]

Valid values of the gather type parameter are as follows:

  • log: collects logs of the specified OceanBase cluster.

  • sysstat: collects information about nodes in the specified OceanBase cluster.

  • clog: collects the clogs of the specified OceanBase cluster.

  • slog: collects the slogs of the specified OceanBase cluster.

  • plan_monitor: collects the execution details of parallel SQL statements with the specified trace ID in the specified OceanBase cluster.

  • stack: collects the stack information of the specified OceanBase cluster.

  • perf: collects the perf information of the specified OceanBase cluster.

  • obproxy_log: collects the logs of the OceanBase Database Proxy (ODP) on which the specified OceanBase cluster depends.

  • all: collects the diagnostic information of the specified OceanBase cluster, including the logs, node information, stack information, clogs, slogs, and perf information of the cluster.

obdiag gather log

You can run this command to collect logs of the specified OceanBase cluster.

Note

Before you use this 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 log [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the end time as 1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes.
--scope No string all The type of logs to be collected. Valid values: observer, election, rootservice, and all.
--grep No string Empty The search keyword.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--ob_install_dir No string /home/admin The installation directory of OceanBase Database.
--store_dir No string Current path in which the command is executed The local path where the results are stored.

Here is an example:

obdiag gather log --scope observer --from 2022-06-30 16:25:00 --to 2022-06-30 18:30:00 --grep STORAGE --encrypt true

...
ZipFileInfo:
+-------------------+-----------+
| Node              | LogSize   |
+===================+===========+
| xxx.xxx.xxx.xxx   | 36.184M   |
+-------------------+-----------+
...

ZipFileInfo:
+-------------------+-----------+
| Node              | LogSize   |
+===================+===========+
| xxx.xxx.xxx.xxx   | 44.176M   |
+-------------------+-----------+
...

Summary:
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+
| Node              | Status    | Size     | Password         | Time   | PackPath                                                               |
+===================+===========+==========+==================+========+========================================================================+
| xxx.xxx.xxx.xxx   | Completed | 36.762M  | HYmVourcUyRNP8Om | 19 s   | gather_pack_20220701183246/result_xxx.xxx.xxx.xxx_20220701183247.zip   |
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s  | gather_pack_20220701183246/result_xxx.xxx.xxx.xxx_20220701183918.zip   |
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+

Notice

If encryption is enabled, collected logs are encrypted when being compressed. The value in the `Password` column indicates the password for decrypting the .zip package. Encryption is disabled by default.

  • Here are examples of collecting logs of a recent period.

    # Collect logs of the last 1 hour.
    obdiag gather log --scope observer --since 1h --grep STORAGE --encrypt true
    
    
    # Collect logs of the last 30 minutes.
    obdiag gather log --scope observer --since 30m --grep STORAGE --encrypt true
    

obdiag gather sysstat

You can run this command to collect information about hosts in the specified OceanBase cluster, such as the dmesg, CPU, and memory information of the hosts.

Note

Before you use this 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 sysstat [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--store_dir No string Current path in which the command is executed The local path where the results are stored.

Here is an example:

Example: obdiag gather sysstat

The sample result is as follows:

Summary:
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                                |
+===================+===========+=========+========+=========================================================================+
| xxx.xxx.xxx.xxx   | Completed | 45.209K | 5 s    | gather_pack_20220729164233/sysstat_xxx.xxx.xxx.xxx_20220729164233.zip   |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 42.170K | 5 s    | gather_pack_20220729164233/sysstat_xxx.xxx.xxx.xxx_20220729164233.zip   |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+

obdiag gather clog

You can run the obdiag gather clog command to call the ob_admin tool on the target server to parse clog files and collect clogs within the specified time range.

Note

Before you use this 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 clog [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time of log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. Example:1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--store_dir No string Current path in which the command is executed The local path where the results are stored.
--ob_install_dir No string /home/admin The installation directory of OceanBase Database.

Here is an example:

obdiag gather clog --cluster_name demo1 --from 2023-01-16 18:25:00 --to 2023-01-17 01:30:00

Gather clog Summary:
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                              |
+===================+===========+=========+========+=======================================================================+
| xxx.xxx.xxx.xxx   | Completed | 15.762K | 6 s    | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+

obdiag gather slog

You can run the obdiag gather slog command to call the ob_admin tool on the target server to parse slog files and collect slogs within the specified time range.

Note

Before you use this 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 slog [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the end time as 1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--store_dir No string Current path in which the command is executed The local path where the results are stored.
--ob_install_dir No string /home/admin The installation directory of OceanBase Database.

Here is an example:

obdiag gather slog --cluster_name demo1 --from 2023-01-16 18:25:00 --to 2023-01-17 01:30:00

Gather slog Summary:
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                              |
+===================+===========+=========+========+=======================================================================+
| xxx.xxx.xxx.xxx   | Completed | 15.762K | 6 s    | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+

obdiag gather plan_monitor

You can run this command to collect the execution details of parallel SQL statements with the specified trace ID in the specified OceanBase cluster. In this way, you can analyze the operators if the SQL statement execution is slow during analytical processing (AP).

Note

  • This command is supported only in OceanBase Database V3.0 and later.
  • Before you use this command, make sure that the connection information of the target cluster has been configured in the config.yml configuration file of obdiag. For more information, see Configure obdiag.
obdiag gather plan_monitor [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--trace_id Yes string Empty In OceanBase Database of a version earlier than V4.0.0, you can query the gv$sql_audit view for the trace IDs. In OceanBase Database V4.0.0 and later, you can query the gv$ob_sql_audit view for the trace IDs.
--store_dir No string Current path in which the command is executed The local path where the results are stored.

Here is an example:

obdiag gather plan_monitor --trace_id YB420BA2D99B-0005EBBFC45D5A00-0-0

Gather ob_admin Summary:
+-----------+--------+----------------------------------------------------------------------+
| Status    | Time   | PackPath                                                             |
+===========+========+======================================================================+
| Completed | 6 s    | gather_pack_20230118002457                                           |
+-----------+--------+----------------------------------------------------------------------+

obdiag gather stack

You can run this command to collect the stack information of the specified OceanBase cluster. This command is not supported for a cluster built in the ARM architecture.

Note

Before you use this 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 stack [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--store_dir No string Current path in which the command is executed The local path where the results are stored.

Here is an example:

Example: obdiag gather stack

The sample result is as follows:

Summary:
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                                 |
+===================+===========+=========+========+==========================================================================+
| xxx.xxx.xxx.xxx   | Completed | 19.926K | 10 s   | gather_pack_20220729163951/obstack2_xxx.xxx.xxx.xxx_20220729163951.zip   |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 22.803K | 12 s   | gather_pack_20220729163951/obstack2_xxx.xxx.xxx.xxx_20220729163951.zip   |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+

obdiag gather perf

You can run this command to collect the perf information of the specified OceanBase cluster.

Note

Before you use this 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 perf  [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--scope No string all The type of perf information to be collected. Valid values: sample, flame, pstack, and all.
--store_dir No string Current path in which the command is executed The local path where the results are stored.

Here is an example:

obdiag gather perf

Gather Perf Summary:
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| Node              | Status    | Size     | Time   | PackPath                                                             |
+===================+===========+==========+========+======================================================================+
| xxx.xxx.xxx.xxx   | Completed | 368.178K | 90 s   | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip   |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 368.178K | 90 s   | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip   |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+

obdiag gather obproxy_log

You can run this command to collect logs of the ODP on which the specified OceanBase cluster depends.

Note

Before you use this 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 obproxy_log [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the end time as 1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes.
--scope No string all The type of ODP logs to collect. Valid values: obproxy, obproxy_digest, obproxy_stat, obproxy_slow, obproxy_limit, and all.
--grep No string Empty The search keyword.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--store_dir No string Current path in which the command is executed The local path where the results are stored.
--obproxy_install_dir No string /home/admin The installation directory of OceanBase Database.

Here is an example:

obdiag gather obproxy_log --scope obproxy --from 2022-06-25 10:25:00 --to 2022-06-25 18:30:00 --encrypt true

...
ZipFileInfo:
+------------------+-----------+
| Node             | LogSize   |
+==================+===========+
| xxx.xxx.xxx.xxx  | 36.184M   |
+------------------+-----------+
...

ZipFileInfo:
+-------------------+-----------+
| Node              | LogSize   |
+===================+===========+
| xxx.xxx.xxx.xxx   | 44.176M   |
+-------------------+-----------+
...

Gather ObProxy Log Summary:
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+
| Node              | Status    | Size     | Password         | Time   | PackPath                                                                    |
+===================+===========+==========+==================+========+=============================================================================+
| xxx.xxx.xxx.xxx   | Completed | 36.762M  | HYmVourcUyRNP8Om | 19 s   | gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183247.zip   |
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s  | gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183918.zip   |
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+

obdiag gather all

You can run this command to collect the diagnostic information of the specified OceanBase cluster, including the logs, host information, stack information, clogs and slogs, and per information of the cluster.

Note

Before you use this 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 all [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the end time as 1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes.
--scope No string all The type of logs of the OceanBase cluster to be collected. Valid values: observer, election, rootservice, and all.
--grep No string Empty The search keyword.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--store_dir No string Current path in which the command is executed The local path where the results are stored.
--cluster_name Yes string Empty The name of the cluster.

Here are some examples:

Collect the performance reports, logs, clogs, stack information, and perf information of the specified OceanBase cluster, as well as logs and CPU and memory information of hosts in the cluster.

obdiag gather all --from 2022-07-28 16:25:00 --to 2022-07-28 18:30:00 --cluster_name test --encrypt true

...
ZipFileInfo:
+------------------+-----------+
| Node             | LogSize   |
+==================+===========+
| xxx.xxx.xxx.xxx  | 29.874M   |
+------------------+-----------+
...

ZipFileInfo:
+------------------+-----------+
| Node             | LogSize   |
+==================+===========+
| xxx.xxx.xxx.xxx  | 143.229M  |
+------------------+-----------+
...


...
# Logs of the specified period
Summary:
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+
| Node              | Status    | Size     | Password         | Time   | PackPath                                                                              |
+===================+===========+==========+==================+========+=======================================================================================+
| xxx.xxx.xxx.xxx   | Completed | 29.874M  | fB7FrrzTGl4EK5Hl | 20 s   | gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip   |
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 143.229M | SGRbXvMyA7lrnFW1 | 74 s   | gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip   |
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+

...


# Real-time information of the hosts where the observer process resides
Summary:
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                                |
+===================+===========+=========+========+=========================================================================+
| xxx.xxx.xxx.xxx   | Completed | 45.276K | 5 s    | gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip   |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 42.152K | 6 s    | gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip   |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+


# Stack information of the observer process
Summary:
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                                 |
+===================+===========+=========+========+==========================================================================+
| xxx.xxx.xxx.xxx   | Completed | 22.693K | 13 s   | gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip   |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 19.902K | 13 s   | gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip   |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+

Gather Perf Summary:
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| Node              | Status    | Size     | Time   | PackPath                                                             |
+===================+===========+==========+========+======================================================================+
| xxx.xxx.xxx.xxx   | Completed | 368.178K | 90 s   | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip   |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| xxx.xxx.xxx.xxx   | Completed | 368.178K | 90 s   | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip   |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+


Gather ob_admin Summary:
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
| Node              | Status    | Size    | Time   | PackPath                                                              |
+===================+===========+=========+========+=======================================================================+
| xxx.xxx.xxx.xxx   | Completed | 15.762K | 6 s    | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+

# Data of the last 2 hours
obdiag gather all --since 2h --cluster_name test --encrypt true

Previous topic

Configure obdiag
Last

Next topic

Use `obdiag analyze` commands to analyze diagnostic information of OceanBase Database
Next
on this page
Prerequisites
gather commands
Syntax
obdiag gather log
obdiag gather sysstat
obdiag gather clog
obdiag gather slog
obdiag gather plan_monitor
obdiag gather stack
obdiag gather perf
obdiag gather obproxy_log
obdiag gather all