This article is applicable to the scenario of independent deployment of obdiag. It can be executed with one click to display the actual execution plan operator information.
Instructions for use
obdiag display scene run --scene=observer.plan_explain [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationParameters that support configuration through this option can be found in obdiag configuration. |
| --env | Yes | string | Default is empty | Additional parameters required by obdiag display, here used to set information related to the actual execution plan. Fixed style: --env svr_ip=${IP} --env svr_port=${PORT} --env tenant_id=${TENANT_ID} --env plan_id=${PLAN_ID}. |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option.
ExplanationFor details, please see Configuration file encryption. |
Usage example
Step 1: Get the env required for the command
-- OceanBase Database version >= 4.0,
select svr_ip, svr_port, tenant_id, plan_id from gv$ob_sql_audit where trace_id='xxxxx';
-- OceanBase Database version < 4.0
select svr_ip, svr_port, tenant_id, plan_id from gv$sql_audit where trace_id='xxxxx';
Taking the OceanBase database version greater than 4.0 and trace_id as YF2A0BA2DA7E-00062C1FC9CFFF3F-0-0 as an example, the command is as follows:
obclient [oceanbase]> select svr_ip, svr_port, tenant_id, plan_id from gv$ob_sql_audit where trace_id='YF2A0BA2DA7E-00062C1FC9CFFF3F-0-0';
The output is as follows:
+----------------+----------+-----------+---------+
| svr_ip | svr_port | tenant_id | plan_id |
+----------------+----------+-----------+---------+
| 10.10.10.1 | 2882 | 1 | 1635 |
+----------------+----------+-----------+---------+
Step 2: Query the actual execution plan operator
- Used without configuration files (out of the box)
obdiag display scene run --scene=observer.plan_explain --env svr_ip=10.10.10.1 --env svr_port=2882 --env tenant_id=1 --env plan_id=1635 \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=***
```* Used with configuration files
You need to ensure that the login information of the node to be collected has been configured in the obdiag configuration file <code>config.yml</code>. For related detailed configuration introduction, see [obdiag configuration](../300.obdiag-config-guide.md).
```shell
obdiag display scene run --scene=observer.plan_explain --env svr_ip=10.10.10.1 --env svr_port=2882 --env tenant_id=1 --env plan_id=1635
