Please Help resolve the issue

Hello everybody
I have a very serious issue on our production system.I have a script that has been running for more than 72 hours and i really need your help in optimizing the script.
DB server : Oracle 10g release 10.2.0.3
CREATE TABLE TBL_MENU_LEAF_NODES
AS
select distinct root_data_col_id, lft, rgt, old_collection_id
from tbl_object_data t1, tbl_keys t2, tbl_data_collections t3
where t1.data_id = t2.data_id
and t1.data_collection_id = t3.data_collection_id
and not exists ( select 1 from tbl_keys x1
where x1.collection_key_id = t3.old_collection_id);
-- This select qry returns about 1 million records
--Pl/sql bock starts here
DECLARE
CURSOR cur IS
select root_data_col_id, lft, rgt, old_collection_id
from tbl_menu_leaf_nodes;
BEGIN
FOR rec IN cur
LOOP
UPDATE tbl_keys SET rgt = rgt+2 WHERE root_data_col_id = rec.root_data_col_id AND rgt >= rec.rgt;
INSERT INTO TBL_KEYS ( root_data_col_id, lft, rgt, collection_key_id )
SELECT rec.root_data_col_id, rec.rgt, rec.rgt+1, rec.old_collection_id FROM dual;
Commit;
END LOOP;
END;
The problem is with the update statement..It is at a very snail pace,because the cursor has to just loop through million records and the updates on the table would be the same.
even though we are freqeuntly commiting the data,the UNDO table space is growing huge.
Pl help out.
Thanks
sreeni
Pl help me to optimize the code..

I'm sorry to answer your question by asking another question. I'm just curious what it supposed to do?
(I overlooked the part with distinct ids and to fix my post, removed the nonsense about the order of rows)
Just few statements about the transaction size, undo and other load in the system. You need to commit no less or more often than your business logic requires/permits. Even if you do commit often, this does not shrink the undo you have it as much as currently running statements or read-only transactions require to maintain read consistency. Otherwise they will fail with "snapshot too old" error. By introducing artificially often commits you make things run even slower.
The update and insert do generate undo data. But neither would require the amount of undo you described. It will be overridden according to the undo retention time. It might be however required for other transactions. Vice verse if there are other DMLs against tbl_keys or tbl_menu_leaf_nodes at the same or around the same time, then their respective undo might be required for the statements in the block including cursor statement.
But back to the topic. Three things I would suggest to do.
1. Fetch the results of the cursor into an array and use the array as a driving source of information.
2. Then do bulk update and then bulk insert (or simply insert as select).
3. Reduce mentioned interference to significantly reduce the amount of work Oracle has to do. If this is a huge update process start it in off peak hours.
Vlad Sadilovskiy
Oracle Database Tools
http://www.fourthelephant.com
Message was edited by:
Vlad S.

