Currently there is no functionality in XIVY Server Administrator App(s) to clean up old workflow data from XIVY system DB. But it can happen that all the old data is no more used and slows down the data base. How can I get rid of them?

asked 25.09.2013 at 00:09

Tamas%20KIS's gravatar image

Tamas KIS
(suspended)
accept rate: 60%


Delete Tasks and Cases in Xpert.ivy 3.9

via Workflow Admin UI

Workflow Administrators can delete tasks and cases within a date range over the administration UI. alt text



via SystemDB

Sample query to select taskIds which will be destroyed. Rewrite it to a DELETE statement to really remove the data.

SELECT d.TaskId
  FROM IWA_TaskData as d
  JOIN IWA_Task as t ON d.TaskId = t.TaskId
  WHERE t.State IN (6,7) /** delete only done and destroyed tasks **/
  AND d.TaskDataKind = 1; /** delete only start data, keep current data **/
  AND t.DoneTimestamp = XYZ /** limit the date: only delete data older than 3 years or similar **/
link
This answer is marked "community wiki".

answered 01.04.2016 at 11:34

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 01.04.2016 at 11:36

There are two ways to do this, one directly in the system DB and one with an API call.

Delete via Public API

you can build a process/App around the Public API: void deleteCompletedCase(ICase completedCase) throws PersistencyException

A simple script which deletes old cases could look as follows:

public class HistoricCaseDeleter {
    public static void doIt()
    {
        CaseQuery oldCasesQuery = CaseQuery.create().where()
            .state().isEqual(CaseState.DESTROYED).or()
            .state().isEqual(CaseState.DONE).or()
            .state().isEqual(CaseState.ZOMBIE)
            .and()
            .startTimestamp().isLowerThan(new java.util.Date(2010, 0, 1));

        for(ICase oldCase : Ivy.wf().getCaseQueryExecutor().getResults(oldCasesQuery))
        {
            Ivy.wf().deleteCompletedCase(oldCase);
        }
    }
}


Delete directly in System DB

You may clean up cases and tasks in Done (2) and Destroyed (3) state as follows:

  1. Stop Axon.ivy server v4.x or later
  2. Backup your DB (of course)
  3. Execute to know how many cases you are about to remove:
    SELECT COUNT() FROM [YourIvySystemDb].[dbo].[IWA_Case] WHERE State = 2 OR State = 3*

  4. Execute to remove them:
    DELETE FROM [YourIvySystemDb].[dbo].[IWA_Case] WHERE State = 2 OR State = 3

  5. You may shrink your DB to save disk space (e.g. MSSQL manager tool can do that)
  6. Start Axon.ivy server again
link
This answer is marked "community wiki".

answered 26.09.2013 at 02:56

Tamas%20KIS's gravatar image

Tamas KIS
(suspended)
accept rate: 60%

edited 01.04.2016 at 11:34

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×37
×11

Asked: 25.09.2013 at 00:09

Seen: 6,391 times

Last updated: 01.04.2016 at 11:36