You can use the following procedures to view and manually clear the state for the SYNC or UPGRADE context as needed after an unhandled exception or after manually cancelling an operation before completion. If this happens you will likely encounter one of the following ORA errors the next time you try to execute a procedure within the package. If a procedure terminates in a manner that prevents the post execution cleanup procedures from running then the status for the context will not get reset and prevent new operations from being executed.
If you receive an error similar to the following then a process is either currently executing within another session and it should either be allowed to continue executing or terminated if necessary.
"ORA-20040: There is another upgrade operation already executing."
"ORA-20040: There is another synchronization operation already executing."
- Execute the following procedure to see what operations are currently running for the SYNC and UPGRADE contexts.
EXECUTE INUSER.IN_DB_UTIL.IN_CONTEXT_PRINT
If the operation returned by the DISPLAY_CONTEXT procedure is known to have terminated or been killed then you can execute one of the following procedures to clear the status for both contexts (ALL) or for the specified context (SYNC or UPGRADE).
Important Do not execute any of the following procedures if any operations are still in progress as it will clear the call-stack and session attributes which will lead to undesired results and unhandled exceptions. If necessary, kill the session first then execute the following to clear the context state.
- To clear the session and call stack for all contexts (SYNC and UPGRADE), execute the following
procedure.
EXECUTE INUSER.IN_DB_UTIL.IN_SESSION_CLEAR_ALL
- To clear session and call stack for only the SYNC context, execute the following
procedure.
EXECUTE INUSER.IN_DB_UTIL.IN_SESSION_CLEAR_ALL('SYNC')
- To clear session and call stack for only the UPGRADE context, execute the following
procedure.
EXECUTE INUSER.IN_DB_UTIL.IN_SESSION_CLEAR_ALL('UPGRADE')