Similar Messages

  • I need help resolving the issue of all channels being "clipped" by the (high and low limits) on the AI-Config sub-vi

    No matter what values I put in the corresponding channel index, all channels appear to be using the 'first' index of the limit cluster. I am using a PCI-6110E 5Ms board and LabVIEW 5.0. Has anyone else encountered this problem?

    If you want to have different input limits for the different channels, you need to make sure the channels are listed in separate Channel indexes as well. For example, if your channel array index 0 reads "0:7", then channels 0 through 7 will all use the input limit settings in the input limit array's index 0.
    Instead, enter "0" in Channel Array index 0,
    "1" in Channel Array index 1, etc.

  • TS1363 My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue?

    My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue? I have already updated to the latest version of iTunes on my Windows 8 and I cannot synchronize my iPod for the time being. Please do help me to solve this problem. Thank You.

    uninstall all iTunes,5 programes,this worked for me after reinstall them

  • Database get hang  please help to resolved the issue.

    Hi,
    we are getting below error at that time db not allowed user to connect database.please help to resolved the issue.
    db version is 10.2.0.3
    Errors in file /oracle/oradata/bdump/pmspr_j002_1593486.trc:
    ORA-12012: error on auto execute of job 42597
    ORA-27468: "EXFSYS.RLM$SCHDNEGACTION" is locked by another process
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j003_1347686.trc:
    ORA-12012: error on auto execute of job 42596
    ORA-27468: "EXFSYS.RLM$EVTCLEANUP" is locked by another process
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j004_1995004.trc:
    ORA-12012: error on auto execute of job 42596
    ORA-27468: "EXFSYS.RLM$EVTCLEANUP" is locked by another process
    Tue Jan 3 10:21:55 2012
    Process OS id : 2064550 alive after kill
    Errors in file /oracle/oradata/udump/pmspr_ora_1572972.trc
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j005_1617988.trc:
    ORA-12012: error on auto execute of job 42597
    ORA-27468: "EXFSYS.RLM$SCHDNEGACTION" is locked by another process
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j007_1523820.trc:
    ORA-12012: error on auto execute of job 42596
    ORA-27468: "EXFSYS.RLM$EVTCLEANUP" is locked by another process
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j009_1933354.trc:
    ORA-12012: error on auto execute of job 42596
    ORA-27468: "EXFSYS.RLM$EVTCLEANUP" is locked by another process
    Tue Jan 3 10:21:55 2012
    Errors in file /oracle/oradata/bdump/pmspr_j006_1536044.trc:
    ORA-12012: error on auto execute of job 42597
    ORA-27468: "EXFSYS.RLM$SCHDNEGACTION" is locked by another process
    Thanks

    I think the following Oracle two note looks interesting:
    Note: 330725.1 Scheduler Job has Been Locked For Days Ora-27468
    Note: 731678.1 Scheduled jobs do not run as expected after 10.2 upgrades
    HTH -- Mark D Powell --

  • Hi from the last two days my iphone have very slow to open the apps and very slow when i check the notification window , it taking too much time to open when i tap to down . help me to resolve the issue.

    Hi,  from the last two days my iphone( iphone 4 with ios 5) have very slow to open the apps and very slow when i check the notification window , it taking too much time to open when i tap to down . help me to resolve the issue.

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore...
    iPhone Reset
    http://support.apple.com/kb/ht1430
    Try this First... You will Not Lose Any Data...
    Turn the Phone Off...
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    Turn the Phone On...
    If that does not help... See Here:
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • TS4036 My iPhone5 was replaced today and when I did a restore I was only able to access a previous backup to the backup that I did yesterday? Hence, I do not have access to some apps such as ebooks and games. Can you help resolve this issue?

    My iPhone5 was replaced today and when I did a restore I was only able to access a previous backup to the backup that I did yesterday? Hence, I do not have access to some apps such as ebooks and games. Can you help resolve this issue?

    My girlfriend had a similar issue because her new device was not updated to IOS7 when she turned it on, but her backup point was created using IOS7.  Check to be sure the restore point was created and then factory reset the phone after you have updated to 7. 

  • HT204076 The sound effect icon appears in cannot the middle of my screen at all times. Resetting my iPad is not resolving the issue. Please assist. Thank you.

    The sound effect icon appears in cannot the middle of my screen at all times. Resetting my iPad is not resolving the issue. Please assist. Thank you.

    Music restoring or waiting to be restored (tap to enlarge image)

  • My Macbook Air 2013 battery life is sub 4 hours. How do I diagnose and resolve the issue?

    Hi,
    I have a 6 month old Macbook AIr 2013 and I am getting sub 4 hours of battery life against the 12 hrs advertised. I looked into the application monitor and found that Spotlight has been causing my battery to drain
    Here is a brief snapshot of System information
    Hardware Overview:
      Model Name:          MacBook Air
      Model Identifier:          MacBookAir6,2
      Processor Name:          Intel Core i5
      Processor Speed:          1.3 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache (per Core):          256 KB
      L3 Cache:          3 MB
      Memory:          4 GB
      Boot ROM Version:          MBA61.0099.B07
      SMC Version (system):          2.13f7
    Battery Information:
      Model Information:
      Serial Number:          D86349701E7F90KAV
      Manufacturer:          SMP
      Device Name:          bq20z451
      Pack Lot Code:          0
      PCB Lot Code:          0
      Firmware Version:          511
      Hardware Revision:          000a
      Cell Revision:          1200
      Charge Information:
      Charge Remaining (mAh):          6362
      Fully Charged:          No
      Charging:          No
      Full Charge Capacity (mAh):          7023
      Health Information:
      Cycle Count:          16
      Condition:          Normal
      Battery Installed:          Yes
      Amperage (mA):          -1727
      Voltage (mV):          8266
    System Power Settings:
      AC Power:
      System Sleep Timer (Minutes):          1
      Disk Sleep Timer (Minutes):          10
      Display Sleep Timer (Minutes):          10
      Wake on AC Change:          No
      Wake on Clamshell Open:          Yes
      Wake on LAN:          Yes
      AutoPowerOff Delay:          14400
      AutoPowerOff Enabled:          1
      DarkWakeBackgroundTasks:          1
      Display Sleep Uses Dim:          Yes
      PrioritizeNetworkReachabilityOverSleep:          0
      Standby Delay:          10800
      Standby Enabled:          1
      Battery Power:
      System Sleep Timer (Minutes):          1
      Disk Sleep Timer (Minutes):          10
      Display Sleep Timer (Minutes):          2
      Wake on AC Change:          No
      Wake on Clamshell Open:          Yes
      AutoPowerOff Delay:          14400
      AutoPowerOff Enabled:          1
      Current Power Source:          Yes
      DarkWakeBackgroundTasks:          0
      Display Sleep Uses Dim:          Yes
      Reduce Brightness:          Yes
      Standby Delay:          10800
      Standby Enabled:          1
    Hardware Configuration:
      UPS Installed:          No
    AC Charger Information:
      Connected:          No
      Charging:          No
    Can somebody please advise me on what exactly is wrong and what I need to do to resolve the issue. Much appreciate the help.
    Thanks
    Nitin

    1. Follow these instructions, or these for OS X 10.9 or later.
    2. In the Energy Saver preference pane, uncheck the box marked
    Enable Power Nap while on battery power
    3. You can also try resetting the SMC.
    4. Make sure your system is up to date in Software Update.
    5. Make a "Genius" appointment at an Apple Store, or go to another authorized service center.

  • When I open Muse, I get a message that a new update is available.  When I hit install it just closes and nothing happens.  Then I got a message  I needed Adobe Creative Cloud App to resolve the issue.  I downloaded a copy of Creative Cloud desktop but it

    When I open Muse, I get a message that a new update is available.  When I hit install it just closes and nothing happens.  Then I got a message  I needed Adobe Creative Cloud App to resolve the issue.  I downloaded a copy of Creative Cloud desktop but it says that my Muse is up to date.  It was last updated in May but you have a new update today and it will not update.  I thought maybe I am not suppose to have the Creative Cloud update because all I have is the individual app Muse and the photography program.  So I uninstalled the CC desktop.  Then when I open Muse it says I need the CC desktop to help with the update.  So I get stopped either way.  Now I also had a Pre-Release Muse on my computer and I don't know if that complicated things.  Please advise.

    All future installs/updates of Muse (and most other Adobe apps) are through the Creative Cloud desktop app. Thus you do need to have it installed.
    Are you on Windows or Mac? What OS version?

  • Has anyone had trouble with the LG 3 Cosmos when a call comes in; I am not able to hear from the caller, but, they can hear me?  The volumn is turned up but I can't seem to resolve the issue?  Thanks

    Has anyone had trouble with the LG 3 Cosmos when a call comes in; I am not able to hear from the caller, but, they can hear me?  The volumn is turned up but I can't seem to resolve the issue?  Thanks

    Oh no, Robinbird18! This is not what we like to hear about your cell phone. It makes it pretty hard to have a conversation with someone when you can't hear them. If you make a phone call out are you able to have a conversation with someone without any issues? How long has this been going on? Have you tried to use the phone on speaker phone to see if that works at all? Please keep us posted.   KevinR_VZW Follow us on Twitter @VZWSupport If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • Please help me, the app is not working

    Why are the home and apps tabs in the creative cloud app not loading? They continuously showing a loading icon yet after a long time neither of them works - I am unable to download any adobe software. I am using MAC OSX10.9. Please advise, thank you.

    Hi Slavalava,
    Please perform the following steps and check if it resolve the issue.
    Clean up cached user login information:
    Delete the opm.db file.
    Close the Creative Cloud application.
    Navigate to the OOBE folder.
    Windows: [System drive]:\Users\[user name]\AppData\Local\Adobe\OOBE
    Mac OS: /Users/[user name]/Library/Application Support/Adobe/OOBE folder
    Delete the opm.db file.
    Launch Creative Cloud.
    Hope this helps.
    Please let me know incase it deosn't resolve the issue.
    Regards,
    Sumit Singh

  • I have recently upgraded my iMac to 10.6.8 and now find that the upload photo to Facebook facility no longer works. I have reset Safari but this has not resolved the issue - any suggestions?

    I have recently upgraded my iMac to 10.6.8 and now find that the upload photo to Facebook facility no longer works. I have reset Safari but this has not resolved the issue - any suggestions? I can click on the "upload photos/video" field and it takes me to Finder to select the photo - but on selecting the photo, the Finder screen disappears as normal but from then on nothing happens.

    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:  Remove All Website Data
    Now empty the Safari cache.
    Back to the menu bar, click Safari > Preferences then select the Advanced tab.
    Select:  Show Develop menu in menu bar
    Now click Develop from the menu bar. From the drop down menu click Empty Caches.
    Quit and relaunch Safari then try Facebook.
    If that doesn't help, it may be a Safari extension preventing you from uploading content to Facebook.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • I have started to get this error message: 5.1.3 bad address syntax in my email account. I am using Outlook 2011. It does not appear to be affecting sending or receiving email. I have no idea what it means or how to resolve the issue. Any advice?

    I have started to get this error message: "5.1.3 bad address syntax" in my email account. I am using Outlook 2011. It does not appear to be affecting sending or receiving email. I have no idea what it means or how to resolve the issue. Any advice?  My email account is through Optimum online and I am using Airpost Express.
    P.S. The error sound "bong" is driving us nuts!

    Please post on the Office for Mac product forums that Microsoft hosts. It's their product and they can best troubleshoot the issue.

  • In FCP x backup process is constantly running in background even though its done which results into slow working of FCP x. any idea to resolve the issue. I am using 10.1.3 and facing the problem ever since i have updated my FCP x to 10.1.3

    in FCP x backup process is constantly running in background even though its done which results into slow working of FCP x. any idea to resolve the issue? I am using 10.1.3 and facing the problem ever since i have updated my FCP x to 10.1.3

    Go into preferences and under playback turn off background render. That helped speed things for me when working with large files.

  • HT204088 I believe I got the short end of the stick due to the time I resolved the issue of a refund from Paypal and I lost the offer of an 25% discount on a $50 I-Tunes card, this have left me very anrgy with the issue.

    The issue is above, Iwas to buy an I-Tunes card of $25.00,but then wanted a $50.00, but due to I not processed a refund that I believed to be automatically, I could not purchase the I-Tunes card, because of the delay of finding what was wrong with the purchase with Paypal because of an refund that was issued due to a book that I did not recieve for two month of $5.00 and by the time I resolved the issue the offer was to late and for this reason  could not buy the $50.00 I-Tunes card and have decided not to buy any more I-tunes card at all, because I got the short end of the stick and I am very angry to the two companies.

    Thank you so much for helping,
    But i really wonder how you did that. did you always switch between design view and preview view, then change the key position for 2px then switch back, to align the four letters? because i imagine that can get really frustrating, if you have a logo consisting of 58 parts instead of 4!:)
    Anyway thank you very much for your time and effort!!!!

Maybe you are looking for

  • What file format do I need to put a movie on my ipod?

    I don't know how to get movies on my ipod. Do I have to use an imac? Does it have to be in mp4 format? Can it be QuickTime?

  • How do I keep the same file size, going from tiff to jpg?

    Going from tiff to jpg, how do I keep the same file size? Seems like I am not able to save the jpg´s in 16-bits... Thanks!

  • Duplicating pages in Acrobat

    Working with Acrobat documents, from time to time I would like to be able to duplicate page(s).  There doesn't seem to be a feature for this. I would like to request that it be added to a list of feature inclusions, thanks.

  • How to prepare for 1zo 052 exam?

    Hi I have recently passed my 1zo-051 exam and i am looking forward to taking the next step to become a certfied admin profession .I am not very sure as to how to prepare for the exam should i study dumps and ebooks or should i go for practical traini

  • Just installed Photoshop CC - Crashing on Startup

    Faulting application name: Photoshop.exe, version: 15.2.2.310, time stamp: 0x5480338c Faulting module name: msvcrt.dll, version: 7.0.7601.17744, time stamp: 0x4eeb033f Exception code: 0xc00000fd Fault offset: 0x00000000000015af Faulting process id: 0