Re: Turning off DML commit when session is exited or disconnected



On 19 Dic, 04:53, Tim X <t...@xxxxxxxxxxxxxxx> wrote:
oracle user <rcl...@xxxxxxxxx> writes:
If i issue a DML statment in oracle database from sqlplus session
(where autocommit is off by default ) and then 'exit' or 'disc' the
session without explicitly commiting the DML ,the DML gets commited .
Is it possible to turn off this default behaviour.
Thanks in Advance

Just to clarify....

If your session is terminated through what would be considered 'normal'
or explicit behavior, such as issuing an exit, an implicit commit is
executed. However, if your session is lost due to an abnormal
termination/exit, such as losing your network connection, then I believe an implicit rollback occurs.

If there is a abnormal closing of network connection Oracle by default
makes nothing, so if there are pending transactions there must be
a manual intervention by a DBA to kill the session to release locks.
Yet
in this situation the session can stay with status "KILLED".
You have to use RESORCE MANAGER (but you can only if you have
Enterprise Edition) or specify SQLNET.EXPIRE_TIME
(http://download.oracle.com/docs/cd/B19306_01/network.102/b14213/
sqlnet.htm#sthref474)




This is quite sane and I think acceptable behavior. If you are
explicitly exiting a session, then you should do a rollback if you don't
want your changes committed. On the other hand, if your session is lost
part way through execution, then you want the system to perform a
rollback so that the system is left in a known state where all
transaction groups have completed.

Although I've not checked, it may be possible to mimic the bahavior your
after with session triggers, but I'd avoid doing that as other users
unaware of your changes who expect the default action may get
burnt. Rule of thumb, don't mess with Oracle's normal behavior with
respect to commits and rollbacks - instead, adjust how you work to fit
with how it works. Once you start changing things here, you will end up
with all sorts of user confusion - its bad enough that many developers
seem to have trouble remembering that DDL causes an implicit commit or
even understanding what is and is not a DDL action. Best not to make
things potentially more muddy.

Why do you feel you need to disable the implicit commit on a normal
session exit rather than relying on the user to do the right thing based
on whatever they have done in that session? Maybe there is a different
solution to your problem

Tim

--
tcross (at) rapttech dot com dot au

Regards,
Cristian
.



Relevant Pages

  • Re: nfsd pull request for 2.6.30
    ... commit 4770822f16154559c8168c1b7171c9941a7c4d89 ... [nfs41: ... This creates the nfsv4.1 session on mount. ... support minorversion 1 for nfs4_check_lease ...
    (Linux-Kernel)
  • Re: Turning off DML commit when session is exited or disconnected
    ... If your session is terminated through what would be considered 'normal' ... or explicit behavior, such as issuing an exit, an implicit commit is ... termination/exit, such as losing your network connection, then I believe an implicit rollback occurs. ...
    (comp.databases.oracle.server)
  • Re: BEGIN TRANS... Wheres The Error?
    ... I want to block another session from reading ... >row until the commit but they can both read at the same ... use of UPDLOCK inside ... both instances would be executing at the ...
    (microsoft.public.sqlserver.programming)
  • Re: if I call a plsql is there a commit?
    ... After p2 is there a commit or it is after end? ... Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production ... SQL> CREATE PROCEDURE p2 IS ... -- Session 2 in a different SQL*Plus session ...
    (comp.databases.oracle.misc)
  • Re: DX Lock problem
    ... oracle dx lock commit rollback ... calling session was terminated. ...
    (comp.databases.oracle.server)