When does exiting Sqlplus not commit an insert statement? [message #378270] |
Mon, 29 December 2008 11:54 |
efachim
Messages: 42 Registered: July 2008
|
Member |
|
|
Hi Folks,
Has anyone come across a scenario where following an insert statement, you log out of sqlplus without an explicit commit statement, and then find that the inserted data was not committed? Contrary, to general consensus, which is that exiting sqlplus automatically commits data, it would seem that there might be a way to set up your environment so that exiting sqlplus does not automatically commit your data. Is this true?
TIA,
Efachim
|
|
|
|
|
|
Re: When does exiting Sqlplus not commit an insert statement? [message #380395 is a reply to message #378329] |
Sun, 11 January 2009 17:50 |
|
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
I think there may be multiple issues here:
1) in the old days, the default behaviour of SQLPLUS was: if you exit without commit, it would rollback.
2) at some point in time (mid 90's?), Oracle in its wisdom, decided to change this behaviour so that when you exit from SQLPLUS, you automatically commit (who knows why (I preffered the rollback behaviour myself)).
3) as has been demonstrated, it is possible to explicitly say rollback when you exit.
4) additionally, as I remember it, there is also a parameter somewhere to revert sqlplus back to the older rollback behaviour if desired.
5) complicating mattters further, oracle processes can in many situations recognize the difference between a controled exit of SQLPLUS, and a session that dies unexpectedly. Thus if your SQLPLUS program quits on you (ie. dies) a rollback will be done when the oracle processes recognize this. Thus a SQLPLUS session that ends without an explicit commit/rollback can go either way depending upon if the session ended by user request or not.
6) Lastly, it is also possible to exit SQLPLUS by request but return an error code. It is up in the air for me what happens when you exit with an error code. Maybe someone can fill us on this one.
Of course, the years are not always kind, with experience comes the ability to forget what we have learned. Maybe someone else remebers otherwise...
Kevin
[Updated on: Sun, 11 January 2009 17:52] Report message to a moderator
|
|
|