Canceling activities
If an activity is consuming too many resources, or is running too long, you can cancel it. Canceling an activity is gentler than forcing the application that submitted the activity. A canceled activity returns SQL4725N to the user, but does not end the connection or affect any other user activity. Forcing the application ends both the connection and user activities.
About this task
You can only explicitly cancel an activity if a coordinator activity is currently working on a request for the activity. If you cancel an activity in the IDLE state (that is, no requests are being processed), the activity is placed in the CANCEL_PENDING state and is canceled on the next request that is received. For example, if you attempt to cancel a CURSOR activity between fetches, the SQL4725N error is not returned to the user until the next fetch after the cancel.
All user activities are cancelable, including the load utility and stored procedures.
Procedure
- Identify the activity that you want to cancel. You can use the WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES table function to identify the activities running in an application. You can also use the MON_GET_ACTIVITY_DETAILS_COMPLETE table function to view additional details about a particular activity if the information in WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES is not sufficient to identify the work that the activities are performing.
-
Cancel the activity using the WLM_CANCEL_ACTIVITY stored procedure.
The stored procedure takes the following arguments: application_handle, uow_id, and activity_id.