Oracle deadlock graphWhat is a deadlock?Get list of all tables in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Oracle Deadlock when Hibernate application loading data for readonly useDifference between a user and a schema in Oracle?Oracle: If Table ExistsOptimistic locking on writes in OracleHow to create id with AUTO_INCREMENT on Oracle?SQL 2016 Standard SP1 - DEADLOCK on same SPID (Exchange Event)Unable to replicate java.sql.SQLException: ORA-00060: deadlock detected while waiting for resource

Would "lab meat" be able to feed a much larger global population

What happens if I start too many background jobs?

How can I get a job without pushing my family's income into a higher tax bracket?

Point of the the Dothraki's attack in GoT S8E3?

Catholic vs Protestant Support for Nazism in Germany

What happens to the Time Stone

Returning the outputs of a nested structure

Do I have to make someone coauthor if he/she solves a problem in StackExchange, asked by myself, which is later used in my paper?

Are we obligated to aspire to be Talmidei Chachamim?

Identifying a transmission to myself

Upside-Down Pyramid Addition...REVERSED!

What does this colon mean? It is not labeling, it is not ternary operator

Selecting a secure PIN for building access

In Endgame, why were these characters still around?

How do I tell my manager that his code review comment is wrong?

Can fracking help reduce CO2?

Unknowingly ran an infinite loop in terminal

Enumerate Derangements

How would adding a darkvision racial trait to Dragonborn affect balance?

What actually is the vector of angular momentum?

Is one octave above tonic also considered as tonic?

My ID is expired, can I fly to the Bahamas with my passport?

How can I support myself financially as a 17 year old with a loan?

Identifying my late father's D&D stuff found in the attic



Oracle deadlock graph


What is a deadlock?Get list of all tables in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Oracle Deadlock when Hibernate application loading data for readonly useDifference between a user and a schema in Oracle?Oracle: If Table ExistsOptimistic locking on writes in OracleHow to create id with AUTO_INCREMENT on Oracle?SQL 2016 Standard SP1 - DEADLOCK on same SPID (Exchange Event)Unable to replicate java.sql.SQLException: ORA-00060: deadlock detected while waiting for resource






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















We get a deadlock in one of our merge statement



merge into target tt using
(select * from global_tmp_tb) hh
on( hh.pk=tt.pk)
when matched then
update
when not matched then
insert


---------Blocker(s)-------- ---------Waiter(s)---------
process session holds waits process session holds waits
2404 6309 X 2407 6502 S
2407 6502 X 2405 6372 S
2405 6372 X 1409 4103 S
1409 4103 X 2404 6309 S

