Question about locking order during merge statement

Dear all.
I have a merge query with a decedent hint to prevent deadlock with another queries.
Another queries use select ~for update with same hint.
My question is that the locking order will follow the hint in this query?
Or I might use the select ~ for update before this merege.
Please give any advice about select ~for update and locking order in the query.
Thanks.
MERGE INTO  A
USING
     (SELECT /*+ index_desc(C index_key) */ *
     FROM
         C
      WHERE key > :start and key < :end
    ) B
     ON  ( A.KEY = B.KEY )
WHEN MATCHED THEN
     UPDATE
     SET A.v1 = B.v1

What you are doing is not going to prevent a deadlock in your, as yet, unknown version of Oracle. Reading an index does not cause deadlocks. Trying to alter an uncommitted row does.
I would suggest you code this correctly by doing a SELECT FOR UPDATE WAIT <seconds> in all transactions.
http://www.morganslibrary.org/reference/deadlocks.html#dlfu

Similar Messages

  • I have question about dml mechanism. particularly delete statement

    HI,
    I have question about dml mechanism. particularly delete statement
    I learned that SQL statements deal with each row. For example, SELECT statement insert each record(1 row) which matched with term of WHERE into record pool.
    Also I find that UPDATE, INSERT statement insert each record into memory and if that is commited, I/O is generated with disk.
    if so, Do DELETE statements deal with each row which is matched with terms WHERE statements? ortherwise with rownum?
    I hope that I know the mechanism of DELETE statement?
    If the content above which I mentioned is fault, plz point out.
    Thank you for reading this contents.

    Hi,
    leave_for wrote:
    HI,
    I have question about dml mechanism. particularly delete statement
    I learned that SQL statements deal with each row. I'm not sure what you mean.
    SQL statements deal with sets of rows ; there may be 0, 1, 2, 3 or more rows in the set.
    For example, SELECT statement insert each record(1 row) which matched with term of WHERE into record pool.You must mean an INSERT or MERGE statement that includes a query. A plain old SELECT statement doesn't insert anything, or change any table in any way.
    Also I find that UPDATE, INSERT statement insert each record into memory and if that is commited, I/O is generated with disk.That's right. All DML involves some I/O. The I/O may be buffered, so that the DML statement might finish before any disk I/O is actually performed.
    if so, Do DELETE statements deal with each row which is matched with terms WHERE statements? ortherwise with rownum?
    I hope that I know the mechanism of DELETE statement?Sorry; the last couple of lines you wrote are especially confusing.
    When you have a DELETE statement that includes a WHERE clause, such as
    DELETE  emp
    WHERE   deptno = 20;then the set of rows that will be deleted is the same set of rows for which the condition "deptno = 20" is TRUE. Again, that may be 1 row, but if it is, that's mere coincidence. The number of rows in the set may be 0, or it may be 2 or more.
    If ROWNUM is part of the WHERE clause, then ROWNUM will be considered when Oracle decides which rows to delete; if ROWNUM is not part of the WHERE clause, then ROWNUM will play no part in determining which rows are deleted. Remember, as Damorgan mentioned above, ROWNUM is an arbitrary number. There is no built-in order to the rows in any table.

  • Question about the order to creating Account, Contact, Contact Role

    Hi, my friends,
    I have some questions about the order of creating Account, Contact, Contact Role, etc in Web Service 1.0. I could create them in the following case:
    1. Insert Contact object and get contactId (now new contact exists in CRMOD)
    2. Insert Account object with Contact Role child associated with contactId
    My questions are:
    1. Do we have the following order? Insert new Account with new Contact child and Contact Role child (Contact is new and does not exist in CRMOD).
    2. Looks like system need accountId, contactId, etc to make the objects relationship. Is there other field having the same function?
    Thanks
    Ray

    Hi Ray,
    In response to your questions:
    1. Do we have the following order? Insert new Account with new Contact child and Contact Role child (Contact is new and does not exist in CRMOD).No. Both the Account and Contact must already exist. The Role value is an attribute on the Account Contact relationship, this relationship must exist in order to assign a role value to it. This is consistent with the behaviour of the UI, when you press the New button on the Contact child applet, you are taken to the Contact New page where you can create a Contact record. Once you save, the relationship is created but you cannot assign a role value unless you click the Edit Roles link next to the new Contact.
    2. Looks like system need accountId, contactId, etc to make the objects relationship. Is there other field having the same function?Correct, the system needs to know which Account/Contact pair is being assigned a role value. To do this the Account and Contact values must be uniquely identified using the Id values for each.
    I hope this helps.
    Thanks,
    Sean
    Edited by: Sean Duffy on Jan 25, 2010 10:11 AM

  • Question about Workstation Performance during Scanning

    I am looking for information about workstation performace during
    scanning
    for inventory. My management wants information on impact before I can
    implement the service in our environment. We do have a very wide
    array of
    computers. Anything from Win95 P200 to Win2k/XP P4 3Ghz. Can anyone
    point me
    in the right direction?

    Inventory is minimal.
    The first scan takes the most performance. On a p200 we are talking
    about 5 minutes with little or no performance hit.
    After that, only changes are sent to the server.
    I wasn't able to find any doc that talked about performance, but you
    can read about inventory in the ZFD documentation.
    Hope that helps.
    Jared L Jennings, CNE
    Novell Support Forums SysOp

  • A string of question about Locking & Isolation Level

    Hi All
    It is highly appreciated if someone give offer answers to my below questions
    1) There are two ways of locking mechanism: Pessimistic & Optimistic. In general, do all J2EE app server support all these two ways of locking ?
    2) It seems to me that setting the isolation level to "serialization" should result in using pessmistic locking. If no so, please point out my misconcept and explain to me.
    3) Are there any differences in the way of entity bean programming as different locking mechansim is adopted ?
    4) With regard to optimistic locking, will the app server throw out exception as data contention is detected ? Is the way of handling dependent on app server? Or It is transparent to the developer of entity bean. Please give me an e.g of j2ee app server product how to handle this scenario.
    5) To adopt the approach of "optimistic" locking, do l have to implement it on my own using bean managed entity bean.
    6) It seems to me that optimistic locking can achieve better concurrency. If it is inherently supported by app server for its container managed entity bean (=> totally transparent to the developer of entity bean). Is it always the rule of thumb to config the server to use "optimistic" locking instead of "pessimistic" ?
    Sorry for bombarding you guys with such long list of questions. l would be very thankful if someone can help me consolidate my concept on these topics.
    Also, please send your reply to [email protected] as well
    thanks & regards
    Danny

    Hi Danny,
    I became interested about the optimistic locking recently. If the topic is not long forgotten then this may make some difference!
    We have attacked the optimistic locking issue by introducing audit fields (MODIFY_BY_USER, MODIFY_DATE) in tables where concurrency needs to be implemented.
    We are retrieving rows from the table (for display or update) through Stateless Session Bean using simple SQL SELECT. The audit fields are fetched along with the business data and are kept at the client. While any of the concurrent users tries to update the row the audit fields are sent to the application server along with the modified business data. The relevant Entity Bean checks for any difference in the timestamp of the audit field (MODIFY_DATE) value with the value in the database. If a mismatch is found it reports a business exception to the user. Otherwise, the row is updated with the lastest timestamp value in the audit field MODIFY_DATE.
    This works fine when two update operations are not concurrent, i.e., two users submit their update requests in a time lag greater than the time taken by the transaction to complete. This alone could not prevent the dirty update on the database.
    Hence, to prevent any concurrent update contending for the same row you need to set the following ejbgen tag in the Entity Bean:
    concurrency-strategy = Exclusive<<<<<Note: We are using Weblogic 6.1 with SP4 and CMP (no BMP).
    Please let me know if you have got a better solution to tackle this issue.
    Chandra.

  • Question about Lock Duration

    Hi,
    I found a description at this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm
    'At the end of an SAP LUW, you should release all locks. This either happens automatically during the database update, or explicitly, when you call the corresponding dequeue function module. Locks that are not linked to a database update are released at the end of the SAP transaction'
    I don't understand this, because I tested using commit work and wait. The lock entry still there after the statement 'commit' executed. the lock entry disappeared when the whole task completed.
    don't know what does happens automatically during the database update. Isn't the 'commit' the case they mentioned?

    So does that means even I using a SYNCHRONIZE commit. There still not a database update happen?
    From help.sap.com:
    For 'commit work' "It triggers a database commit that also terminates the current database LUW and closes all database cursors. "
    Database commit <> database update ?

  • Two basic questions about locks in Oracle.

    Hello,
    This is about 9i and onwards.
    I need to develop a comprehensive analysis of locks and waits and while doing so, following questions popped up.
    1) What is the difference between locks and waits?
    2) There is a DBA view called DBA_BLOCKERS. The standard Oracle documentation has only one line comment about this view i.e. "DBA_BLOCKER – Shows non-waiting sessions holding locks being waited-on by other sessions.
    My question is : Why would a non waiting session hold locks after all? I guess that automatically repeats the question #1 from above, What is the difference between "being waited on" v/s "holding locks with wait" and "holding locks without waits"?
    Thanks,
    R

    1) What is the difference between locks and waits? Lock - something you queue up to get and simply wait until it is available
    Waits - Waiting for a Specific event to happen before it can proceed.
    Re: Difference between a latch and a lock
    2) There is a DBA view called DBA_BLOCKERS. The standard Oracle documentation has only one line comment about this view i.e. "DBA_BLOCKER – Shows non->waiting sessions holding locks being waited-on by other sessions.DBA_BLOCKERS displays a session if it is not waiting for a locked object but is holding a lock on an object for which another session is waiting.
    HTH
    -Anantha

  • Questions About Pre-Ordering/Reserving the iPhone 4?

    I know on June 15th you can pre-order/reserving an iPhone 4. I am a bit unfamiliar with the pre-ordering process.
    If you can pre-order and pick it up in the stores, does that only mean it guarantees you one on launch day? Also on launch date will there be a separate lines for pre-orders and non-preorders? (So pre-orders go in the store first?)
    And if you reserve the iPhone 4 in store pick-up, do you have to pay the whole thing, or just put a certain amount down?
    I doubt if anyone knows this question.
    What time do Apple Stores open when the new iPhone 4 comes out? I bought my iPhone 3GS last year at launch at AT&T and they opened at around 7 I think, which I read is the same this year.
    I'd rather deal with Apple. Do they open around 7 A.M to too?

    rather not deal with the crazies and people, id order online and get it shipped to my front door. check with your local Apple store for business hours. i remember att opening a little earlier on launch day for the 3GS, idk about Apple though? id asume both will run it alot smoother for everyone.

  • I have a question about my order status, help?

    I ordered my iPhone 6 Plus on Friday and in my orders it says that I don't have any orders, but where it says upgrade my device, it says I have one waiting to be activated. I just need to make sure I actually got the phone.

        Ordering a new phone is certainly exciting and we can understand wanting to make sure everything is processing smoothly zthester44. What we can do is have you check here http://vz.to/1qVglop to see if it shows anything is being processed for you. You can also reach out to the internet orders team at 866-338-7390 to check the status as well. Please keep us posted if you have any other questions.
    CandiceH_VZW
    Follow us on Twitter at @VZWSupport

  • Question about locking certain folders w/diff.accounts?

    I'm about to let my girlfriend use my Mac, so I made a seperate account for her. I just don't want her going through all of my files and " stuff ". Is there anyway to lock certain folders in my account? I tried using parental controls but didn't find the file I wanted to Lock in the options.

    Hi Aaron
    When your girlfriend is logged in on her account your folders are locked to her. Your Home folders are only accessible from your account.
    Matthew Whiting

  • HELP! Question about "Locking" ipod

    I am an elementary teacher that is trying to get ipods integrated into the school curriculum, school administrators have expressed concerns about students putting inappropriate content onto the ipods, is it possible to "lock" unauthorized editing on an ipod, possibly password protection, or only allowing it to be updated on one cpu?

    No, it's not possible to do what you want.
    There is a screen lock that locks the iPod so another user can't use it without a code being entered, but this would lock the whole iPod.
    There's no way to selectively lock specific content, either adding it or viewing it.

  • Question about the E 15 solid state drive

    I just got this laptop during Amazon's Prime Day, and so far I love it. However, it supposedly has an 8GB SSD in addition to the 1TB HDD, but I can't find any evidence of its existence. No other drive shows up anywhere that I can see, including in Disk Management. My exact model is an Aspire E5-573G-59C3.

    1 TB / 500 GB 2.5-inch 5400 RPM self-pinning solid state hybrid hard drive with 8 GB Flash memory the 8GB SSD is part of the 1TB HDD managed as cache, so you can't access, even on Disk manager.

  • Question about lock

    Hi all,
    I would like to know what table/object is locked during a goods movement?
    And also, can I lock a batch? If yes, what FM can I used to check whether a batch is being locked or not?
    Thanks in advance.

    Hi,
    If you want to check lock entries for the table, just go to tcode SM12, it will show user level.
    Regards,
    CS

  • Question about lock switch for smart phones

    i would like to ask about the lock switch for smart phones like Nokia 5800 Xpressmusic or Nokia 5230.
    Will the lock switch loosen if we always slide to unlock it?

    i used my 5800 for 11 months and it didn't happen at all
    -you can show appreciation to my posts if it helped or useful by pressing the green Kudo star beside my post that hepled
    -if my answer was the solution , so click accept as solution button
    Started From Nokia 3310 , Now with Nokia N97 v.22.0.110 + N900 PR1.2

  • Question about locking down IIS on an SCCM 2012 distribution point on a Windows Server 2003

    Hello. My environment is SCCM 2012 SP1. I will be setting up several distribution points on Windows Server 2003 machines. This summer I have a project to configure SCCM to use our PKI infrastructure. Unfortunately, this will not be in place before I need
    to set the Windows Server 2003 machines up as distribution points. I am not an IIS expert. When I set the DPs up, I am only 1)Installing IIS, 2)Enabling BITS extensions, and 3)Enabling WebDav. Is there anything I should do to ensure they are as secured as
    possible?

    I would say that installing Windows Server 2003 is not "as secure as possible" due to it's end of support coming soon.
    http://support.microsoft.com/lifecycle/default.aspx?LN=en-us&p1=3198&x=10&y=12
    And I would say that we need more information about your scenario to tell you how it is as secure "as possible". Since that would be shutoff at the bottom of the ocean. But that wouldn't be that useful server.
    Im guessing that you will run these servers for internal
    clients ONLY. And that you have a decent edge protection as well as physical protection. Then I would start by having the lastest secrutiy patches, running antivirus software and having the firewall turned ON. I would make sure that
    only necessary logons would be possible and that the servers wouldn't cache any credentials. Typically a DP NEVER holds sensitive data so no real need to secure them more than that in a normal scenario if you ask me.
    A final notice, this is a baseline
    for a common scenario. You would need to scale and change that
    in order to apply for your scenario.
    Tim Nilimaa | Blog: http://infoworks.tv | Twitter: @timnilimaa

Maybe you are looking for

  • System Image Utility - universal_boot option only on Intel machines

    I'm using System Image Utility on 1.8 GHz PowerPC G5 running Mac OS X Server version 10.5.2. When I try to create a NetBoot image with the standard settings (no customization) and a Mac OS X 10.5 Install DVD, I get the following message: updatedyld_s

  • Macbookpro wouldn't reboot or shut down properly

    I have just had my macbook pro for about three weeks. It never had any problems three days ago, however, now, when i try to restart or reboot, it would either get stuck on the desktop screen, or a little dark screen would come up and say that my comp

  • Lost all contact after sync contacts.!!

    guys, Help!! i lost my contact after sync my contact. Do not know where my contact goes and do not know how to put it back my contact from my itunes. iphone 3GS 10.6+ itunes no using iclouds

  • Creating Website Flash in Premiere

    First, I have to admit I hate working in flash CS5 I have to create flash slide shows that change very frequently for our web site.  I have created various 648 x 280 images in PS and then use premier to create a video and export it to FLV4.  What I c

  • Read the computer IP address from Forms

    Is there a way to read from somewhere the IP address of working computer, in a form? I mean something like win_api, build-in package or anything else?