千家信息网

ibtmp1文件过大

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,有个数据库发现磁盘告警 已经100% 经过排查发现数据库的data目录下有个ibtmp1是个什么东西呢?查看官方文档后发现The temporary tablespace is a tablespac
千家信息网最后更新 2026年11月01日ibtmp1文件过大

有个数据库发现磁盘告警 已经100% 经过排查发现数据库的data目录下有个

ibtmp1是个什么东西呢?查看官方文档后发现

The temporary tablespace is a tablespace for non-compressed InnoDB temporary tables and related objects. The configuration option, innodb_temp_data_file_path, defines a relative path for the temporary tablespace data file. If innodb_temp_data_file_path is not defined, a single auto-extending 12MB data file named ibtmp1 is created in the data directory. The temporary tablespace is recreated on each server start and receives a dynamically generated space ID, which helps avoid conflicts with existing space IDs. The temporary tablespace cannot reside on a raw device. Startup is refused if the temporary tablespace cannot be created.

The temporary tablespace is removed on normal shutdown or on an aborted initialization. The temporary tablespace is not removed when a crash occurs. In this case, the database administrator may remove the temporary tablespace manually or restart the server with the same configuration, which removes and recreates the temporary tablespace

这是非压缩的innodb临时表的独立表空间。通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在支持大文件的系统这个文件大小是可以无限增长的。

该参数是5.7的新特性

针对临时表及相关对象引入新的"non-redo" undo log,存放于临时表空间。该类型的undo log非 redolog 因为临时表不需崩溃恢复、也就无需redo logs,但却需要 undo log用于回滚、MVCC等。默认的临时表空间文件为ibtmp1,位于数据目录在每次服务器启动时被重新创建,可通过innodb_temp_data_file_path指定临时表空间。(http://dev.mysql.com/doc/refman/5.7/en/innodb-temporary-table-undo-logs.html)


解决办法:

1,修改my.cnf配置文件:

innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G

2,设置innodb_fast_shutdown参数

SET GLOBAL innodb_fast_shutdown = 0; #InnoDB does a slow shutdown, a full purge and a change buffer merge before shutting down

3,关闭mysql服务

4,删除ibtmp1文件

5,启动mysql服务


注意:为了避免以后再出现类似的情况,一定要在限制临时表空间的最大值,如innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G


文件 空间 参数 数据 服务 大小 数据库 目录 配置 最大 下有 东西 也就是 也就是说 办法 官方 对象 情况 文件名 文档 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 河南云网互联网络科技有限公司 互联网科技产业 麻工互联网科技 以房互联网科技 万易互联网科技有限公司 杭州互联网科技公司 智慧科技互联网 互联网科技小额贷款 科技互联网创业计划书 互联网巨头投资的硬核科技 济南和联互联网科技有限公司 湖北码尼互联网科技有限公司电话 互联网5g黑科技有哪些 互联网科技与大数据专业 天津腾达互联网科技有限公司 如何创新互联网科技 区块链结合互联网科技 上海创道互联网络科技有限公司 互联网科技包装股 伍佰万互联网科技是干嘛的 厦门中拓互联网络科技有限公司 新华互联网科技学院 万达互联网科技 润盈互联网科技 互联网 科技馆 农村开互联网科技讲堂 阿里巴巴算科技企业还是互联网 银川新华互联网科技职业技术培训学校图片 电子科技大学互联网创业大赛 广州有谷有贝互联网科技有限公司
0