Demonstrating lost update problem

Hi
I would like to know if it's possible to demonstrate the 'lost update' problem in oracle without using simulation. If so how would I go about doing this? I assume I will need to establish multiple sessions within a single transaction in order to have independent transactions to demonstrate this properly.
Thanks.

The type of behaviour that leads to a lost update can be demonstrated with something like this.
In session 1 run a pl/sql block like:
BEGIN
   FOR r IN (SELECT * FROM t ) LOOP
      IF r.id = 5 THEN
         DBMS_OUTPUT.Put_Line ('ID is '||r.id||' and descr is '||r.descr);
         DBMS_LOCK.Sleep(30);
         UPDATE t SET descr = 'SLEEPY' WHERE id = r.id;
      END IF;
   END LOOP;
   COMMIT;
END;The Sleep simulates user thinking time, or perhaps some delay in the proce for complex calculations and lookups.
While session 1 is busy, in session 2 do
SQL2> UPDATE t SET descr = 'AWAKE' WHERE id = 5;
1 row updated.
SQL2> COMMIT;
Commit complete.
SQL2> SELECT * FROM t WHERE id = 5;
        ID DESCR
         5 AWAKEThen, when the block in session 1 is finished, you will see:
ID is 5 and descr is ALL_CATALOG
PL/SQL procedure successfully completed.
Then do
SQL1> SELECT * FROM t WHERE id = 5;
        ID DESCR
         5 SLEEPYThe update by session2 was lost.
There are two ways to handle the situation. First, define the cursor as FOR UPDATE. In this case, session 2 would receive an error. The other way, optimistic locking, is to use something like the following as an update statement in the pl/sql block:
UPDATE t SET descr = 'SLEEPY'
WHERE id = r.id and
      descr = r.descr;Then check for the success of the update.
TTFN
John