Rows waited on:
Session 6309: obj - rowid = 0033DA34 - AAM9o0ACfAAOH6cAAA
(dictionary objn - 3398196, file - 159, block - 3702428, slot - 0)
Session 6502: obj - rowid = 0033D9B0 - AAM9mwACfAAOJaXAAA
(dictionary objn - 3398064, file - 159, block - 3708567, slot - 0)
Session 6372: obj - rowid = 0033D9B0 - AAM9mwACfAAOJhzAAA
(dictionary objn - 3398064, file - 159, block - 3709043, slot - 0)
Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA
(dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


It is likely that the merge insert will cause the deadlock, so let say its update



In particular, it is waiting a S lock which is a shared lock.
But if its deadlocking on update then why it is not exclusive lock ?



Also what is all these mean



 Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA 
(dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


What data dictionary object I need to query










share|improve this question




























    2















    We get a deadlock in one of our merge statement



    merge into target tt using
    (select * from global_tmp_tb) hh
    on( hh.pk=tt.pk)
    when matched then
    update
    when not matched then
    insert


    ---------Blocker(s)-------- ---------Waiter(s)---------
    process session holds waits process session holds waits
    2404 6309 X 2407 6502 S
    2407 6502 X 2405 6372 S
    2405 6372 X 1409 4103 S
    1409 4103 X 2404 6309 S

    Rows waited on:
    Session 6309: obj - rowid = 0033DA34 - AAM9o0ACfAAOH6cAAA
    (dictionary objn - 3398196, file - 159, block - 3702428, slot - 0)
    Session 6502: obj - rowid = 0033D9B0 - AAM9mwACfAAOJaXAAA
    (dictionary objn - 3398064, file - 159, block - 3708567, slot - 0)
    Session 6372: obj - rowid = 0033D9B0 - AAM9mwACfAAOJhzAAA
    (dictionary objn - 3398064, file - 159, block - 3709043, slot - 0)
    Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA
    (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


    It is likely that the merge insert will cause the deadlock, so let say its update



    In particular, it is waiting a S lock which is a shared lock.
    But if its deadlocking on update then why it is not exclusive lock ?



    Also what is all these mean



     Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA 
    (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


    What data dictionary object I need to query










    share|improve this question
























      2












      2








      2








      We get a deadlock in one of our merge statement



      merge into target tt using
      (select * from global_tmp_tb) hh
      on( hh.pk=tt.pk)
      when matched then
      update
      when not matched then
      insert


      ---------Blocker(s)-------- ---------Waiter(s)---------
      process session holds waits process session holds waits
      2404 6309 X 2407 6502 S
      2407 6502 X 2405 6372 S
      2405 6372 X 1409 4103 S
      1409 4103 X 2404 6309 S

      Rows waited on:
      Session 6309: obj - rowid = 0033DA34 - AAM9o0ACfAAOH6cAAA
      (dictionary objn - 3398196, file - 159, block - 3702428, slot - 0)
      Session 6502: obj - rowid = 0033D9B0 - AAM9mwACfAAOJaXAAA
      (dictionary objn - 3398064, file - 159, block - 3708567, slot - 0)
      Session 6372: obj - rowid = 0033D9B0 - AAM9mwACfAAOJhzAAA
      (dictionary objn - 3398064, file - 159, block - 3709043, slot - 0)
      Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA
      (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


      It is likely that the merge insert will cause the deadlock, so let say its update



      In particular, it is waiting a S lock which is a shared lock.
      But if its deadlocking on update then why it is not exclusive lock ?



      Also what is all these mean



       Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA 
      (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


      What data dictionary object I need to query










      share|improve this question














      We get a deadlock in one of our merge statement



      merge into target tt using
      (select * from global_tmp_tb) hh
      on( hh.pk=tt.pk)
      when matched then
      update
      when not matched then
      insert


      ---------Blocker(s)-------- ---------Waiter(s)---------
      process session holds waits process session holds waits
      2404 6309 X 2407 6502 S
      2407 6502 X 2405 6372 S
      2405 6372 X 1409 4103 S
      1409 4103 X 2404 6309 S

      Rows waited on:
      Session 6309: obj - rowid = 0033DA34 - AAM9o0ACfAAOH6cAAA
      (dictionary objn - 3398196, file - 159, block - 3702428, slot - 0)
      Session 6502: obj - rowid = 0033D9B0 - AAM9mwACfAAOJaXAAA
      (dictionary objn - 3398064, file - 159, block - 3708567, slot - 0)
      Session 6372: obj - rowid = 0033D9B0 - AAM9mwACfAAOJhzAAA
      (dictionary objn - 3398064, file - 159, block - 3709043, slot - 0)
      Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA
      (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


      It is likely that the merge insert will cause the deadlock, so let say its update



      In particular, it is waiting a S lock which is a shared lock.
      But if its deadlocking on update then why it is not exclusive lock ?



      Also what is all these mean



       Session 4103: obj - rowid = 0033DDD0 - AAM93QACfAAOLC5AAA 
      (dictionary objn - 3399120, file - 159, block - 3715257, slot - 0)


      What data dictionary object I need to query







      oracle concurrency parallel-processing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 21:00









      MookayamaMookayama

      4682522




      4682522






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Locking is very complicated and I admit there's lots about it I don't understand. A MERGE is a combination of a SELECT statement (the USING clause) and an INSERT and/or an UPDATE statement. My guess is:



          1. The share (S) locks are those sessions locking the rows in a non-exclusive mode because they've checked the table for the source data of the MERGE in the USING clause of the statement.

          2. The exclusive (X) locks are for an update that's been made on the table.

          So I think basically what's happening is:



          1. Session A gets the source data in global_tmp_tb and locks the rows in share mode.

          2. Session B gets the source data in global_tmp_tb and locks the rows in share mode. Since share mode is not exclusive, two sessions can both have a share row lock with no problem.

          3. Session A updates row 1 based on the ON clause. This gets an exclusive lock on the row.

          4. Session B updates row 2 based on the ON clause. This gets an exclusive lock on the row.

          5. Session A tries to update row 2. It can't because session B has it locked in row-exclusive mode.

          6. Session B tries to update row 1. It can't because session A has it locked in row-exclusive mode.

          7. Boom, deadlock.

          Do you really need to get every table in global_tmp_tb for all these sessions? Can you narrow down the source data for each session with a WHERE clause?



          Could you do select * from global_tmp_tb for update prior to your MERGE to get around this? This would mean that access to the merge is serialized and each session has to go in order, which may be bad.






          share|improve this answer























          • The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

            – Mookayama
            Mar 23 at 3:12











          • community.oracle.com/thread/4208618

            – Mookayama
            Mar 23 at 3:13











          • actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

            – Mookayama
            Mar 23 at 3:13












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307708%2foracle-deadlock-graph%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Locking is very complicated and I admit there's lots about it I don't understand. A MERGE is a combination of a SELECT statement (the USING clause) and an INSERT and/or an UPDATE statement. My guess is:



          1. The share (S) locks are those sessions locking the rows in a non-exclusive mode because they've checked the table for the source data of the MERGE in the USING clause of the statement.

          2. The exclusive (X) locks are for an update that's been made on the table.

          So I think basically what's happening is:



          1. Session A gets the source data in global_tmp_tb and locks the rows in share mode.

          2. Session B gets the source data in global_tmp_tb and locks the rows in share mode. Since share mode is not exclusive, two sessions can both have a share row lock with no problem.

          3. Session A updates row 1 based on the ON clause. This gets an exclusive lock on the row.

          4. Session B updates row 2 based on the ON clause. This gets an exclusive lock on the row.

          5. Session A tries to update row 2. It can't because session B has it locked in row-exclusive mode.

          6. Session B tries to update row 1. It can't because session A has it locked in row-exclusive mode.

          7. Boom, deadlock.

          Do you really need to get every table in global_tmp_tb for all these sessions? Can you narrow down the source data for each session with a WHERE clause?



          Could you do select * from global_tmp_tb for update prior to your MERGE to get around this? This would mean that access to the merge is serialized and each session has to go in order, which may be bad.






          share|improve this answer























          • The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

            – Mookayama
            Mar 23 at 3:12











          • community.oracle.com/thread/4208618

            – Mookayama
            Mar 23 at 3:13











          • actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

            – Mookayama
            Mar 23 at 3:13
















          1














          Locking is very complicated and I admit there's lots about it I don't understand. A MERGE is a combination of a SELECT statement (the USING clause) and an INSERT and/or an UPDATE statement. My guess is:



          1. The share (S) locks are those sessions locking the rows in a non-exclusive mode because they've checked the table for the source data of the MERGE in the USING clause of the statement.

          2. The exclusive (X) locks are for an update that's been made on the table.

          So I think basically what's happening is:



          1. Session A gets the source data in global_tmp_tb and locks the rows in share mode.

          2. Session B gets the source data in global_tmp_tb and locks the rows in share mode. Since share mode is not exclusive, two sessions can both have a share row lock with no problem.

          3. Session A updates row 1 based on the ON clause. This gets an exclusive lock on the row.

          4. Session B updates row 2 based on the ON clause. This gets an exclusive lock on the row.

          5. Session A tries to update row 2. It can't because session B has it locked in row-exclusive mode.

          6. Session B tries to update row 1. It can't because session A has it locked in row-exclusive mode.

          7. Boom, deadlock.

          Do you really need to get every table in global_tmp_tb for all these sessions? Can you narrow down the source data for each session with a WHERE clause?



          Could you do select * from global_tmp_tb for update prior to your MERGE to get around this? This would mean that access to the merge is serialized and each session has to go in order, which may be bad.






          share|improve this answer























          • The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

            – Mookayama
            Mar 23 at 3:12











          • community.oracle.com/thread/4208618

            – Mookayama
            Mar 23 at 3:13











          • actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

            – Mookayama
            Mar 23 at 3:13














          1












          1








          1







          Locking is very complicated and I admit there's lots about it I don't understand. A MERGE is a combination of a SELECT statement (the USING clause) and an INSERT and/or an UPDATE statement. My guess is:



          1. The share (S) locks are those sessions locking the rows in a non-exclusive mode because they've checked the table for the source data of the MERGE in the USING clause of the statement.

          2. The exclusive (X) locks are for an update that's been made on the table.

          So I think basically what's happening is:



          1. Session A gets the source data in global_tmp_tb and locks the rows in share mode.

          2. Session B gets the source data in global_tmp_tb and locks the rows in share mode. Since share mode is not exclusive, two sessions can both have a share row lock with no problem.

          3. Session A updates row 1 based on the ON clause. This gets an exclusive lock on the row.

          4. Session B updates row 2 based on the ON clause. This gets an exclusive lock on the row.

          5. Session A tries to update row 2. It can't because session B has it locked in row-exclusive mode.

          6. Session B tries to update row 1. It can't because session A has it locked in row-exclusive mode.

          7. Boom, deadlock.

          Do you really need to get every table in global_tmp_tb for all these sessions? Can you narrow down the source data for each session with a WHERE clause?



          Could you do select * from global_tmp_tb for update prior to your MERGE to get around this? This would mean that access to the merge is serialized and each session has to go in order, which may be bad.






          share|improve this answer













          Locking is very complicated and I admit there's lots about it I don't understand. A MERGE is a combination of a SELECT statement (the USING clause) and an INSERT and/or an UPDATE statement. My guess is:



          1. The share (S) locks are those sessions locking the rows in a non-exclusive mode because they've checked the table for the source data of the MERGE in the USING clause of the statement.

          2. The exclusive (X) locks are for an update that's been made on the table.

          So I think basically what's happening is:



          1. Session A gets the source data in global_tmp_tb and locks the rows in share mode.

          2. Session B gets the source data in global_tmp_tb and locks the rows in share mode. Since share mode is not exclusive, two sessions can both have a share row lock with no problem.

          3. Session A updates row 1 based on the ON clause. This gets an exclusive lock on the row.

          4. Session B updates row 2 based on the ON clause. This gets an exclusive lock on the row.

          5. Session A tries to update row 2. It can't because session B has it locked in row-exclusive mode.

          6. Session B tries to update row 1. It can't because session A has it locked in row-exclusive mode.

          7. Boom, deadlock.

          Do you really need to get every table in global_tmp_tb for all these sessions? Can you narrow down the source data for each session with a WHERE clause?



          Could you do select * from global_tmp_tb for update prior to your MERGE to get around this? This would mean that access to the merge is serialized and each session has to go in order, which may be bad.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 23 at 0:22









          eaolsoneaolson

          8,91563247




          8,91563247












          • The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

            – Mookayama
            Mar 23 at 3:12











          • community.oracle.com/thread/4208618

            – Mookayama
            Mar 23 at 3:13











          • actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

            – Mookayama
            Mar 23 at 3:13


















          • The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

            – Mookayama
            Mar 23 at 3:12











          • community.oracle.com/thread/4208618

            – Mookayama
            Mar 23 at 3:13











          • actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

            – Mookayama
            Mar 23 at 3:13

















          The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

          – Mookayama
          Mar 23 at 3:12





          The issue is we are 99% sure the data is partitioned correctly which mean session-1 will only update row-1 and session-2 only update row-2

          – Mookayama
          Mar 23 at 3:12













          community.oracle.com/thread/4208618

          – Mookayama
          Mar 23 at 3:13





          community.oracle.com/thread/4208618

          – Mookayama
          Mar 23 at 3:13













          actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

          – Mookayama
          Mar 23 at 3:13






          actually, when i read the graph more carefully, it seems the session is waiting on a shared lock not exclusive lock which mean its not an update/update contention. according to the above comment from the OTN forum

          – Mookayama
          Mar 23 at 3:13




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307708%2foracle-deadlock-graph%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript