This topic describes how to use OceanBase Diagnostic Tool (obdiag) that is independently deployed to display the information about operators in the actually executed plan.
Syntax
obdiag display scene run --scene=observer.plan_explain [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| -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.
NoteFor information about the parameters supported by this option, see Configure obdiag. |
| --env | Yes | string | Empty | Additional parameters required for the obdiag display command, in the format of --env svr_ip=${IP} --env svr_port=${PORT} --env tenant_id=${TENANT_ID} --env plan_id=${PLAN_ID}, which specify the information relevant to the actually executed plan. |
Examples
Step 1: Obtain the env values required by 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';
Assume that the version of OceanBase Database is later than V4.0 and trace_id is YF2A0BA2DA7E-00062C1FC9CFFF3F-0-0. The sample 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 operators in the actually executed plan
Use obdiag out-of-the-box without a configuration file
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=***Use obdiag with a configuration file
Before you use obdiag, make sure that you have configured the login information of the target nodes in the
config.ymlconfiguration file of obdiag. For more information, see Configure obdiag.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