通达oa mysql_通达OA系统优化-对mysql数据库减肥

OA系统冗余数据过多,访问效率受到影响,现需要对历史数据进行一次清理,以提高OA访问速度

大的数据主要体现在流程上,流程数据主要放在flow_run,flow_run_data,flow_run_prcs,flow_run_feedback表中,清理一年半以前的数据是比较合理的。run_id是主键而run_id随着时间的增加而变大,run_id小于50W的流程刚好是一年半以前的历史数据,选择run_id小于50W作为临界点进行删除。以下是清理数据的计划

思路:

①创建和flow_run_data、flow_run、flow_run_prcs、flow_run_feedback、notify表结构一致的表

②把需要清理的历史数据插入刚创建的备份表中

③删除正式表中的数据

操作:

1.晚上10点以后停止mysql数据库服务,前端web服务(避免有人继续访问)

2.备份td_oa数据库

3.依次执行以下SQL语句:

4.开启web和mysql服务,验证是否成功

//对flow_run的操作

create table flow_run_old like flow_run;

insert into flow_run_old select * from flow_run where run_id < '500000';

delete from flow_run where run_id < '500000';

//对flow_run_data的操作

create table flow_run_data_old like flow_run_data;

insert flow_run_data_old select * from flow_run_data where run_id < '500000'

delete from flow_run_data where run_id < '500000';

//对flow_run_prcs操作

create table flow_run_prcs_old like flow_run_prcs;

insert into flow_run_prcs_old select * from flow_run_prcs where run_id < '500000'

delete from flow_run_prcs where run_id < '500000';

select count(*) from flow_run_prcs_old

//对flow_run_feedback操作

create table flow_run_feedback_old like flow_run_feedback;

insert into flow_run_feedback_old select * from flow_run_feedback where run_id < '500000'

delete from flow_run_feedback where run_id < '500000';

//公告notify_id<3349是2013年以前的数据,从该时刻开始删除

create table notify_old like notify;

insert into notify_old select * from notify where notify_id < '3349';

delete from notify where notify_id < '3349';

//删除一年以前的系统日志sys_log、流程日志FLOW_RUN_LOG、SMS、SMS_BODY、UC_PMS、

delete from sys_log where time

//对流程日志的操作

create table flow_run_log_old like flow_run_log;

insert into flow_run_log_old select * from flow_run_log where run_id < '500000';

delete from flow_run_log where run_id < '500000';

=============================================================================================================

//会议室申请

create table meeting_old like meeting;

insert into meeting_old select * from meeting where m_request_time < '2013-06-01 00:00:00';

delete from meeting where m_request_time < '2013-06-01 00:00:00';

//车辆申请

create table vehicle_usage_old like vehicle_usage;

insert into vehicle_usage_old select * from vehicle_usage where vu_request_date < '2013-06-01 00:00:00';

delete from vehicle_usage where vu_request_date < '2013-06-01 00:00:00';

=============================================================================================================

//在线考试信息清理主要是exam_flow和exam_data两张表,这两张表是通过flow_id关联,清理2012-06-01以前的数据,flow_id<4212

//考试发布表exam_flow

create table exam_flow_old like exam_flow;

insert into exam_flow_old select * from exam_flow where flow_id

delete from exam_flow where flow_id

//考试信息表exam_data

create table exam_data_old like exam_data;

insert into exam_data_old select * from exam_data where flow_id

delete from exam_data where flow_id

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值