dbTalk Databases Forums  

Duplicate transaction

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Duplicate transaction in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sfama
 
Posts: n/a

Default Duplicate transaction - 07-11-2006 , 10:09 AM






Hi!
I have a problem using XA transaction.
I have two database on the same oracle server.
If I start two transactions with the same XID, one transaction returns
an XA and Oracle error (ORA-24757).

The two trasactions are started from two different clients.
I'd like to know if there is a workaround about this problem, or if
Oracle is able to understand that the XID is related to two different
databases also if on the same server.

Then, I read on one google group, that Oracle keeps in memory, for a
while, the XID of the transaction also if they are ended (committed or
rolled-back). Is this true? Is there a way to deny this Oracle
behaviour?

Thank you!


Reply With Quote
  #2  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Duplicate transaction - 07-11-2006 , 11:00 AM






sfama wrote:
Quote:
Hi!
I have a problem using XA transaction.
I have two database on the same oracle server.
If I start two transactions with the same XID, one transaction returns
an XA and Oracle error (ORA-24757).

The two trasactions are started from two different clients.
I'd like to know if there is a workaround about this problem, or if
Oracle is able to understand that the XID is related to two different
databases also if on the same server.

Then, I read on one google group, that Oracle keeps in memory, for a
while, the XID of the transaction also if they are ended (committed or
rolled-back). Is this true? Is there a way to deny this Oracle
behaviour?

Thank you!

