1

if i have a very long run UPDATE query that takes hours and I happen to cancel in middle of when it's running.

I got this message below: "User requested cancel of current operation"

  1. Will Oracle automatically roll back the transactions?
  2. Will DB lock be still acquired if I cancel the query? If so, how to unlock?
  3. How to check which Update query is locking the database?

Thanks.

2
  • Oracle only rolled back the statement you executed, the transaction itself was not rolled back (btw: it's very simple to check that for yourself) Commented Jan 17, 2014 at 7:52
  • simple? Why don't you tell me how as I'm quiet new to Oracle DB. Commented Jan 17, 2014 at 21:02

1 Answer 1

2

It depends.

Assuming that whatever client application you're using properly implemented a query timeout and that the error indicates that the timeout was exceeded, then Oracle will begin rolling back the transaction when the error is thrown. Once the transaction finishes rolling back, the locks will be released. Be aware, though, that it can easily take at least as long to roll back the query as it took to run. So it will likely be a while before the locks are released.

If, on the other hand, the client application hasn't implemented the cancellation properly, the client may not have notified Oracle to cancel the transaction so it will continue. Depending on the Oracle configuration and exactly what the client does, the database may detect some time later that the application was not responding and terminate the connection (going through the same rollback process discussed above). Or Oracle may end up continuing to process the query.

You can see what sessions are holding locks and which are waiting on locks by querying dba_waiters and dba_blockers.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm using oracle sql developer tool to run Query. Which one of above applies to this client?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.