Similar Messages

  • Lost updates in cluster environment known problem?

              we are running weblogic clustered. We have an entity bean that is set to read-write
              (which means that in clustering no caching will be used as per your docs). We
              are hitting this entity bean from both servers at the same time, an update by
              one, and a read by the other. What is happening is that the update appears to
              get lost for lack of a better term. We have the update in a method that requires
              a transaction, and after this method is finished (which means the trasaction/db
              commit has completed) we have a finder method that returns the updated record.
              Then, we shut down the servers and look in the db, the row has NOT been updated.
              We found something in your docs about "lost updates". It said to set the isModified
              method in the ejb to always return true, this also did not help.
              Okay, we found issues just like this in posts to the bea newsgroups from 2000.
              We tried what was recommended by Rob Woolen, and it worked. We set the <delay-updates-until-end-of-tx>false</delay-updates-until-end-of-tx>.
              This has stopped this from happening. Any thought? Is this really a true fix?
              Thanks all...
              

              We have db-is-shaed to true.
              Also, its not that one server is overwriting what the second server does, its
              that one server is doing multiple reads as the other server doing the update.
              Then the update never gets to the db, even after the servers are both brought
              down, its still not there, even though we do a find after the update tranaction
              completes, and it returns an updated row! Ugh...
              "Cameron Purdy" <[email protected]> wrote:
              >Transactional control does not stop lost updates. If the second server
              >overwrites the cahnges made by the first, then the update will be lost.
              >
              >The question is this: What behavior do you actually want? Do you want
              >the
              >update on one server to disallow the update on the other server? If so,
              >explain your reasoning.
              >
              >What you should have is a means to ensure data integrity, which is to
              >say
              >that your transactions should not be able to complete if another
              >transactionchanges necessary data during the course of the transaction.
              >That
              >is usually accomplished by employing version or timestamp columns.
              >
              >Peace,
              >
              >--
              >Cameron Purdy
              >Tangosol Inc.
              >Tangosol Coherence: Clustered Coherent Cache for J2EE
              >Information at http://www.tangosol.com/
              >
              >
              >"ralph" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> we are running weblogic clustered. We have an entity bean that is set
              >to
              >read-write
              >> (which means that in clustering no caching will be used as per your
              >docs).
              >We
              >> are hitting this entity bean from both servers at the same time, an
              >update
              >by
              >> one, and a read by the other. What is happening is that the update
              >appears
              >to
              >> get lost for lack of a better term. We have the update in a method
              >that
              >requires
              >> a transaction, and after this method is finished (which means the
              >trasaction/db
              >> commit has completed) we have a finder method that returns the updated
              >record.
              >> Then, we shut down the servers and look in the db, the row has NOT
              >been
              >updated.
              >> We found something in your docs about "lost updates". It said to set
              >the
              >isModified
              >> method in the ejb to always return true, this also did not help.
              >>
              >> Okay, we found issues just like this in posts to the bea newsgroups
              >from
              >2000.
              >> We tried what was recommended by Rob Woolen, and it worked. We set
              >the
              ><delay-updates-until-end-of-tx>false</delay-updates-until-end-of-tx>.
              >> This has stopped this from happening. Any thought? Is this really a
              >true
              >fix?
              >>
              >> Thanks all...
              >>
              >
              >
              

  • Update problem - VBDATA table

    Dear All,
    We have update problems in our Quality systems, and also in every R/3 system that we create from a Production system copy.
    Sometime the UPD and UP2 work processes hung without apparent reason.
    In the SM50 I can see one or more of my update processes running for a lot of time (many hours) on the table VBDATA without perform any action.
    In the tcode SM12 I donu2019t see any kind of lock, and I donu2019t understand why only sometime this problem happens.
    Of course, from the SM13 I can see that during this problem the system is not able to perform any kind of update.
    As I told in the beginning of the message, I have the same problem in other two R/3 systems, both created with a system copy from the production system.
    The Production and the Developer systems seem not affected by this problem.
    Have you got any idea about the reason of the problem?
    Even if the Production systems is not directly affected, all the IT department is not able to work on the Quality system (or any other Test system), and the only workaround is to kill the UPD (or UP2) WPs affected.
    Thanks in advance,
    Federico Biavati
    My R/3 System is a 4.7 on SLES9 and Oracle 10.2.0.2

    Hello Siva,
    This is what I did:
    > Check how many entries do you have in VBDATA currently.
    More than 1.000 in every SAP systems that Iu2019m creating from Production
    > You might want to run the reorganize updates program to clear the old updates
    > that are pending/in error
    Good point!!
    After the reorganization (ST14 u2013 Reorganize update requests) the table VBDATA is empty.
    Iu2019ll check and Iu2019ll let you know if the problem is definitively solved.
    Thanks for you help,
    Federico

  • Chart x scale update problem

    LabVIEW  8.5.1
    Sweep Chart Problem
    The x scale values do not update until after the 2nd sweep.  The red line cursor gets to the end of the sweep and starts the next, but the scale numbers do not update until the next sweep starts.
    It appears to be a problem with the chart, since it happens with any vi with a sweep chart.  I've used versions 6 through 7 for years and never seen this.  I've only recently moved to a new job with a new machine and version 8.5.1., so I'm not sure what to try.
    I've included a simple example.
    Thanks much,
    JSC321
    Attachments:
    Chart Sweep Scale Update Problem.vi ‏32 KB

    You have a typical race condition!
    There is no data dependency between the property node and the while loop, so in your case the loop starts executing first and the property node starts slightly later, immediately erasing the first point. Execution order is not defined.
    All you need to do is add a data dependency, e.g. as with the error cluster in the image. This forces the property node to complete before the loop is allowed to start.
    (Execution order is enforced even if the wire value is not even used inside the loop )
    Try it!
    Message Edited by altenbach on 12-23-2008 11:08 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    HistoryRace.png ‏10 KB

  • Updating problem...I have a update that starts out going through but then does not finish just keep running

    also with the update problem it says software update and below the running bar it says connecting to the server

    Please do the following:<br><br>
    #Go to [http://www.mozilla.com/en-US/firefox/fx/?ref=logo Download Firefox 4.0.1] and download a fresh installation file to the desktop.<br><br>
    #Then go to Add/Remove Programs, scroll down to "Mozilla Firefox" and remove it, choosing to keep your bookmarks, customizations etc., (''don't checkmark the box'').<br><br>
    #Then reboot and delete the folder called "Mozilla Firefox" at this location: C:\Program Files\Mozilla Firefox<br><br>
    #Finally run the installation file you downloaded to the desktop earlier.<br>
    Your bookmarks, customizations etc., are maintained in a different location and will become available to you again once you complete the installation.

  • 10.5.7 update problems

    After installing the 10.5.7 update, Mail, iTunes and iPhoto will not run anymore. Anyone else having this problem?

    jjtopspin wrote:
    Before I came to these apple discussions re: update problems with 10.5.7, I tried to update this version yesterday and at the end of the download this message came up, the update "Mac OS X update" can't be saved. The digital signature for this package is incorrect. The package may have been tampered with or corrupted since being signed to Apple.
    I got the same message. The downloaded file that generated the message was only about 560 KB, indicating it was an incomplete download. I moved it to the trash & tried again. The second download attempt succeeded. I had a minor if nerve-wracking issue with the update (the blue looping screen reported in another topic in this forum) but after a forced shutdown & restart the update was completed successfully.
    I have since updated my two other Macs so all those listed in my profile are now running 10.5.7. All do so without any problems & in fact work better & more stably than ever before.
    I doubt that I'm unusual in this respect. Some users will have problems but I believe most won't, & for those that do most problems will turn out to be caused by something other than the update itself. So it has been for every previous Leopard update; I see no reason to think this one will be any different.

  • Cache update problem in Integration Directory

    Hi all,
    We have a cache update problem in our PI development server.
    If we try to edit, save and activate any of the ID objects, under Cache notifications>Central Adapter Engine> all these objects are displayed as gray items.
    We have tried:
    1. Clearing the SLD Data Cache.
    2. Did SXI_CACHE complete refresh.
    3. Did CPA cache refresh.
    4. Did a complete cache refresh of the server.
    5. Restarted the server.
    But still the problem has not bee resolved. Could you pls provide your inputs and resolution points.
    Thank you very much.
    regards,
    Jack Nuson

    HI Jack ,
    first try to manually update the cache from ID select on your cache notifiaction and click on delta cache refresh button and refresh button .IF it does not yied any result then
    Perform a full cache refresh using the URL
    http://<host>:<port>/CPACache/refresh?mode=full . If the cache refresh happens properly then your problem will get resolved other wise you have to see the cache log to view why it failed there it will show you the exact reason . You might need to restart your java server also if the problem persist .
    Regards,
    Saurabh

  • Twitter Update Problem

    Seems I have a Twitter Update problem. 1. I have no pirated software on my computer either from the App Store or anywhere else. 2. I did buy a set off templates for iWork through the App Store with my Bosses Apple ID (it's for work). Is that really the problem. That's ridiculous.  The apple ID is mine, as is much of the software, but it's a computer use for work. If this is true it makes the App Store a lot less useful.

    my apologies I was so annoyed. I didn't bother to state my issue. The issue is: Twitter is constantly asking to be updated. Even after it's updated. Even if it's deleted. I looked at the forums for a solution and found that people were having this problem who installed pirated app store apps.
    I am logged into the app store on my account. All but one of the apps on my machine that come from the app store are on my account. However there is one piece of software on my account that I purchased, by logging out and logging in with her ID, purchasing it, installing and logging out, and again logging in as myself. I don't have an issue with that app. However Twitter, which was installed under my username, constantly says it needs to be updated. Hope that makes it clearer.

  • HT4623 Update problem

    Hello
    How do i solve problem when i'am doing my update from 5.1 to 6.1.2 the massage (3194) occured. Please help me to solve this update problem.
    I'am using iphone 4

    See this support document http://support.apple.com/kb/ts4451

  • TS3694 im trying to restore my iphone and itunes doesnt allow it to restore without updating. problem is that i have the latest update on my iphone so why is it forcing me to wait for a 7hr update download when i already have the update and only need to r

    im trying to restore my iphone and itunes doesnt allow it to restore without updating. problem is that i have the latest update on my iphone so why is it forcing me to wait for a 7hr update download when i already have the update and only need to restore?

    Sadly, the iPhone 3G can not be upgraded beyond iOS 4.2.1.

  • Im trying to update, but all it does is backup my phone, My itunes is updated, BTW, I just went to Apple bar, i had previous problem with prior phone, now im having this update  problem with thyis new phone, someone HELP!!

    Im trying to update, but all it does is backup my phone, My itunes is updated, BTW, I just went to Apple bar, i had previous problem with prior phone, now im having this update  problem with thyis new phone, someone HELP!!

    Same here and this is driving me crazy. I can buy, but can't upgrade. Grrr.

  • Jelly Bean Update Problems on Xperia S Tablet

    I think we need a new topic for Jelly Bean update problems and fixes.
    Solved!
    Go to Solution.

    small fonts and icons blurry pixelated in notification or google agenda widget
    browser crashes a lot.
    Missing jelly bean home launcher
    Wifi disconnecting for no reason.
    Animations aren't smooth tough tablet is more responsive then android 4.0.3 release6b

  • Updater problem. AGAIN!

    Hi, I am officially annoyed and angry at the iPod Updater 2006-01-10! For the 7th time, my iPod won't update. This is what I have done.
    I installed the latest version of iTunes and connected my ipod. Then a notice came up saying that the software used for communicating with the iPod isn't correct. Please reinstall iTunes. I have done this over and over again and still I get the message! I need help!
    PLEASE PLEASE SOMEONE HELP ME! NO ONE HAS EVER SOLVED THIS PROBLEM FOR ME!

    Just a question but : do you really need to update your iPod ? Did it run very well with the previous version ? I don't really understand why you have your update problem due to the fact that I'm not a PC user… I hope a PC user will help you, but, many of iPod users don't update because they don't need to… They said that theirs run well with old versions, and the iPod ain't broken… I have a 1.3 version (after updating to the 1.4, then 1.4.1 and having a iPod problem… But now it solved)… and I am quite happy with…

  • Installation Problems, Permissions Problems, SW Update Problems, Solved

    I'm posting here to relate some problems I've had and how I ultimately solved them, in the hope that it might help somebody.
    The following relates to OS 10.5.4 on an imac PPC 1.8.
    It started (at least the first symptom I noticed was) with Super Duper not working to auto-clone my drive, because the first thing SD does before running a clone job is to repair permissions on the subject drive. The repair permissions task failed with "the underlying task failed" error.
    So I tried the manually repair permissions from Disk Utility and got the same "the underlying task failed" error. It's a bit alarming not to be able to repair permissions. I tried a reboot, no change. This persisted for at least a week as I didn't have time to aggressively go after it.
    Then I purchased DiskWarrior (again - owned it years ago in Sys 9 days), as in my experience that was the "if all else fails" fix for everything directory-related. I booted from another blessed drive (do people still say that anymore? lol, showing my age) and ran DW on the drive in question. Sure enough DW found and fixed about 150 problems. Great I think, reboot from the original drive, run Disk Utility, repair permissions...nope! Same error. What now? I checked the console installer log for more and all the errors looked like "failure to write" permission type errors. Grr.
    Verify Disk ran OK. I checked the SMART status and it was OK, as I was by now worrying about the physical drive.
    Then along comes the 10.5.5 incremental update in Software Update and I get the following error: "The Installer could not install some files in "/" check permissions". Doh! Same thing with the Java update. Since I can't repair permissions I'm stuck.
    So now I have only one course of action (well maybe there were others, but this is what I did) which was to do an Archive and Install. My OS X DVD is 10.5.0 so that is what I got of course when I reinstalled.
    Running Disk Utility after the A&I allowed me to repair permissions successfully. Some progress. But now I had a slew of updates to get back to the present version of everything. Most installed successfully, except the 10.5.5 combo update. For that I got "package contents could not be validated". Rats.
    So I decided (after reading here about SW update problems especially with combos) to manually download the 10.5.5 combo. For some reason running SW Update under 10.5.0 gave me download rates of 32kb/s, where I am used to 1.1MB/s. Projected download time 3 hrs....no way! So I booted back to my 10.5.4 clone and downloaded the 612MB at normal speed there. I downloaded the 10.5.1 incremental as well just in case.
    Finally I was able to run the 10.5.5 combo (manually downloaded) successfully. Check Disk Utility and repair permissions...all good. Run SW Update and get the Java update, all good.
    Deep breath. Phew.
    So there you have it. I was able to fix it all. I probably didn't need to buy DW (but it's so great I'm ok with that) as I conclude now that the A&I ultimately was the real fix. It was a very frustrating experience though, especially with SW update giving me a bad download.
    I'm hoping that this post might now show up in searches and help somebody out there.
    Cheers
    G

    WonderWoofy wrote:
    I don't think you have either of those kernels... as they don't exist.  I assume you meant that you are using 3.10.5 and supposedly have 3.10.6 installed.  You issue is a bit of a catch 22, as you are unable to mount the ESP (no vfat module matching your running kernel), yet mounting the ESP would be required in order to properly udpate.  I imagine that you actually have the correct kernel as /boot/vmlinuz-linux.  But whatever mechanism you use to copy it from that location to the ESP didn't work.
    You are going to have to boot from live media, and fix this from a chroot.  Please search around for how to do this, as this information is all over the place.
    Looks like I'm in for a treat. I chroot-ed, did a full upgrade in case there was an even newer kernel (and there was, 3.10.7). After the upgrade I copied /boot/vmlinuz-linux, /boot/initramfs-linux.img and /boot/initramfs-linux-fallback.img to /boot/efi/EFI/arch/ renaming the files vmlinuz-arch.efi, initramfs-arch.img, initramfs-arch-fallback.img respectively. I unmounted everything and rebooted. Now reFINd freezes as soon as it tries to boot Arch.

  • Firmware update problem solved after Win XP SP3 -upd

    I'm one of the numerous victims of ZEN firmware updating problem. At the start I had Win XP SP2 and WMP. My player is ZEN Micro 5gb and after trying to update firmware it had firmware problem and stayed in the recovery mode. Firmware updater and ZEN Media Explorer couldn't recognize the player. So that's how I got it work again:
    1. Rolled back WMP to WMP9, updated it to WMP0.
    2. Removed ZEN Media Explorer and Jukebox driver (all Creative stuff) from Add/Remove programs in Control Panel.
    It didn't solve the problem. I also tried my player with couple of other computers, but it didn't help either.
    3. Installed Win XP SP3 -update.
    4. Reinstalled driver for ZEN Micro in Control Panel.
    5. Ran the firmware updater and this time it did recognize the player.
    (6. Updated WMP back to version and the player's still working.)
    Hope this will help you too.

    I can start the upgrading process, but at around 95% it stops, and says "firmware upgrade failed." I didn't uninstall WMP though, because I have Vista, and I hae no idea how to do it. I can only get my computer to recognize my 6G Zen when I go into recovery mode and choose 'reload firmware' then I connect it to the computer and I can start trying to upgrade it. If I dont go into recovery mode, its just a blank screen, the computer doesnt recognize it, and I can't even turn it off without reseting.
    ?I've tried so much, now when I try to upgrade, it loads a little bit and jumos to the end quckly and says "firmware upgrade fails" and nothing works. Do I have to try to do all the things you listed to fix this?

Maybe you are looking for

  • My 1st generation iPod isn't recognized by Windos or iTunes,

    When I plug my shuffle into the USB port, it is not detected by iTunes or Windows. It still gets charged but I cannot access it to change the playlist. I have songs in the library, but the 'sources' thing never comes up. My friend's works just fine--

  • Strange behavior from a PB G4 (Part 2)

    On to my next issue. Often when I'm typing the insertion point will jump to someplace other than where it should be or just disappear all together. I'm not doing anything to cause it to do this. I've been being really carefull to not to do anything w

  • How to listen to iMic in realtime?

    I have my Digital Cable box hooked up to my Dell 2005FPW and use in PiP. I just purchased the iMic from Griffin to allow me to feed the audio through my computer and out through my computer speakers. The audio however dosent seem to play unless the F

  • Problem since upgrade to 9.4.1

    Since the last upgrade, I cannot open a pdf file from the web. I get the error message 'Cannot find Acrobat External Window Handler'. I can still download the file. Anyone got any ideas? David

  • MacBook Pro Mountian Lion, security update, process bar opens but does not download, how to fix?

    Firefox says there is an important security update and when I click the update the blue bar appears and just spins and never moves. I let the laptop sit for a whole day and still nothing. I have to close the update box. I updates to mountain lion abo