Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.misc -> Re: Duplicate transaction

Re: Duplicate transaction

From: Brian Peasland <>
Date: Thu, 13 Jul 2006 15:57:25 GMT
Message-ID: <>

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

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

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



Brian Peasland

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
Received on Thu Jul 13 2006 - 10:57:25 CDT

Original text of this message