【 使用环境 】生产环境 or 测试环境 生产
【 OB or 其他组件 】 4.1
【 使用版本 】
【问题描述】清晰明确描述问题
【复现路径】问题出现前后相关操作
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):
【备注】基于 LLM 和开源文档 RAG 的论坛小助手已开放测试,在发帖时输入 [@论坛小助手] 即可召唤小助手,欢迎试用!
obdiag 收集trace_id 信息提示nodatabase No database selected’
obdiag version
OceanBase Diagnostic Tool: 1.6.1
BUILD_TIME: Mar 05 2024 19:27:02OURCE
复现步骤:
→
mysql -h10.241.28.194 -P2883 -uroot@sys#obclu_test_ncore2 -p -A -c
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 | 175.85 | 199.46 |
| META$1006 | 0.02 | 0.53 |
±------------±-------------±-----------------+
→
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
– and t1.role=‘leader’
group by t.tenant_name
order by 3 desc | YB420AF11CC3-00061F11480A7CE9-0-0 |
| 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 | YB420AF11CC2-00061F102C9FBAE0-0-0 |
trace_id=YB420AF11CC2-00061F102C9FBAE0-0-0
→
obdiag gather plan_monitor --trace_id YB420AF11CC2-00061F102C9FBAE0-0-0
[cradmin@zhobtest08 ~]$ obdiag gather plan_monitor --trace_id YB420AF11CC2-00061F102C9FBAE0-0-0
2024-08-23 09:58:48,506 [INFO] Detected mySQL mode successful, Database version :OceanBase 4.2.1.7 (r107030032024062709-7d62d41478c39e4512cd694d1019a69dcc7efb63) (Built Jun 27 2024 10:10:49)
2024-08-23 09:58:48,507 [INFO] Use gather_pack_20240823095845 as pack dir.
2024-08-23 09:58:48,507 [INFO] [cs resource path] : /usr/local/oceanbase-diagnostic-tool/resources
2024-08-23 09:58:48,511 [INFO] [sql plan monitor report task] start
2024-08-23 09:58:53,615 [INFO] TraceID : YB420AF11CC2-00061F102C9FBAE0-0-0
2024-08-23 09:58:53,615 [INFO] SQL : 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
2024-08-23 09:58:53,615 [INFO] SVR_IP : 10.241.28.194
2024-08-23 09:58:53,615 [INFO] SVR_PORT : 2882
2024-08-23 09:58:53,615 [INFO] DB:
2024-08-23 09:58:53,616 [INFO] PLAN_ID: 0
2024-08-23 09:58:53,616 [INFO] TENANT_ID: 1
2024-08-23 09:58:53,616 [INFO] [sql plan monitor report task] report header
2024-08-23 09:58:53,617 [INFO] report header complete
2024-08-23 09:58:53,617 [INFO] [sql plan monitor report task] report sql_audit
2024-08-23 09:58:58,551 [INFO] report sql_audit_result to file start …
2024-08-23 09:58:58,552 [INFO] report sql_audit_result end
2024-08-23 09:58:58,552 [INFO] [sql plan monitor report task] report plan explain
2024-08-23 09:58:58,555 [ERROR] plan explain> explain 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
2024-08-23 09:58:58,555 [ERROR] OperationalError(1046, ‘No database selected’) 《 - 报错信息如上。
2024-08-23 09:58:58,555 [INFO] [sql plan monitor report task] report plan cache
Gather Sql Plan Monitor Summary:
±----------±----------±-------±---------------------------+
| Cluster | Status | Time | PackPath |
+===========+===========+========+============================+
| obcluster | Completed | 32 s | gather_pack_20240823095845 |
±----------±----------±-------±---------------------------+
If you want to view detailed obdiag logs, please run:’ obdiag display-trace --trace_id f2f92dad-0dc4-374f-90e5-f0180179f0e4 ’
《 - 报错信息如上。
如何调整SQL ,使得obdiag 可以正常运行;
gather_pack_20240823095845_2.zip (125.7 KB)