Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SQL*Plus commit on exit?

Tags:

oracle

sqlplus

Surely this should be the same as a termination of a session and cause a rollback? It seems to me to be the most un-Oracle thing possible. I was actually shocked when I found out that it did this

More importantly - would anyone object if Oracle changed it to rollback on exit?

like image 262
Chris Gill Avatar asked Sep 02 '09 14:09

Chris Gill


People also ask

Does Sqlplus COMMIT on exit?

Oracle by default does not automatically commit a transaction (Autocommit is typically off). Transaction Management (Commit or Rollback) is left to the client as this askTom post explains nicely. The tool you use may provide this option for you. For e.g., SQL*Plus commits any open transaction upon exit.

How do I turn off auto commit in SQL Developer?

Turn off the auto commit option in SqlDeveloper. Go to Tools -> Preferences -> Database -> ObjectViewer Parameters and uncheck the box Set Auto Commit On.

How do I COMMIT in SQL Plus?

You can specify integer to assign the transaction a system change number if you do not wish to commit the transaction using the current system change number. FORCE CORRUPT_XID 'string' - allows you to commit a corrupt or in doubt transaction by specifying the transaction ID in single quotes as string.

How do I stop SQL Plus?

Solution 1. 1) If it is a windows SQL*PLus, click on File/Cancel. 2) Press Cntrl + C which will also stop the execution.


1 Answers

Funnily enough, with the 11gR2 release this week (2009-09-03), SQL*Plus now has an option to COMMIT or ROLLBACK on EXIT. Doc here

I'd guess in the next few weeks/months, there'll be an 11gR2 Instant Client which you can use against your current database and get your desired behaviour

A caution to be aware of. If you DISCONNECT or CONNECT to a different session, it will still implicitly commit the transaction (according to the doc).

like image 106
Gary Myers Avatar answered Oct 18 '22 15:10

Gary Myers