Delete orphaned workflow packages and workitems
Created: 9 April 2010 Modified:Originally published on chrislynch.info website.
Log into database and perform the following queries
delete from dmi_package_s where r_workflow_id not in (select r_object_id from dm_workflow_s);
delete from dmi_package_r where r_object_id not in (select r_object_id from dmi_package_s);
delete from dmi_workitem_s where r_workflow_id not in (select r_object_id from dm_workflow_s);
delete from dmi_workitem_r where r_object_id not in (select r_object_id from dmi_workitem_s);