Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Turning off DML commit when session is exited or disconnected
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
oracle user  
View profile  
 More options Dec 18 2008, 6:28 am
Newsgroups: comp.databases.oracle.server
From: oracle user <rcl...@gmail.com>
Date: Thu, 18 Dec 2008 03:28:03 -0800 (PST)
Local: Thurs, Dec 18 2008 6:28 am
Subject: Turning off DML commit when session is exited or disconnected
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

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sybrandb  
View profile  
 More options Dec 18 2008, 8:04 am
Newsgroups: comp.databases.oracle.server
From: sybrandb <sybra...@gmail.com>
Date: Thu, 18 Dec 2008 05:04:31 -0800 (PST)
Local: Thurs, Dec 18 2008 8:04 am
Subject: Re: Turning off DML commit when session is exited or disconnected
On 18 dec, 12:28, oracle user <rcl...@gmail.com> wrote:

> 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

It is NOT possible.
How would it be? By design, your transaction ends by exiting Oracle.
It is a feature of the database, not of sql*plus.
If you don't want to commit your transaction, you issue rollback.
This won't get you RSI.

--
Sybrand Bakker
Senior Oracle DBA


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ddf  
View profile  
 More options Dec 18 2008, 9:04 am
Newsgroups: comp.databases.oracle.server
From: ddf <orat...@msn.com>
Date: Thu, 18 Dec 2008 06:04:40 -0800 (PST)
Local: Thurs, Dec 18 2008 9:04 am
Subject: Re: Turning off DML commit when session is exited or disconnected
Comments embedded.
On Dec 18, 5:28 am, oracle user <rcl...@gmail.com> wrote:

> 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 .

Sorry, you DO commit the DML as, by default, an 'exit' is actually an
'exit commit'.  You do have the option to execute an 'exit rollback'
instead:

SQL> --
SQL> -- Create a test table
SQL> --
SQL> create table mytest (mykey number,
  2               myval varchar2(40),
  3               constraint mytest_pk
  4               primary key(mykey)
  5  );

Table created.

SQL>
SQL> --
SQL> -- Insert data we don't want to preserve
SQL> --
SQL> insert all
  2  into mytest
  3  values (1, 'Test 1')
  4  into mytest
  5  values (2, 'Test 2')
  6  into mytest
  7  values (3, 'Test 3')
  8  into mytest
  9  values (4, 'Test 4')
 10  into mytest
 11  values (5, 'Test 5')
 12  select *
 13  from dual;

5 rows created.

SQL>
SQL> --
SQL> -- Prove the insert succeeded
SQL> --
SQL> select * from mytest;

     MYKEY MYVAL
---------- ----------------------------------------
         1 Test 1
         2 Test 2
         3 Test 3
         4 Test 4
         5 Test 5

SQL>
SQL> --
SQL> -- Exit session and discard data changes
SQL> --
SQL> exit rollback
Disconnected from Oracle Database 11g Enterprise Edition Release
11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options

c:\sql\orcl\examples>sqlplus /nolog

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Dec 18 08:02:51 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

SQL> connect #######/^^^^^^^^^^^^^^^^^
Connected.
SQL> set echo on
SQL> @rollback_on_exit_2
SQL> --
SQL> -- Verify the inserts from the previous
SQL> -- session weren't preserved by the 'exit'
SQL> --
SQL> select * from mytest;

no rows selected

SQL>

> Is it possible to turn off this default behaviour.

Sort of.  See above.

> Thanks in Advance

David Fitzjarrell

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cristian Cudizio  
View profile  
 More options Dec 18 2008, 9:12 am
Newsgroups: comp.databases.oracle.server
From: Cristian Cudizio <cristian.cudi...@yahoo.it>
Date: Thu, 18 Dec 2008 06:12:07 -0800 (PST)
Local: Thurs, Dec 18 2008 9:12 am
Subject: Re: Turning off DML commit when session is exited or disconnected
On 18 Dic, 14:04, sybrandb <sybra...@gmail.com> wrote:

