English |
---|
In development server, due to the fact that process design will always get updated and developed, there will be more and more XPDLs cached in the memory. In the long run, this may cause "java.lang.OutOfMemoryError" exception during runtime or server startup. To solve this issue, we will need to clean up the unused XPDLs with following steps. The following example queries are written in MySQL and MSSQL syntax. |
Chinese |
---|
在开发服务器中,由于进程设计总是会得到更新和开发的,所以内存中会有越来越多的XPDL缓存。从长远来看,这可能会在运行时或服务器启动时导致“ java.lang.OutOfMemoryError ”异常。要解决这个问题,我们需要按照以下步骤清理未使用的XPDL。以下示例查询是使用MySQL和MSSQL语法编写的。 |
...
Note |
---|
|
1. Please shutdown your application server. Thai |
---|
โปรดปิดเซิร์ฟเวอร์แอปพลิเคชันของคุณ |
2. Please do a full database backup before proceeding to the following steps. Chinese |
---|
请在进行以下步骤之前先完成数据库备份。 |
Thai |
---|
กรุณาทำการสำรองฐานข้อมูลเต็มรูปแบบก่อนที่จะดำเนินการตามขั้นตอนต่อไปนี้ |
|
1. Check existing count of XPDLs
Thai |
---|
1. ตรวจสอบจำนวน XPDL ที่มีอยู่ |
...
Code Block |
---|
language | sql |
---|
title | MySQL, MSSQL, Oracle |
---|
|
select count(*) from SHKXPDLS |
2. Check the count of unused XPDLs
Thai |
---|
2.ตรวจสอบจำนวน XPDL ที่ไม่ได้ใช้ |
...
Code Block |
---|
|
select * from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, TO_CHAR(packageVersion) from app_package
) group by packageId, packageVersion
); |
3. Delete completed process instances data to clean up more XPDLs from cache
Chinese |
---|
3.删除已完成的流程实例数据以清除缓存中的更多XPDL |
...
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010);
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010);
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
Code Block |
---|
|
delete (select sa.* from SHKAssignmentsTable sa
left join SHKProcesses sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete (select sad.* from SHKActivityData sad
left join SHKActivities sac on sad.Activity = sac.oid
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select sac.* from SHKActivities sac
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spd.* from SHKProcessData spd
left join SHKProcesses sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spr.* from SHKProcessRequesters spr
left join SHKProcesses sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); |
To limit the process within a time period for started and completed time, change all the where clause to following and modify the date.
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) <= '2020-05-06 23:59:59.999')
and (FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59.999') |
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (DATEADD(s, ((sp.Started-sp.StartedTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((sp.Started-sp.StartedTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59')
and (DATEADD(s, ((sp.LastStateTime-sp.LastStateTimeTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((sp.LastStateTime-sp.LastStateTimeTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59') |
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) <= '2020-05-06 23:59:59')
and (FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59') |
If you would like to clean the all the process instances data including the running process instances, you can use the following query.
WARNING This deletes all your process records. Perform a backup before running the query below and is not recommended to be executed on a production server!If you would like to clean the all the process instances data including the running process instances, you can use the following query.
Chinese |
---|
如果要清除包括正在运行的流程实例在内的所有流程实例数据,则可以使用以下查询。 |
...
Code Block |
---|
|
delete from SHKAssignmentsTable;
delete from SHKAndJoinTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses; |
4. Delete the unused XDPLs
Thai |
---|
4.ลบ XDPL ที่ไม่ได้ใช้ |
...