Implementing a working Purge script to get rid of old Oracle SOA BPEL instances is one of the most important tasks to maintain a working Oracle SOA Suite environment in production. Forgetting to do so will have the whole environment slow down as Oracle SOA Bpel database get bigger.
Depending on your business requirement, I usually advise purging instances data older than 2 months. Instances data are useful to troubleshoot issues with BPEL processes and shouldn’t be kept once those are successfully completed.
You may also need to update failed instances status to force them in a purgeable state. Especially for unrecoverable instances.(See at the bottom of the gist)