Why explicitly state a transaction identifier? Let Oracle handle the
transactions for you. It's pretty good at doing that job! Please go
through the Oracle Concepts manual (http://tahiti.oracle.com) for your
specific version to get a better understanding of how Oracle handles
transactions.

Thanks,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


Reply With Quote
  #3  
Old   
sfama
 
Posts: n/a

Default Re: Duplicate transaction - 07-12-2006 , 03:12 AM



Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?

Thank you!


Brian Peasland ha scritto:

Quote:
sfama wrote:
Hi!
I have a problem using XA transaction.
I have two database on the same oracle server.
If I start two transactions with the same XID, one transaction returns
an XA and Oracle error (ORA-24757).

The two trasactions are started from two different clients.
I'd like to know if there is a workaround about this problem, or if
Oracle is able to understand that the XID is related to two different
databases also if on the same server.

Then, I read on one google group, that Oracle keeps in memory, for a
while, the XID of the transaction also if they are ended (committed or
rolled-back). Is this true? Is there a way to deny this Oracle
behaviour?

Thank you!


Why explicitly state a transaction identifier? Let Oracle handle the
transactions for you. It's pretty good at doing that job! Please go
through the Oracle Concepts manual (http://tahiti.oracle.com) for your
specific version to get a better understanding of how Oracle handles
transactions.

Thanks,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


Reply With Quote
  #4  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Duplicate transaction - 07-12-2006 , 07:50 AM



sfama wrote:
Quote:
Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?
The workaround is to not state a transaction identifier. Do you have a
specific need to do so? If you must state a transaction identifier, why
must you do that? If you do not need to, don't as it can cause you
problems. Did you read the concepts manual pertaining to transactions?

HTH,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


Reply With Quote
  #5  
Old   
sfama
 
Posts: n/a

Default Re: Duplicate transaction - 07-12-2006 , 09:47 AM



Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.

We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.

We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.

About the manual, I'm giving a look at this!
Thanks!

Brian Peasland ha scritto:

Quote:
sfama wrote:
Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?

The workaround is to not state a transaction identifier. Do you have a
specific need to do so? If you must state a transaction identifier, why
must you do that? If you do not need to, don't as it can cause you
problems. Did you read the concepts manual pertaining to transactions?

HTH,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


Reply With Quote
  #6  
Old   
DA Morgan
 
Posts: n/a

Default Re: Duplicate transaction - 07-12-2006 , 10:26 AM



sfama wrote:
Quote:
Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.

We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.

We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.

About the manual, I'm giving a look at this!
Thanks!

Brian Peasland ha scritto:

sfama wrote:
Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?
The workaround is to not state a transaction identifier. Do you have a
specific need to do so? If you must state a transaction identifier, why
must you do that? If you do not need to, don't as it can cause you
problems. Did you read the concepts manual pertaining to transactions?

HTH,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Please stop top posting. Thank you.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #7  
Old   
sfama
 
Posts: n/a

Default Re: Duplicate transaction - 07-13-2006 , 02:53 AM




sfama ha scritto:

Quote:
Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.

We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.

We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.

About the manual, I'm giving a look at this!
Thanks!

Brian Peasland ha scritto:

sfama wrote:
Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?

The workaround is to not state a transaction identifier. Do you have a
specific need to do so? If you must state a transaction identifier, why
must you do that? If you do not need to, don't as it can cause you
problems. Did you read the concepts manual pertaining to transactions?

HTH,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.

We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.

We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.

About the manual, I'm giving a look at this!
Thanks!



Reply With Quote
  #8  
Old   
sfama
 
Posts: n/a

Default Re: Duplicate transaction - 07-13-2006 , 04:56 AM



Brian Peasland ha scritto:

Quote:
sfama wrote:
Yes, it could be a good solution,
but if it couldn't be possible for me, is there a way to solve this
problem or to have a workaroud?

The workaround is to not state a transaction identifier. Do you have a
specific need to do so? If you must state a transaction identifier, why
must you do that? If you do not need to, don't as it can cause you
problems. Did you read the concepts manual pertaining to transactions?

HTH,
Brian

--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.

We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.

We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.

About the manual, I'm giving a look at this!
Thanks!



Reply With Quote
  #9  
Old   
DA Morgan
 
Posts: n/a

Default Re: Duplicate transaction - 07-13-2006 , 10:32 AM



sfama wrote:
Quote:
Brian Peasland ha scritto:

sfama wrote:
The workaround is to not state a transaction identifier. Do you have a
specific need to do so?
snipped

HTH,
Brian

--

cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.
The question asked above is: Why? Is there any business case for doing this?
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #10  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Duplicate transaction - 07-13-2006 , 10:57 AM



Quote:
Yes,
cause may happen that one or more clients not developed from me, start
trasactions and set XIDs.
In all my years working with Oracle, I've never once had to set a
transaction id. And I cannot think of a reason where I would need to do
such a thing. Like I said before, Oracle is pretty good at managing
transactions for you....in all but the rarest of circumstances, let
Oracle do that job for you. Just because you can....does not mean you
should....

If I were using applications that explicitly set a transaction id, then
I'd go back to the application vendor or application developer and tell
them to give me code that does not do this. Otherwise, as you have seen,
their application may not work correctly. This is an application issue,
not a database issue so the *fix* needs to go into the application
vendor/developer's hands.

Quote:
We'd like to prevent that two clients set the same XID; I made some
test and Oracle stops the transaction if one XID has just been used.
I have no idea how you can prevent this other than to stop the code from
explicitly setting the XID. If two clients were to set the same XID,
then the only way to stop this is in the application code, not in the
database.

Quote:
We tried to set another transaction code: if we receive a request to
start a transaction and a XID from the client, we set another
trasaction code. This goes well. But if something wrong happens and a
transaction was not completed, we lost the transaction code, but we
have the XID (I don't know if I'm clear). So we'd like not to use the
transaction code and use only th XID, but to avoid to have duplicate
XID from different client, or if this happens, that Oracle manages it.
Why do you care about the transaction code or XID here? If you dont set
it, dont worry about it....Oracle will handle everything for you. If the
transaction was not completed, don't worry about it...when a new
transaction starts, Oracle will handle the transaction for you. If you
choose to take matters into your own hands, you'll have to handle all of
the things that Oracle handles for you quite nicely!

I guess I do not know how to be more clear other than to politely say
that you should not explicitly set the XID in your code. Doing so is a
bad idea, as you have seen. One should only do this sort of thing if
they have a specific need that the database does not meet for them. And
making this determination should only be done once one *fully*,
*completely*, and *thoroughly* understands Oracle transaction model.

Cheers,
Brian


--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.