关于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;
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.

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

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;
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.

注意事项

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

alter table 表名 disable primary key cascade;
truncate table 表名;
alter table 表名 enable primary key;
  • 1.
  • 2.
  • 3.


清理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;
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
// 已部署的流程信息,删除前请自行确认
DELETE FROM act_ge_bytearray WHERE 1=1;
DELETE FROM act_re_deployment WHERE 1=1;
  • 1.
  • 2.
  • 3.


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

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



为人:谦逊、激情、博学、审问、慎思、明辨、 笃行
学问:纸上得来终觉浅,绝知此事要躬行
为事:工欲善其事,必先利其器。
态度:道阻且长,行则将至;行而不辍,未来可期
.....................................................................
------- 桃之夭夭,灼灼其华。之子于归,宜其室家。 ---------------
------- 桃之夭夭,有蕡其实。之子于归,宜其家室。 ---------------
------- 桃之夭夭,其叶蓁蓁。之子于归,宜其家人。 ---------------
=====================================================================
* 博客文章部分截图及内容来自于学习的书本及相应培训课程以及网络其他博客,仅做学习讨论之用,不做商业用途。