首批通过分布式安全可靠测评,为关键业务系统打造
会话空闲超时报错
更新时间:2026-06-26 16:23:21
当前会话空闲时间超过指定阈值时,系统将主动关闭当前连接,本文为您介绍会话空闲超时的相关报错及处理方式。
报错:ERROR-02013
错误信息
ERROR-02013: Lost connection to MySQL server during query
示例
当前会话空闲超时后执行查看 t1 表的 SQL 语句报错。
obclient> SELECT * FROM t1;
ERROR-02013: Lost connection to MySQL server during query
如何处理
方式 1
重新连接 Oracle 数据库。
重新连接
sys用户。[admin@k08j13249.eu95sqa /home/admin] $obclient -h172.10.10.10 -P1000 -usys@Oracle -p -A Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221583828 Server version: OceanBase 3.2.4.0 (r100000072022102819-2a28da9e758e2d232c41fa1a1b0070a08b77dd7d) (Built Oct 28 2022 19:46:38) Copyright (c) 2000, 2018, OceanBase Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.再次查看
t1表。obclient> SELECT * FROM t1; +----+------+-------+------------------------------+ | ID | NAME | VALUE | GMT_CREATE | +----+------+-------+------------------------------+ | 1 | CN | NULL | 12-MAY-22 11.29.49.782106 AM | | 2 | UK | NULL | 12-MAY-22 11.29.49.782106 AM | | 3 | US | NULL | 12-MAY-22 11.29.49.782106 AM | +----+------+-------+------------------------------+ 3 rows in set
方式 2
修改会话超时相关参数设置。
查看
variables视图的wait_timeout。obclient> SHOW variables WHERE VARIABLE_NAME = 'wait_timeout'; +---------------+-------+ | VARIABLE_NAME | VALUE | +---------------+-------+ | wait_timeout | 10 | +---------------+-------+ 1 row in set将
wait_timeout参数设置为28800。说明
服务器关闭交互式连接前等待活动的秒数。
obclient> SET wait_timeout = 28800; Query OK, 0 rows affected将
interactive_timeout参数设置为28800。说明
服务器关闭非交互连接之前等待活动的秒数。
obclient> SET interactive_timeout = 28800; Query OK, 0 rows affected再次查看
t1表。obclient> SELECT * FROM t1; +----+------+-------+------------------------------+ | ID | NAME | VALUE | GMT_CREATE | +----+------+-------+------------------------------+ | 1 | CN | NULL | 12-MAY-22 11.29.49.782106 AM | | 2 | UK | NULL | 12-MAY-22 11.29.49.782106 AM | | 3 | US | NULL | 12-MAY-22 11.29.49.782106 AM | +----+------+-------+------------------------------+ 3 rows in set