If you want to view detailed obdiag logs, please run:' obdiag display-trace --trace_id a266beae-c8f3-3ed6-b6a8-e5a63953f814 ' [cradmin@zhobtest08 ~]$ mysql -h10.241.28.195 -P2881 -uroot@sys -p'1@WW' -Doceanbase Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3222003862 Server version: 5.7.25 OceanBase 4.2.1.7 (r107030032024062709-7d62d41478c39e4512cd694d1019a69dcc7efb63) (Built Jun 27 2024 10:10:49) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [oceanbase]> MySQL [oceanbase]> MySQL [oceanbase]> select t.tenant_name, -> round(sum(t2.data_size)/1024/1024/1024,2) as data_size_gb, -> round(sum(t2.required_size)/1024/1024/1024,2) as required_size_gb -> from dba_ob_tenants t,cdb_ob_table_locations t1,cdb_ob_tablet_replicas t2 -> where t.tenant_id=t1.tenant_id -> and t1.svr_ip=t2.svr_ip -> and t1.tenant_id=t2.tenant_id -> and t1.ls_id=t2.ls_id -> and t1.tablet_id=t2.tablet_id -> -- and t1.role='leader' -> group by t.tenant_name -> order by 3 desc ; +-------------+--------------+------------------+ | tenant_name | data_size_gb | required_size_gb | +-------------+--------------+------------------+ | dps_dp_st2 | 339.36 | 394.78 | | core_dm2_st | 186.02 | 207.73 | | core_bt | 158.84 | 188.26 | | core_ac_st2 | 25.43 | 30.95 | | core_ci_st2 | 21.76 | 28.78 | | core_pb_st2 | 7.57 | 11.57 | | core_pm_st2 | 0.10 | 2.26 | | core_pr_st2 | 0.21 | 1.34 | | sys | 0.24 | 1.16 | | core_pd_st2 | 0.06 | 1.01 | | META$1026 | 0.05 | 0.58 | | META$1064 | 0.03 | 0.57 | | META$1004 | 0.03 | 0.56 | | META$1014 | 0.02 | 0.54 | | META$1012 | 0.02 | 0.54 | | META$1016 | 0.02 | 0.53 | | META$1010 | 0.02 | 0.53 | | META$1008 | 0.02 | 0.53 | | META$1006 | 0.02 | 0.53 | +-------------+--------------+------------------+ 19 rows in set (3.253 sec) MySQL [oceanbase]> select query_sql,trace_id from oceanbase.GV$OB_SQL_AUDIT where query_sql like '%t.tenant_id=t1.tenant_id%' order by REQUEST_TIME desc limit 5; +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+ | query_sql | trace_id | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+ | select t.tenant_name, round(sum(t2.data_size)/1024/1024/1024,2) as data_size_gb, round(sum(t2.required_size)/1024/1024/1024,2) as required_size_gb from dba_ob_tenants t,cdb_ob_table_locations t1,cdb_ob_tablet_replicas t2 where t.tenant_id=t1.tenant_id and t1.svr_ip=t2.svr_ip and t1.tenant_id=t2.tenant_id and t1.ls_id=t2.ls_id and t1.tablet_id=t2.tablet_id group by t.tenant_name order by 3 desc | YB420AF11CC3-00061F116DCC47EE-0-0 | trace_id = YB420AF11CC3-00061F116DCC47EE-0-0 +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+ 1 row in set (7.837 sec) MySQL [oceanbase]> ^Z [1]+ Stopped mysql -h10.241.28.195 -P2881 -uroot@sys -p'1@WW' -Doceanbase [cradmin@zhobtest08 ~]$ obdiag gather plan_monitor --trace_id YB420AF11CC3-00061F116DCC47EE-0-0 --env "{db_connect='-h10.241.28.195 -P2881 -uroot@sys -p1@WW -Doceanbase'}" 2024-08-23 16:01:08,211 [INFO] Detected mySQL mode successful, Database version :OceanBase 4.2.1.7 (r107030032024062709-7d62d41478c39e4512cd694d1019a69dcc7efb63) (Built Jun 27 2024 10:10:49) 2024-08-23 16:01:08,212 [INFO] Use gather_pack_20240823160105 as pack dir. 2024-08-23 16:01:08,212 [INFO] [cs resource path] : /usr/local/oceanbase-diagnostic-tool/resources 2024-08-23 16:01:08,213 [INFO] [sql plan monitor report task] start 2024-08-23 16:01:12,349 [INFO] TraceID : YB420AF11CC3-00061F116DCC47EE-0-0 《————trace_id = YB420AF11CC3-00061F116DCC47EE-0-0 2024-08-23 16:01:12,349 [INFO] SQL : SELECT /*+ query_timeout(10000000000) */ `tenant_id`, `tablet_id`, `ls_id`, `svr_ip`, `data_size`, `required_size` FROM `__all_tablet_meta_table` WHERE 1=1 AND tenant_id = 1064 ORDER BY `tablet_id` ASC, `ls_id` ASC, `svr_ip` ASC, `svr_port` ASC 2024-08-23 16:01:12,349 [INFO] SVR_IP : 10.241.28.195 2024-08-23 16:01:12,349 [INFO] SVR_PORT : 2882 2024-08-23 16:01:12,349 [INFO] DB: oceanbase 2024-08-23 16:01:12,349 [INFO] PLAN_ID: 2542 2024-08-23 16:01:12,350 [INFO] TENANT_ID: 1 2024-08-23 16:01:12,350 [INFO] [sql plan monitor report task] report header 2024-08-23 16:01:12,350 [INFO] report header complete 2024-08-23 16:01:12,350 [INFO] [sql plan monitor report task] report sql_audit 2024-08-23 16:01:16,532 [INFO] report sql_audit_result to file start ... 2024-08-23 16:01:16,532 [INFO] report sql_audit_result end 2024-08-23 16:01:16,533 [INFO] [sql plan monitor report task] report plan explain 2024-08-23 16:01:16,609 [INFO] report sql_explain_result_sql complete 2024-08-23 16:01:16,609 [INFO] report sql_explain_result_sql complete 2024-08-23 16:01:16,610 [INFO] report sql_explain_result complete 2024-08-23 16:01:16,610 [INFO] [sql plan monitor report task] report plan cache 2024-08-23 16:01:16,613 [INFO] select plan_explain from ob complete 2024-08-23 16:01:16,613 [INFO] report plan_explain_sql complete 2024-08-23 16:01:16,613 [INFO] report plan_explain complete 2024-08-23 16:01:16,614 [INFO] [sql plan monitor report task] report table schema 2024-08-23 16:01:17,213 [INFO] init sql plan monitor stat complete 2024-08-23 16:01:17,214 [INFO] [sql plan monitor report task] report sql_audit details 2024-08-23 16:01:29,528 [INFO] report full sql audit complete 2024-08-23 16:01:29,529 [INFO] [sql plan monitor report task] report sql plan monitor dfo 2024-08-23 16:01:30,459 [INFO] report SQL_PLAN_MONITOR DFO complete 2024-08-23 16:01:31,387 [INFO] report SQL_PLAN_MONITOR DFO SCHED complete 2024-08-23 16:01:32,268 [INFO] report SQL_PLAN_MONITOR DFO graph data complete 2024-08-23 16:01:32,268 [INFO] [sql plan monitor report task] report sql plan monitor group by server 2024-08-23 16:01:33,123 [INFO] report SQL_PLAN_MONITOR SQC complete 2024-08-23 16:01:33,990 [INFO] report SQL_PLAN_MONITOR SQC operator priority complete 2024-08-23 16:01:34,910 [INFO] report SQL_PLAN_MONITOR SQC server priority complete 2024-08-23 16:01:34,910 [INFO] report SQL_PLAN_MONITOR fast preview complete 2024-08-23 16:01:34,910 [INFO] [sql plan monitor report task] sql plan monitor detail operator 2024-08-23 16:01:35,914 [INFO] report SQL_PLAN_MONITOR details complete 2024-08-23 16:01:36,833 [INFO] report SQL_PLAN_MONITOR details operator priority complete 2024-08-23 16:01:36,834 [INFO] [sql plan monitor report task] sql plan monitor group by priority 2024-08-23 16:01:37,765 [INFO] report SQL_PLAN_MONITOR details server priority complete 2024-08-23 16:01:37,765 [INFO] report footer complete 2024-08-23 16:01:37,766 [INFO] [sql plan monitor report task] end Gather Sql Plan Monitor Summary: +-----------+-----------+--------+----------------------------+ | Cluster | Status | Time | PackPath | +===========+===========+========+============================+ | obcluster | Completed | 29 s | gather_pack_20240823160105 | +-----------+-----------+--------+----------------------------+ If you want to view detailed obdiag logs, please run:' obdiag display-trace --trace_id ef36e371-1201-3fb0-8aeb-b2f2cf1eaf30 ' 一个新问题: -》 trace_id = YB420AF11CC3-00061F116DCC47EE-0-0 GV$OB_SQL_AUDIT 记录的SQL 是正确的。 select t.tenant_name, round(sum(t2.data_size)/1024/1024/1024,2) as data_size_gb, round(sum(t2.required_size)/1024/102 ***** obdiag 抓到的YB420AF11CC3-00061F116DCC47EE-0-0 的sql 如下: 2024-08-23 16:01:12,349 [INFO] SQL : SELECT /*+ query_timeout(10000000000) */ `tenant_id`, `tablet_id`, `ls_id`, `svr_ip`, `data_size`, `required_size` FROM `__all_tablet_meta_table` WHERE 1=1 AND tenant_id = 1064 ORDER BY `tablet_id` ASC, `ls_id` ASC, `svr_ip` ASC, `svr_port` ASC 两个SQL 不一样