Project

General

Profile

Feature #3521

MYSQL历史库表空间增长导致当前磁盘空间爆满--删历史数据压缩释放方案研究

Added by yufeng wu about 2 months ago. Updated 27 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Start date:
11/05/2024
Due date:
% Done:

0%

Estimated time:

Description

MYSQL历史库表空间增长导致当前磁盘空间爆满--删历史数据压缩释放方案研究
QTISCS+mysql5.8历史库
sedatum历史库的日、月、年AI、ACC定时存盘数据表的删除释放表空间和释放磁盘空间
1)删除sedatum库里的AI、ACC 日 月 年 这样的表,再配套清的脚本,看看是否能把磁盘空间是否出来(删除1.5年前的AI、ACC表)

2)删除sedatum库里的TB3001_ALMH历史报警事项表内的1.5年前的老数据,再配套清的脚本,看看是否能把磁盘空间是否出来

History

#1

Updated by yufeng wu about 2 months ago

  • Tracker changed from Bug to Feature
#2

Updated by yufeng wu 27 days ago

  • Status changed from New to Resolved

\\192.168.2.250\public\Manual\DB\mysql
USE SEDATUM;

SELECT * INTO OUTFILE '/home/tb3001_almh.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM TB3001_almh where F3001_date>1688140800;
-- 备份20230701以后的历史数据

TRUNCATE TABLE TB3001_almh;
--清除表(删+创建自动)
OPTIMIZE TABLE TB3001_almh;
--释放空间

LOAD DATA INFILE '/home/tb3001_almh.csv' INTO TABLE TB3001_almh FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES;
-- 如果第一行包含列标题,忽略它

Also available in: Atom PDF