activiti 工作流历史数据删除
1. 查找已完成的流程
SELECT PROC_INST_ID_ FROM ACT_HI_PROCINST WHERE END_ACT_ID_ IS NOT NULL OR DELETE_REASON_ IS NOT NULL;
2. 删除已完成流程的相关记录
DELETE FROM ACT_HI_DETAIL WHERE PROC_INST_ID_ = ''; DELETE gb FROM ACT_GE_BYTEARRAY gb INNER JOIN ACT_HI_VARINST hv ON gb.ID_ = hv.BYTEARRAY_ID_ WHERE hv.BYTEARRAY_ID_ IS NOT NULL AND hv.PROC_INST_ID_ = ''; DELETE FROM ACT_HI_VARINST WHERE PROC_INST_ID_ = ''; DELETE FROM ACT_HI_ACTINST WHERE PROC_INST_ID_ = ''; DELETE FROM ACT_HI_TASKINST WHERE PROC_INST_ID_ = ''; DELETE FROM ACT_HI_IDENTITYLINK WHERE PROC_INST_ID_ = ''; DELETE FROM ACT_HI_COMMENT WHERE PROC_INST_ID_ = ''; DELETE FROM ACT_HI_PROCINST WHERE SUPER_PROCESS_INSTANCE_ID_ = ''; DELETE FROM ACT_HI_PROCINST WHERE PROC_INST_ID_ = '';