drop table kk purge 语法报错

【 使用环境 】生产环境 or 测试环境
【 OB or 其他组件 】
【 使用版本 】
【问题描述】清晰明确描述问题
【复现路径】问题出现前后相关操作
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):


image

–官方文档

1 个赞

drop table tablename purge命令应该是在oracle租户下面可用的吧。
可以尝试单独使用 purge recyclebin试试看

1 个赞

a. 登录系统租户,打开enable_rich_error_msg 参数
alter system set enable_rich_error_msg=true;
b. 登录业务租户,执行报错 SQL 语句,会直接返回执行节点 IP 和 trace_id 信息。
obclient [test]> select count(*) from t2;
ERROR 1146 (42S02): Table ‘test.t2’ doesn’t exist
[xx.xx.xx.1:2882] [2024-04-13 20:10:20.292087] [YB420BA1CC68-000615A0A8EA5E38-0-0]
c. 去 xx.xx.xx.1 节点过滤日志,如果最新日志无法过滤到,可以正则匹配多个日志进行过滤
[root@x.x.x.1 ~]$ grep “YB420BA1CC68-000615A0A8EA5E38-0-0” rootservice.log
[root@x.x.x.1 ~]$ grep “YB420BA1CC68-000615A0A8EA5E38-0-0” observer.log
d. 获取完日志信息后,关闭enable_rich_error_msg参数
alter system set enable_rich_error_msg=false;

[root@shard13 log]# cat observer.log| grep YB42C0A80A0D-00062B94486392C5-0-0
[2025-01-20 09:45:09.078777] INFO [SQL.PARSER] parse_sql (ob_parser.cpp:971) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=15] failed to parse stmt as sql(stmt_str=drop table kk purge, ret=-5001)
[2025-01-20 09:45:09.078830] WDIAG [SQL.PARSER] parse_sql (ob_parser.cpp:1015) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=36][errcode=-5001] failed to parse the statement(stmt_str=drop table kk purge, parse_result.is_fp_=0, parse_result.is_multi_query_=0, parse_result.yyscan_info_=0x7f6459804eb8, parse_result.result_tree_=NULL, parse_result.malloc_pool_=0x7f6552855340, message=“syntax error, unexpected PURGE, expecting END_P or DELIMITER”, start_col=15, end_col=19, parse_result.line_=0, parse_result.yycolumn_=20, parse_result.yylineno_=1, parse_result.extra_errno_=0, parse_result.is_for_remap_=0, err_charge_sql_mode=false, sql_mode_=281018368, parse_result.sql_mode_=281018368, parse_result.may_bool_value_=0, ret=-5001)
[2025-01-20 09:45:09.078888] WDIAG parse_sql (ob_parser.cpp:1028) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=37][errcode=-5001] You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘purge’ at line 1
[2025-01-20 09:45:09.078905] WDIAG [SQL.PARSER] parse (ob_parser.cpp:1180) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=12][errcode=-5001] failed to parse stmt as sql(stmt=drop table kk purge, parse_mode=0, ret=-5001)
[2025-01-20 09:45:09.078938] WDIAG [SQL] parser_and_check (ob_sql.cpp:4411) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=23][errcode=-5001] Generate syntax tree failed(ret=-5001, outlined_stmt=drop table kk purge)
[2025-01-20 09:45:09.078969] WDIAG [SQL] handle_parser (ob_sql.cpp:5291) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=19][errcode=-5001] fail to parser normal query(sql=drop table kk purge, ret=-5001)
[2025-01-20 09:45:09.078995] WDIAG [SQL] handle_physical_plan (ob_sql.cpp:5087) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=18][errcode=-5001] fail to parser and check(ret=-5001)
[2025-01-20 09:45:09.079018] WDIAG [SQL] handle_text_query (ob_sql.cpp:2817) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=15][errcode=-5001] fail to handle physical plan(ret=-5001)
[2025-01-20 09:45:09.079035] WDIAG [SQL] stmt_query (ob_sql.cpp:232) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=11][errcode=-5001] fail to handle text query(stmt=drop table kk purge, ret=-5001)
[2025-01-20 09:45:09.079055] WDIAG [SERVER] after_func (ob_query_retry_ctrl.cpp:999) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=12][errcode=-5001] [RETRY] check if need retry(v={force_local_retry:false, stmt_retry_times:0, local_retry_times:0, err_:-5001, err_:“OB_ERR_PARSE_SQL”, retry_type:0, client_ret:-5001}, need_retry=false)
[2025-01-20 09:45:09.079090] WDIAG [SERVER] do_process (obmp_query.cpp:764) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=25][errcode=-5001] run stmt_query failed, check if need retry(ret=-5001, cli_ret=-5001, retry_ctrl_.need_retry()=0, sql=drop table kk purge)
[2025-01-20 09:45:09.079113] WDIAG [SERVER] do_process (obmp_query.cpp:890) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=14][errcode=-5001] query failed(ret=-5001, session={this:0x7f651ac70898, id:3222202369, deser:false, tenant:“obcp”, tenant_id:1010, effective_tenant:“obcp”, effective_tenant_id:1010, database:“test”, user:“root@%”, consistency_level:3, session_state:2, autocommit:true, tx:null}, sql=drop table kk purge, retry_ctrl_.need_retry()=0)
[2025-01-20 09:45:09.079190] INFO [SERVER] send_error_packet (obmp_packet_sender.cpp:378) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=45] sending error packet(ob_error=-5001, client error=1064, extra_err_info=NULL, lbt()=“0x75d9ee5 0xe4c8790 0xe479901 0x6eb8dee 0x6ea7e32 0x6ea164e 0x6e9fb0f 0x6e8f7cb 0xe1a2db7 0x1d8d1fde 0x7f65cd7e717a 0x7f65cd516dc3”)
[2025-01-20 09:45:09.079297] WDIAG [SERVER.OMT] process_one (ob_worker_processor.cpp:89) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=20][errcode=-5001] process request fail(ret=-5001)
[2025-01-20 09:45:09.079325] WDIAG [SERVER.OMT] process (ob_worker_processor.cpp:157) [4550][T1010_L0_G0][T1010][YB42C0A80A0D-00062B94486392C5-0-0] [lt=19][errcode=-5001] process request fail(ret=-5001)

还真的是oracle语法。 没注意这个。 谢谢!

报的错 是语法错误 不支持该语法 mysql模式支持的语法