IBM BPM, V8.0.1, All platforms > Administer the IT infrastructure > Administer Business Process Choreographer > Use scripts to administer Business Process Choreographer > Delete Business Process Choreographer objects

Delete BPEL process instances

Use an administrative script to selectively delete from the Business Process Choreographer database or the Business Process Archive database any top-level BPEL process instances that have reached an end state of finished, terminated, or failed.

The following conditions must be met:

A top-level process instance is considered completed if it is in one of the following end states: finished, terminated, compensated, or failed. You specify criteria to selectively delete top-level process instances and all their associated data, such as instance custom properties, and subprocess instances, from the database.


Procedure

  1. Change to the Business Process Choreographer subdirectory where the administrative script is located.
    cd  INSTALL_ROOT/ProcessChoreographer/admin

    cd INSTALL_ROOT/ProcessChoreographer/admin

    cd INSTALL_ROOT\ProcessChoreographer\admin

  2. Delete process instances from the database.
     INSTALL_ROOT/bin/wsadmin.sh  –f deleteCompletedProcessInstances.py 
      (([-node  nodeName] -server  server_name) | (-cluster  cluster_name))
      (-all | [-finished] [-terminated] [-failed] )
      [-templateName  templateName 
      [-validFromUTC  timestamp]]
      [-startedBy  userID]
      [(-completedAfterLocal  timestamp)|(-completedAfterUTC  timestamp)]
      [(-completedBeforeLocal  timestamp)|(-completedBeforeUTC  timestamp)]

    •  INSTALL_ROOT/bin/wsadmin.sh  –f deleteCompletedProcessInstances.py 
        (([-node  nodeName] -server  server_name) | (-cluster  cluster_name))
        (-all | [-finished] [-terminated] [-failed] )
        [-templateName  templateName 
        [-validFromUTC  timestamp]]
        [-startedBy  userID]
        [(-completedAfterLocal  timestamp)|(-completedAfterUTC  timestamp)]
        [(-completedBeforeLocal  timestamp)|(-completedBeforeUTC  timestamp)]
    •  INSTALL_ROOT\bin\wsadmin –f deleteCompletedProcessInstances.py 
        (([-node  nodeName] -server  server_name) | (-cluster  cluster_name))
        (-all | [-finished] [-terminated] [-failed] )
        [-templateName  templateName 
        [-validFromUTC  timestamp]]
        [-startedBy  userID]
        [(-completedAfterLocal  timestamp)|(-completedAfterUTC  timestamp)]
        [(-completedBeforeLocal  timestamp)|(-completedBeforeUTC  timestamp)]

    Where:

    -node nodeName

    The name of the node where Business Process Choreographer is configured. This is optional when specifying the server name. The default is the local node.

    -server server_name

    The name of the server where Business Process Choreographer configuration or Business Process Archive Manager is configured. Required if the cluster name is not specified. You can specify the server name and node name or the cluster name.

    -cluster cluster_name

    The name of the cluster where Business Process Choreographer configuration or Business Process Archive Manager is configured. You can specify the cluster name or the server name and node name.

    -all | [-finished] [-terminated] [-failed] ]

    Specifies which task instances are to be deleted according to their state. The -all option means all end states: finished, terminated, and failed. If you do not specify -all, you must specify one or more of the end states.

    -templateName templateName

    Optionally, specifies the name of the process template whose instances will be deleted. If you specify this option you must also specify the nameSpace parameter. If there are multiple process templates sharing the same name but with different validFromUTC dates the instances for all process templates with that name are deleted unless you use the validFromUTC parameter to specify a particular template.

    -validFromUTC timestamp

    The date and time from which the template is valid in Coordinated Universal Time (UTC). The string must have the following format: 'yyyy-MM-ddThh:mm:ss' (year, month, day, T, hours, minutes, seconds).

    For example, 2005-01-31T13:40:50

    -startedBy userID

    Optionally, only deletes completed process instances that were started by the given User ID.

    -completedAfterLocal timestamp

    Optionally, specifies that only instances that completed after the given local time on the server are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you only specify a date, the time defaults to 00:00:00 local time on the server.

    -completedAfterUTC timestamp

    Optionally, specifies that only instances that completed after the given UTC time are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you only specify a date, the time defaults to 00:00:00 local time on the server.

    -completedBeforeLocal timestamp

    Optionally, specifies that only instances that completed before the given local time on the server are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you only specify a date, the time defaults to 00:00:00 local time on the server.

    -completedBeforeUTC timestamp

    Optionally, specifies that only instances that completed before the given UTC time are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you only specify a date, the time defaults to 00:00:00 local time on the server.

    For example, to delete all of the process instances running on node myNode in server myServer that are in the state finished, and were started by the user Anita: Enter the following command:

    wsadmin.sh –f deleteCompletedProcessInstances.py 
            -node  myNode -server  myServer 
            -finished
            -startedBy Anita

    wsadmin.sh –f deleteCompletedProcessInstances.py 
            -node  myNode -server  myServer 
            -finished
            -startedBy Anita

    wsadmin –f deleteCompletedProcessInstances.py 
            -node  myNode -server  myServer 
            -finished
            -startedBy Aita

  3. If the script triggers long-running work on the server, the script might fail if the connection timeout is not long enough to complete the action. Check the SystemOut.log file on the server to see whether you need to restart the script. If the timeout happens often, consider increasing the value of the timeout property for the connector you are using, or adjusting the script parameters to reduce the amount of work done on the server.


Results

The completed process instances have been deleted from the database associated with the Business Process Choreographer or Business Process Archive Manager configuration on the given deployment target.

Delete Business Process Choreographer objects


Related concepts:
How time zones are handled in Business Process Choreographer


Related tasks:
Delete process instances


Related information:

Options for maintaining an optimal Business Process Choreographer database size
Connection timeout when running a wsadmin script