Lock between transaction branches of a global transaction

Hi,
I have an Oracle Database v.10.1.0.4, on which there are two schemas (A and B).
A table on schema A has a reference key on a table on schema B.
Now, i have a j2ee application that uses two distinct connection to performs inserts on both schemas within the same global transaction (using a JTATransactionManager), but i'm experiencing a lock in the following situation:
1 - On connection for schema B, a new ROW is inserted
2 - On connection for schema A, a new ROW is inserted referencing the new row in schema B, but the query is locked by the insert on schema B.
It is like the two transacions are loosely coupled and not tightly coupled as I would expect for distributed transaction on the same oracle instance (or at least they are not part of a global transaction and are treated as two distinct transaction).
Someone know if oracle jdbc drivers handle tightly coupled transactions for transaction branches on the same oracle instance that are part of the same global transaction?
Thanks,
Luca De Petrillo

http://www.myoracleguide.com/s/managelocks.htm

Similar Messages

  • Advise on using DBMS_XA with multiple branches under one global transaction

    Dear all
    I need some advise on using DBMS_XA from PL/SQL with tightly coupled multiple branches under one global transaction. Basically, I've successfully written some PL/SQL code that in 3 different sessions attaches to 3 different branches of one global transaction and before ending each branch they can see each others uncommitted data. So far so good.
    However, I'm not sure I completely understand how each branch must call xa_end, xa_prepare and xa_commit correctly using two phase commit and my calls result in errors like:
    ORA-24767: transaction branch prepare returns read-only (XA error code 3 = Transaction was read-only and has been committed)
    ORA-24756: transaction does not exist (XA error code -4 = XID is not valid)
    ORA-02051: another session or branch in same transaction failed or finalized
    This is the structure of my programs (3 SQL*Plus sessions):
    main: Uses xid 123|0 (branch 0 of global transaction 123). This should be the coordinator that commits using two phase commit across the 3 branches
    m1.xa_start tmnoflags
    m2.DML
    m3.Wait for thread A + B to manually be started and run xa_end
    m4.xa_end tmsuccess
    m5.xa_prepare
    m6.xa_commit false
    thread A: Uses xid 123|A (branch A of global transaction 123)
    a1.xa_start tmnoflags
    a2.DML -- thread A can see main and thread B's data
    a3.xa_end tmsuccess
    a4.xa_prepare -- required?
    a5.Should we also call xa_commit false?
    thread B: Uses xid 123|B (branch B of global transaction 123)
    b1.xa_start tmnoflags
    b2.DML -- thread B can see main and thread A's data
    b3.xa_end tmsuccess
    b4.xa_prepare -- required?
    b5.Should we also call xa_commit false?
    The failing steps are:
    m5
    m6
    a4
    a5
    b4
    b5
    Before starting calling xa_end I see 3 rows in V$GLOBAL_TRANSACTION, eg (hex 7B = decimal 123):
    FORMATID GLOBALID BRANCHID BRANCHES REFCOUNT PREPARECOUNT STATE FLAGS COUPLING
    203348753 0000007B 00000000000000000000000000000000 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000A 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    203348753 0000007B 0000000000000000000000000000000B 3 3 0 ACTIVE 0 TIGHTLY COUPLED
    Thanks a lot in advance.
    Cheers
    Finn

    OK, I've figured it out. This is poorly documented as it's not well explained how to handle the various return codes. Turns out that all but the last xa_prepare calls return dbms_xa.xa_rdonly (tightly coupled branches are combined -- "read only" optimization), the last one returns dbms_xa.xa_ok and this is when you should call xa_commit.
    Now my next problem is that DBMS_XA doesn't work from within jobs (DBMS_JOB and DBMS_SCHEDULER), which makes it very difficult to use DBMS_XA. My purpose of using DBMS_XA is to coordinate work across multiple sessions in one transaction but if I can't easily create the multiple sessions, I'm stuck.
    When called from a job, xa_start throws:
    ORA-24789: start not allowed in recursive call
    on Oracle 11.2. In Oracle 11.1 it works, but xa_end fails with
    ORA-25352: no current transaction
    so I guess in fact the xa_start call didn't really work either, even though it returned tm_ok.
    I'm now trying to find a workaround on how to use DBMS_XA from within jobs, please comment if you have any suggestions. Or if you have any suggestions on other means of establishing the concurrent sessions (I wouldn't like to resort to external programs that need username/password to connect as password management would be a security issue).
    Thanks in advance.
    Cheers
    Finn

  • Entity beans caching non-persistent data between transactions

    Some of the properties in our entity bean implementation classes are not declared
    in our descriptor files, and therefore, are non-persistent (we are using container-managed
    persistence); I will refer to these properties as "non-persistent properties".
    In WebLogic 5.1, we've noticed that the non-persistent properties are cached in
    between transactions. For instance, I ask for a particular Person (Person(James)),
    and I set one of the non-persistent properties (Property(X)) inside Transaction(A).
    In Transaction(B) (which is exclusive of Transaction(A)), I access Property(X)
    and find that it is the same value as I had set in Transaction(A)- this gives
    the appearance that non-persistent entity properties are being cached in between
    transactions.
    The same appears to hold true in WebLogic 7 SP1, however, we must use the "Exclusive"
    concurrency-strategy to maintain this consistency.
    I am worried that this assumption we are making of non-persistent properties is
    not valid in all cases, and the documentation does not promise anything in the
    way of such an assumption. I am worried that the container could kill the Person(James)
    entity implementation instance in the pool after Transaction(A), and create a
    new Person(James) instance to serve Transaction(B)- once that happens our assumption
    fails.
    "Database" concurrency strategy seems to fail our assumption on a regular basis,
    but that makes sense, since the documentation states that the "database will maintain
    the cache", and the container seems more willing to kill instances when they are
    finished with, or create new instances for new transactions.
    So my question is this: What is exactly guaranteed by the "Exclusive" concurrency-strategy?
    Will the assumption that we've made above ever fail under this strategy?
    Thanks in advance for any help.
    Regards,
    James

    It simply means that there is only one entity bean instance per PK in the
    server, and transaction which uses it locks it exclusively.
    James DeFelice <[email protected]> wrote:
    Thank you for the suggestion. I have considered taking this path, but before I
    make a final decision, I was hoping to get a clear answer to the question that
    I stated below:
    What EXACTLY is guaranteed by the "Exclusive" concurrency-strategy? Maybe someone
    from BEA knows?
    "Cameron Purdy" <[email protected]> wrote:
    To be safe: You should clear those values before the ejb load or set
    them
    after (or both).
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "James DeFelice" <[email protected]> wrote in message
    news:[email protected]...
    Some of the properties in our entity bean implementation classes arenot
    declared
    in our descriptor files, and therefore, are non-persistent (we areusing
    container-managed
    persistence); I will refer to these properties as "non-persistentproperties".
    In WebLogic 5.1, we've noticed that the non-persistent properties arecached in
    between transactions. For instance, I ask for a particular Person(Person(James)),
    and I set one of the non-persistent properties (Property(X)) insideTransaction(A).
    In Transaction(B) (which is exclusive of Transaction(A)), I accessProperty(X)
    and find that it is the same value as I had set in Transaction(A)-this
    gives
    the appearance that non-persistent entity properties are being cachedin
    between
    transactions.
    The same appears to hold true in WebLogic 7 SP1, however, we must usethe
    "Exclusive"
    concurrency-strategy to maintain this consistency.
    I am worried that this assumption we are making of non-persistentproperties is
    not valid in all cases, and the documentation does not promise anythingin
    the
    way of such an assumption. I am worried that the container could killthe
    Person(James)
    entity implementation instance in the pool after Transaction(A), andcreate a
    new Person(James) instance to serve Transaction(B)- once that happensour
    assumption
    fails.
    "Database" concurrency strategy seems to fail our assumption on a regularbasis,
    but that makes sense, since the documentation states that the "databasewill maintain
    the cache", and the container seems more willing to kill instanceswhen
    they are
    finished with, or create new instances for new transactions.
    So my question is this: What is exactly guaranteed by the "Exclusive"concurrency-strategy?
    Will the assumption that we've made above ever fail under this strategy?
    Thanks in advance for any help.
    Regards,
    James
    Dimitri

  • Locking of Transactions for MM - FI Integration

    Every month, we do the closing of accounts. For this, we have to close all GRN related transactions, so that the accounting entries are not passed. We use trxn SM01, to lock, MIRO, MIGO, & ML81N, so that user does not book any entries for that month.
    Is there any other better way to achive this ?? if yes, can it be done by the user department , instead of coming to IT, to lock the transactions
    thanks
    amit

    Hello,
    There is fixed solution on for what you are asking.But its little bit tricky.
    If you are aware of Validation rule .you can go and customise your requirement or take ABAPERS help.
    Please use tcode GBB0 & Ob28 to create validation
    For e.g
    Prerequisite.
    If posting day is after last day of month & tcode is MIGO,MIRO,etc
    CHECK: User ids(only these user will have option to use this trx else it will give error.you can keep this access to only few like urself)
    Error: Posting not allowed in previous month.
    likewise you can custoimise your requirement.

  • How to lock a transaction code  in a report  ?

    Dear Abapers ,
         i had a requirement to lock a transaction code in my Module pool programming . the requirement goes in this way ..
    " if a  single user is editing a report then that particular report has to be accesseble to only that concerned user , it cant be accessed to any other user who gonna run the report unless the first user exits the report . <removed>.
    Thanks & Regards,
    Sravani . Y .
    Edited by: Thomas Zloch on Apr 5, 2010 8:39 PM

    Hi,
    You have to verify the processes in execution. Here an exaple code:
      DATA: BEGIN OF WP_TABL OCCURS 10.
              INCLUDE STRUCTURE WPINFO.
      DATA: END OF WP_TABL.
      " This CALL verifyes the processes in execution:
      CALL 'ThWpInfo' ID 'OPCODE' FIELD OPCODE ID 'TAB' FIELD
        WP_TABL-SYS ID 'CPU' FIELD WITH_CPU.
        " Now loop at table WP_TABL
        LOOP AT WP_TABL.
           " Inside this loop you have to check if the report field WP_TABL-WP_REPORT is been executed more than one time. The user field WP_BNAME tells you who is executing the program.
        ENDLOOP.
    I suggest you, ask for an ABAPER help with this code example.
    Hope it helps you...
    Alexis Sánchez N.
    SAP ABAP Developer Consultant
    <please no company names in the posts, folks can view your business card if interested>
    Edited by: Thomas Zloch on Apr 12, 2010 4:50 PM

  • How to Lock a Transaction for Editing AND VERY minor tab cont. help

    Just two things I need to ask about
    <b>1. How to Lock a Transaction for Editing</b>
    I am currently using the fcode ENQUEUE_E_TABLE. The function works as once the transaction in opened, another cannot access it.
    However, I have two modes in my transction (Display and Edit). <u> What I need to do is If another user has already opened the transaction, the other user can still access the transaction but cannot access the edit mode.</u>
    <b> 2. VERY minor tab cont. help </b>
    I noticed in a table control is being used in a transction you can resize a colunm. <u> How do you disable this </b>?
    and <u> how do you resize the horizontal scroll bar </u> so that you can limit scrolling upto the point where there are field columns?
    Thanks for you help ppl and take care

    Hi chad,
    This link will help u know abty different types of locks that are available:
    http://help.sap.com/saphelp_erp2005/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm
    For resizing all u can go to the table settings and u can do it.
    Hope tis helps u,
    Regards,
    Nagarajan.

  • Diff between Transaction Server Vs Application server

    Hi,
    What is the difference between Transaction Server Vs Application server..?
    Cheers,
    Raj
    Helpful answers are always rewarded

    Hope these two will help you
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4bc4e290-0201-0010-eba9-dc6a507d3220
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9318c990-0201-0010-1b8e-e3cfae0a1939
    Regards,
    PP

  • Relation between transactions and DTD's

    Hi,
    Is there any relation between transaction, transaction subtypes with DTD's.
    This is the case of 3rd party integration. I want to send an inbound message to the oracle xml gateway. This will be directly enqueued into generic queue - ECX_INQUEUE through AQ api's.
    But for exposing the DTD's and transactions, I am not able to find any relation between them ?
    Can anyone throw some light on this .....

    Same question here.....
    For the Buyer/Seller Sample in C:\orabpel\samples\tutorials\109.CorrelationSets, I found that the sample still works after I deleted the Correlation Set. So, what is the use of Correlation Set in this sample?

  • Locking of transaction code

    How can I lock any  transaction code
    Regards
    Amitava

    Hi
    Go to T.Code SMO1.
    enter the t.code that you need to lock in the below tab. and in the screen the t.code will come
    select the lock option and tick over there.
    so that t.code wil be locked . you cannot use the t.code henceforth

  • Prodn Ord print prob (order locked under transaction CO02).

    Hello,
    The requirement is when I am releasing a producton order it should get printed. Now when I release and save production order, i get a message as "This order is locked under transaction CO02".
    The release takes place (status is REL), but th print does not take place (no spool in work order case LV01). If I reprint this order, it is printed correctly.
    If I double click on the message, I do not get any information.
    In OPK8 Flow control for transaction, eveything is * and the radio button Online is selected. Does this have any relevance in this case?
    I have not seen this message before during release of production order.
    Thanks in advance fo your assistance.
    Best Regards
    Sameer

    Hi ,
    1st  please check with your basis is the printer setup correctly.
    2nd assume everything setup correctly in Basis also hardware , please check your user profile.
    3rd please check in your printer spool sp01 is there any spool.
    4th please check the configuration been setup ? default after release should print.
    T-codes associated with this are
    OID1 - Shop Papers
    OID2 - Shop Papers by Document Type
    OID3 - User-Specific Print Control
    OID4 - Activate Print Diversion
    OID5 - Print Diversion Values
    OID6 - Print Control Online/Update
    Please rewad point if useful.
    TQ

  • Relationship between TRANSACTION DOCUMENT Nu00BA and REQUEST/TASK

    Dear Gurus
    I've created  an change request - urgent correction and this assined to ID (Transaction Document Nº) = for example 8000001285.
    The next step is create the Request/Task relationship with this ID.
    I need to generate report that have relationship between Transaction Document Nº and Request/Task, but I need to know the tables that save this information.
    Could you please help me?
    LASAM

    Thanks,
    SAP is working to make the two technologies comparable, as we can see also from products like [SAP Application Interface Framework|http://help.sap.com/saphelp_aif10/helpdata/en/5a/3eacf824e74542abbd2271238dc70b/frameset.htm] so I ask to the community if somebody find how the linking between the business document and ABAP proxies is implemented
    Regards

  • Receivables: Diferrence between "transaction number" and "document number"

    Hi!
    What is the difference between "transaction number" and "document number" as shown in the transactions window?
    Where are they used?
    thanks!

    Transaction number is the Invoice number. It can be a manually entered number in case of manual invoices. Even in case of imported invoices, it can be a manually assigned number if the trx_number field is populated in the ra_interface_lines_all table. If you Invoice batch source setup indicates automatic transaction numbering, the transaction (invoice) number will be automatically generated sequentially. The starting number is mentioned in the Trx batch source.
    The document number is a number which is generated by Document sequencing. To have the document number generated, you have to do few Doc sequencing setups like setting the 'Sequencial Numbering' profile options, creating document sequences and assigning the sequence to the Categories. The trx types are created as categories.
    The Transaction number can be the same as the document number if you enable the option 'Copy Document number to Transaction number' in the Invoice batch source.
    Hope that helps.
    Thanks,
    Anil

  • Difference between transactions VK11 & VK31

    Hi Experts,
    What is difference between transactions VK11 & VK31. Both transactions are used for creating condition records?
    Why we have two methods for creating condition records?
    thanks

    VK11 is maintenance of conditions records by old method.
    VK31 is maintenance of condition records provided from SAP release 4.6A. This has a new maintenance interface.
    The new interface allows mass maintenance of conditions which is based on characteristics namely materials, customers etc. You will be able to display and maintain the material prices as well as the discounts for a customer in one work step.

  • Difference between transaction LT11 and VL06C

    Hello,
    Could you please let me know difference between transaction LT11 and VL06C ? Whether LT11 can be scheduled in background job in place of VL06C.

    Hi..
    You are absolutely correct. If u want to set up a background job for TO confirmation u can do it in t-code VL06C...
    Apart from that in LT11 you can confirm for a sinle TO only..but in VL06C you have wide options to select the confirmation TOs of deliveries based on Fwd agent..WH nos..picikn/packing staus..etc., Click on All secections(+) option in VL06C to get more selection parameters..
    Reg,
    JJ
    Edited by: Jagsap on Apr 15, 2010 12:59 PM

  • Difference between transaction currency and document currency.

    Hi All,
    Would like to know the difference between transaction currency and document currency. If we want to draw both the figures from the GL account, which table can i use?
    Thanks,
    Mercy

    Hey,
    Having transaction currency and document curreny in one document would be strange.
    Document currency is something you would see in a FI document, whereas transaction currency is part of a CO document.
    In finance documents you would talk about document currenty and local currency for instance.
    In CO documents, the currency field you can find are transaction currency, object currency en controlling area currency.
    In most cases the document currency in FI would be considered the transaction currency in CO.  The local currency in FI would be the object currency in CO.
    Hope this helps,
    Koen

Maybe you are looking for

  • Problem in tranfering simulation project to operative project-CJV4

    hi all, I am able to transfer operative project to simulation project but after making changes in the simulation project, I am not able to transfer the simulation project back to the operative project. on clicking the transfer icon ,it gives a messag

  • Plays on only 1 car speaker

    My wife's iPhone 5c only plays through the right speakers in our 2014 Toyota Prius, whether through Bluetooth or USB.  My iPhone 5c works great.  Anyone have a similar situation?

  • Choosing the paper type when Printing to Canon S9000

    How do I choose the paper-type setting from the print options menu? The Canon OS X manual speaks about a pull down menu which allows for selection of "quality and media." I am finding options for printer choice, rendering, layout, print image etc, bu

  • Possibly really stupid question.

    What I've read about backing up itunes always refers to making sure that your purchased music doesn't get lost. There's a lot of other "stuff" in there also, things that weren't purchased...my own CD's, audiobooks, videos, etc`. Here's the really dum

  • Have key code for QT Pro, but can't find QT control panel???

    I am running Windows Vista. I downloaded QT 7.6, then upgraded to QT Pro. I followed instructions, going to Control Panel, but QT Contol Panel isnt there. What do I do???