Use the deleteCompletedProcessInstances.py 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.
Before you begin
The following conditions must be met:
- Run the script in connected mode,
that is, do not use the wsadmin
-conntype none option.
- In the cluster where the Business Process Choreographer configuration
or Business Process Archive Manager where you want to delete instances
is configured, at least one cluster member must be running.
- Include the wsadmin
-user and -password options
to specify a user ID that has operator authority.
- If you are not working with the default
profile, use the wsadmin
-profileName profile option
to specify the profile.
About this task
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
- Change to the Business Process Choreographer
subdirectory where the administrative script is located.


Enter the following
command:
cd install_root/ProcessChoreographer/admin

Enter the following command:
cd install_root\ProcessChoreographer\admin
- Delete process instances from the database.

Enter the following
command:
install_root/bin/wsadmin.sh -f deleteCompletedProcessInstances.py
-cluster cluster_name
(-all | [-finished] [-terminated] [-failed])
[-templateName templateName]
[-validFromUTC timestamp]
[-startedBy userID]
[(-completedAfterLocal timestamp)|(-completedAfterUTC timestamp)]
[(-completedBeforeLocal timestamp)|(-completedBeforeUTC timestamp)]
Enter the following command:
install_root\bin\wsadmin -f deleteCompletedProcessInstances.py
-cluster cluster_name
(-all | [-finished] [-terminated] [-failed] )
[-templateName templateName]
[-validFromUTC timestamp]
[-startedBy userID]
[(-completedAfterLocal timestamp)|(-completedAfterUTC timestamp)]
[(-completedBeforeLocal timestamp)|(-completedBeforeUTC timestamp)]
where
- -clustercluster_name
- The name of the cluster where Business Process Choreographer configuration or Business Process
Archive Manager is
configured.
- -all
| [-finished] [-terminated] [-failed]
- Specifies which 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.
- -templateNametemplateName
- Optionally, specifies the name of the process template whose instances will be deleted.
If there are multiple process templates with 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
process template.
- -validFromUTCtimestamp
- 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
- -startedByuserID
- Optionally, only deletes completed process instances that were
started by the given User ID.
- -completedAfterLocaltimestamp
- 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 specify only a date, the time
defaults to
00:00:00 local time on the server.
- -completedAfterUTCtimestamp
- Optionally, specifies that only instances that completed after
the 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 specify only a date, the time
defaults to
00:00:00 local time on the server.
- -completedBeforeLocaltimestamp
- 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 specify only a date, the time
defaults to
00:00:00 local time on the server.
- -completedBeforeUTCtimestamp
- 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 specify only a date, the time
defaults to
00:00:00 local time on the server.
For example, to delete all
of the process instances that are running on cluster myCluster
that are in the state finished, and were started
by the user Anita:

Enter the following
command:
wsadmin.sh -f deleteCompletedProcessInstances.py
-cluster myCluster
-finished
-startedBy Anita
Enter the following command:
wsadmin -f deleteCompletedProcessInstances.py
-cluster myCluster
-finished
-startedBy Anita
If
Business Process Choreographer is configured on the cluster, the processes will be deleted from the
Business Process Choreographer runtime database. If Business Process Archive Manager is configured
on the cluster, the same command will delete the specified processes from the archive database
associated with the Business Process Archive Manager. Be careful not to delete any instances from a
runtime database that should actually be moved to an archive.
- Optional: If the
script triggers long-running work, the script might fail if the connection
timeout is not long enough to complete the action. Check the SystemOut.log file
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.
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 cluster.
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15