Well, i've to admit that this for me is a surprise. I've always used
explicit commit or rollback
but i've never knew that exiting or disconnecting from sqlplus
transaction gets automatically
committed.  It is true that this behaviour cannot be changed, but it
is a feature
of SQL*Plus (http://download.oracle.com/docs/cd/B19306_01/server.102/
b14357/ch12023.htm#i2697968)
If you kill a session, oracle rollbacks any changes.

Regards,
 Cristian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy  
View profile  
 More options Dec 18 2008, 9:22 am
Newsgroups: comp.databases.oracle.server
From: Jeremy <jeremy0...@gmail.com>
Date: Thu, 18 Dec 2008 14:22:12 -0000
Local: Thurs, Dec 18 2008 9:22 am
Subject: Re: Turning off DML commit when session is exited or disconnected
In article <619d22a2-cb7a-4d1d-a889-11e4a9014d58
@r36g2000prf.googlegroups.com>, rcl...@gmail.com says...>

> 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

in sqlplus:

SQL> set autocommit off

?

--
jeremy


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sybrandb  
View profile  
 More options Dec 18 2008, 9:49 am
Newsgroups: comp.databases.oracle.server
From: sybrandb <sybra...@gmail.com>
Date: Thu, 18 Dec 2008 06:49:50 -0800 (PST)
Local: Thurs, Dec 18 2008 9:49 am
Subject: Re: Turning off DML commit when session is exited or disconnected
On 18 dec, 15:12, Cristian Cudizio <cristian.cudi...@yahoo.it> wrote:

Cristian,
It is NOT a feature of sql*plus. It is a feature of Oracle.
It applies to anything connecting to Oracle, leaving with a proper
exit command.

--
Sybrand Bakker
Senior Oracle DBA


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DA Morgan  
View profile  
 More options Dec 18 2008, 10:11 am
Newsgroups: comp.databases.oracle.server
From: DA Morgan <damor...@psoug.org>
Date: Thu, 18 Dec 2008 07:11:46 -0800
Local: Thurs, Dec 18 2008 10:11 am
Subject: Re: Turning off DML commit when session is exited or disconnected

Jeremy wrote:
> In article <619d22a2-cb7a-4d1d-a889-11e4a9014d58
> @r36g2000prf.googlegroups.com>, rcl...@gmail.com says...>
>> 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

> in sqlplus:

> SQL> set autocommit off

> ?

It is best to test advice before giving it. <g>

In sqlplus, not sqlplusw, autocommit is off by default.
Closing the executable commits uncommited transactions.
You have misunderstood the autocommit parameter.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damor...@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy  
View profile  
 More options Dec 18 2008, 10:14 am
Newsgroups: comp.databases.oracle.server
From: Jeremy <jeremy0...@gmail.com>
Date: Thu, 18 Dec 2008 15:14:20 -0000
Local: Thurs, Dec 18 2008 10:14 am
Subject: Re: Turning off DML commit when session is exited or disconnected
In article <1229613105.99...@bubbleator.drizzle.com>, damor...@psoug.org
says...>

It appears so.

<goes to make a coffee>

--
jeremy


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cristian Cudizio  
View profile  
 More options Dec 18 2008, 10:25 am
Newsgroups: comp.databases.oracle.server
From: Cristian Cudizio <cristian.cudi...@yahoo.it>
Date: Thu, 18 Dec 2008 07:25:07 -0800 (PST)
Local: Thurs, Dec 18 2008 10:25 am
Subject: Re: Turning off DML commit when session is exited or disconnected
On 18 Dic, 15:49, sybrandb <sybra...@gmail.com> wrote:

Thanks Sybrand, you are right, i've confused closing a session with
recovering a crashed session.  I've seen that also jdbc drivers on
closing
the connection do an implicit commit
http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/basic.ht...

Regards,
 Cristian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim X  
View profile  
 More options Dec 18 2008, 10:53 pm
Newsgroups: comp.databases.oracle.server
From: Tim X <t...@nospam.dev.null>
Date: Fri, 19 Dec 2008 14:53:57 +1100
Local: Thurs, Dec 18 2008 10:53 pm
Subject: Re: Turning off DML commit when session is exited or disconnected

oracle user <rcl...@gmail.com> 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.

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cristian Cudizio  
View profile  
 More options Dec 19 2008, 3:10 am
Newsgroups: comp.databases.oracle.server
From: Cristian Cudizio <cristian.cudi...@yahoo.it>
Date: Fri, 19 Dec 2008 00:10:32 -0800 (PST)
Local: Fri, Dec 19 2008 3:10 am
Subject: Re: Turning off DML commit when session is exited or disconnected
On 19 Dic, 04:53, Tim X <t...@nospam.dev.null> wrote:

> oracle user <rcl...@gmail.com> 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)

Regards,
 Cristian

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google