With the DBMS_RESUMABLE
package, you can suspend large operations that run out of space or reach space limits after executing for a long time, fix the problem, and make the statement resume execution. In this way you can write applications without worrying about running into space-related errors.
This chapter contains the following topics:
Operational Notes
When you suspend a statement, you should log the suspension in the alert log. You should also register a procedure to be executed when the statement is suspended. Using a view, you can monitor the progress of the statement and indicate whether the statement is currently executing or suspended.
Suspending a statement automatically results in suspending the transaction. Thus all transactional resources are held during a statement suspend and resume. When the error condition disappears, the suspended statement automatically resumes execution. A resumable space allocation can be suspended and resumed multiple times during execution.
A suspension timeout interval is associated with resumable space allocations. A resumable space allocation that is suspended for the timeout interval (the default is two hours) wakes up and returns an exception to the user. A suspended statement may be forced to throw an exception using the DBMS_RESUMABLE.ABORT()
procedure.
Table 123-1 DBMS_RESUMABLE Package Subprograms
Subprogram | Description |
---|---|
Aborts a suspended resumable space allocation |
|
Returns the current timeout value of the resumable space allocations for a session with |
|
Returns the current timeout value of resumable space allocations for the current session |
|
Sets the timeout of resumable space allocations for a session with |
|
Sets the timeout of resumable space allocations for the current session |
|
Looks for space-related errors in the error stack, otherwise returning |
This procedure aborts a suspended resumable space allocation. The parameter session_id
is the session ID in which the statement is executed. For a parallel DML/DDL, session_id
is any session ID that participates in the parallel DML/DDL. This operation is guaranteed to succeed. The procedure can be called either inside or outside of the AFTER SUSPEND
trigger.
This function returns the current timeout value of resumable space allocations for a session with session_id.
This function returns the current timeout value of resumable space allocations for the current session.
This procedure sets the timeout of resumable space allocations for a session with session_id.
The new timeout setting applies to the session immediately. If session_id
does not exist, no operation occurs.
This procedure sets the timeout of resumable space allocations for the current session. The new timeout setting applies to the session immediately.
This function looks for space-related errors in the error stack. If it cannot find a space related error, it will return FALSE.
Otherwise, TRUE
is returned and information about the particular object that causes the space error is returned.
DBMS_RESUMABLE.SPACE_ERROR_INFO error_type OUT VARCHAR2, object_type OUT VARCHAR2, object_owner OUT VARCHAR2, table_space_name OUT VARCHAR2, object_name OUT VARCHAR2, sub_object_name OUT VARCHAR2) RETURN BOOLEAN;
Table 123-8 SPACE_ERROR_INFO Function Parameters
Parameter | Description |
---|---|
|
The space error type. It will be one of the following:
|
|
The object type. It will be one of the following:
The type can also be |
|
The owner of the object. |
|
The table space where the object resides. |
|
The name of rollback segment, temp segment, table, index, or cluster. |
|
The partition name or sub-partition name of |