/**PageBeginHtml Block Begin **/ /***自定义返回顶部小火箭***/ /*生成博客目录的JS 开始*/ /*生成博客目录的JS 结束*/

框架工作流数据清理说明

关于activiti工作流表数据结构

工作流表结构分为两种:

  • activiti 自带表( ACT_ 开头的表)
  • 框架自定义流程表(T_ACT_ 开头的表)

工作流所有数据清空

除了 ACT_GE_PROPERTY 表之外,其他所有的activiti自带表和所有框架自定义流程表都可以清空。 执行以下sql语句:

truncate table ACT_EVT_LOG;
truncate table ACT_GE_BYTEARRAY;
truncate table ACT_HI_DETAIL;
truncate table ACT_HI_COMMENT;
truncate table ACT_HI_IDENTITYLINK;
truncate table ACT_HI_PROCINST;
truncate table ACT_HI_VARINST;
truncate table ACT_HI_TASKINST;
truncate table ACT_HI_ACTINST;
truncate table ACT_RU_IDENTITYLINK;
truncate table ACT_RU_TASK;
truncate table ACT_RU_VARIABLE;
truncate table ACT_RU_EXECUTION;
truncate table ACT_HI_ATTACHMENT;
truncate table ACT_RU_EVENT_SUBSCR;
truncate table ACT_RU_JOB;
truncate table ACT_ID_GROUP;
truncate table ACT_ID_INFO;
truncate table ACT_ID_MEMBERSHIP;
truncate table ACT_ID_USER;
truncate table ACT_PROCDEF_INFO;
truncate table ACT_RE_DEPLOYMENT;
truncate table ACT_RE_MODEL;
truncate table ACT_RE_PROCDEF;
truncate table T_ACT_BUSINESS;
truncate table T_ACT_PROCESS;
truncate table T_ACT_NODE_ASSIGNEES;
truncate table T_ACT_CATEGORY;
truncate table T_ACT_MODEL;
truncate table T_ACT_NODE;
truncate table T_ACT_PERMISSIONS;
truncate table T_ACT_STARTER;

工作流业务流程有关数据清空

activiti 自带表清除所有 ACT_HI_ 开头和 ACT_RU_ 开头的表数据。

框架自定义流程表清除 T_ACT_BUSINESS 表和 T_ACT_NODE_ASSIGNEES 。

执行以下语句。

truncate table ACT_HI_DETAIL;
truncate table ACT_HI_COMMENT;
truncate table ACT_HI_IDENTITYLINK;
truncate table ACT_HI_PROCINST;
truncate table ACT_HI_VARINST;
truncate table ACT_HI_TASKINST;
truncate table ACT_HI_ACTINST;
truncate table ACT_RU_IDENTITYLINK;
truncate table ACT_RU_TASK;
truncate table ACT_RU_VARIABLE;
truncate table ACT_RU_EXECUTION;
truncate table ACT_HI_ATTACHMENT;
truncate table ACT_RU_EVENT_SUBSCR;
truncate table ACT_RU_JOB;
truncate table T_ACT_BUSINESS;
truncate table T_ACT_NODE_ASSIGNEES;

注意事项

在执行清空数据操作时有可能会遇到以下问题: ORA-02266: 表中的唯一/主键被启用的外键引用 需要做以下操作对表数据进行清空:

alter table 表名 disable primary key cascade;
truncate table 表名;
alter table 表名 enable primary key;


清理activiti工作流删除数据都需要删除哪些表和删除表的顺序详解

DELETE FROM `act_hi_detail` WHERE 1=1; DELETE FROM `act_hi_comment` WHERE 1=1; DELETE FROM `act_hi_identitylink` WHERE 1=1; DELETE FROM `act_hi_procinst` WHERE 1=1; DELETE FROM `act_hi_varinst` WHERE 1=1; DELETE FROM `act_hi_taskinst` WHERE 1=1; DELETE FROM `act_hi_actinst` WHERE 1=1; DELETE FROM `act_ru_identitylink` WHERE 1=1; DELETE FROM `act_ru_task` WHERE 1=1; DELETE FROM `act_ru_execution` WHERE 1=1; DELETE FROM `act_re_procdef` WHERE 1=1;

DELETE FROM act_ru_variable WHERE 1=1;
DELETE FROM act_ru_execution WHERE 1=1;
// 已部署的流程信息,删除前请自行确认
DELETE FROM act_ge_bytearray WHERE 1=1;
DELETE FROM act_re_deployment WHERE 1=1;


-- 先把外键约束关闭,清空后在打开即可。

SET FOREIGN_KEY_CHECKS = 0;   -- 先归0
  SET FOREIGN_KEY_CHECKS = 1;   -- 然后设置1


posted @ 2024-06-25 10:35  一品堂.技术学习笔记  阅读(3)  评论(0编辑  收藏  举报