Procedure hangs while bulk delete

Hi,
I have the following situation:
I'm trying to delete the records using oracle bulk delete feature using SAVE EXCEPTIONS clause so that I can count how many were actually deleted and how many were not due to referential integrity constraint. I tried this on one table which has ca. 40,000 child records... this means that 40,000 exceptios were recorded by the SAVE EXCEPTIONS clause. Could this be the reason for the procedure to go in hang state ?
Could someone please advise me on this as to what might be going wrong. I'm working Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit.
Thanks.
-Patza

Anything could be the reason why something is hanging given that you've provided very little detail. So lets start at the beginning.
1. What platform? CPU? Operating system? RAM?
2. How long have you let it run?
3. Have you checked the alert log?
4. Have you tried starting with a delete of 100 rows, then increased to 1000, 5000, 10000, etc? If not why not? Have you then tried incrementally adding the child records to force the exceptions? If not why not? Start with generating 1, then 10, then 100 exceptions.

Similar Messages

  • Procedure hangs while create or replace!

    Dear All,
    My Database is Oracle 11g RAC.
    I did few changes in one of my procedure and wanted to re-create it using CREATE OR REPLACE procedure...
    The statement hangs for a long time and the concurrency in OEM raises up to a very high level. I tried to find the blocking sessions but for some time there was no blocking session.
    I also tried stopping the activities on the tables used in this procedure.
    Kindly suggest me what should I do in this situation. I have also tried running the query directly from the server.
    Regards, Imran

    Hi,
    check for any locks & kill it , execute on each instance or use gv$
    alter session set nls_date_format='dd-mon-yy hh24:mi:ss';
    select /*+ CHOOSE */ a.sid, a.serial#,vp.spid,a.last_call_et,a.logon_time,a.status,sw.event, a.username,a.osuser, a.status,
    a.program,a.MACHINE, a.type ptype,b.owner, b.object, b.type
    from v$session a, v$access b,v$session_wait sw, v$process vp
    where a.sid=b.sid and b.sid=sw.sid  and a.paddr=vp.addr
    and b.type<>'NON-EXISTENT'
    and (b.owner is not null) and (b.owner<>'SYSTEM')  and (b.owner<>'SYS')
    and upper(b.object) like '%&obj_name%'
    ORDER BY 3;Thanks,
    Ajay More
    http://moreajays.blogspot.com

  • Forall bulk delete is too slow to work,seek advice.

    I used PL/SQL stored procedure to do some ETL work. It is pick up refeshed records from staging table, then check to see whether the same record exists in target table, then do a Forall bulk deletion first, then do a Forall insert all refreshed records into target atble. the insert part is working fine. Only is the deleteion part, it is too slow to get job done. My code list below. Please advise where is the problem? Thansk.
    Declare
    TYPE t_distid IS TABLE OF VARCHAR2(15) INDEX BY BINARY_INTEGER;
    v_distid t_distid;
    CURSOR dist_delete IS
    select distinct distid FROM DIST_STG where data_type = 'H';
    OPEN dist_delete;
    LOOP
    FETCH dist_delete BULK COLLECT INTO v_distid;
    FORALL i IN v_distid.FIRST..v_distid.LAST
    DELETE DIST_TARGET WHERE distid = v_distid(i);
    END LOOP;
    COMMIT;
    end;
    /

    citicbj wrote:
    Justin:
    The answers to your questions are:
    1. why would I not use a single DELETE statement? Because this PL/SQL procedure is part of ETL process. The procedure is scheduled by Oracle scheduler. It will automatically run to refresh data. Putting DELETE in stored procedure is better to executed by scheduler.You can compile SQL inside a PL/SQL procedure / function just as easily as coding it the way you have so that's really not an excuse. As Justin pointed out, the straight SQL approach will be what you want to use.
    >
    2. The records in dist_stg with data_type = 'H' vary by each month. It range from 120 to 5,000 records. These records are inserted into target table before. But they are updated in transactional database. We need to delete old records in target and insert updated ones in to replace old ones. But the distID is the same and unique. I use distID to delete old one and insert updated records with the same distID into target again. When user run report, the updated records will show up on the report. In plain SQL statement, delete 5,000 records takes about seconds. In my code above, it take forever. The database is going without any error message. There is no trigger and FK associated
    3. Merge. I haven't try that yet. I may give a try.Quite likely a good idea based on what you've outlined above, but at the very least, remove the procedural code with the delete as suggested by Justin.
    >
    Thanks.

  • My iphone is hanging while working with whats up. kindly help

    my iphone is hanging while working with whats up. kindly help

    I assume you mean whatsapp.
    First double click the home button and swipe the app closed.
    If it still doesn't work try a reset. Press and hold the home and power buttons until the Apple logo appears. Release both buttons. Wait until your iPhone starts on it's own.
    If whatsapp is still giving you problems try deleting and reinstalling the app.

  • Bulk deletion of photos - where is the "Select All"?

    This is a question for Apple after a couple of years of frustration and work-arounds
    Using the camera connection kit I frequently suck in hundreds of photos to the iPad for viewing in the field. These go into the 'All Imported' folder
    In a short period of time, this folder grows to a monster (currently I have some 4000 photos in it) and I need to clear it out as it stuffs up my tiny 64gb iPad.
    ALL methods I have read to do this are frankly awkward and kludgy.  'Image Capture" has stopped recognising the iPad". I don't always have access to a 3rd device which doesn't already have these photos imported (thus blocking the 'delete after importation' approach). Furthermore it has taken me over a year to grok that you need to use TWO fingers to swipe multiple photos (in any case an ugly process when dealing with 1000s) not ONE as in previous version. Like most iPad/Apple users I had assumed that this 'feature' had quietly been dropped
    The addition of a simple 'select ALL' button would save me and thousands of users countless grief. There are a number of other applications in which this would be useful (music) but it is the photos which most affect me.  it is a generic solution and compatible with the standard Applu UI metaphor.  Why in earth would you not put this in place?
    -gordon
    [email protected]

    On a Mac, you can use the Apple Image Capture utility to bulk process your iPad photos.
    On a Windows PC, there is no Apple Image Capture utility. However, you can follow this procedure to bulk-delete photos from your iPad:
    connect your iPad to your PC using the USB-cable that came with your iPad
    open Windows Explorer, and open the DCIM-folder on your iPad
    you will see a list of folders with "weird" names, which look like this example:Computer\iPad\Internal Storage\DCIM\838CPLYO
    for each folder, open it, select all photos in it, and press the delete-keynote: you cannot delete the entire folder itself, you have to go in and delete the photos in it
    A bunch of empty folders will remain after this procedure, which you cannot delete manually, but they will be automatically cleaned-up after you restart your Photo app on your iPad.

  • FORALL bulk delete statement it requires lot of time

    Hi,
    when I execute FORALL bulk delete statement it requires lot of time even for 10 rows deletion.so how to avoid this problem? I checked SGA_TARGET and PGA_TARGET cureent_size and max_size are same for both. Is their is memory problem?
    thanks in advance
    Vaibhav

    Please look at this:
    http://psoug.org/definition/LIMIT.htm
    If you add the LIMIT 100 part to your query your bulk collect / forall construction will process 100 records per part.
    This will avoid filling up undo tablespaces / PGA memory.
    There's also a discussion wether to use LIMIT 100 or LIMIT 1000 (or greater).
    It depends on what your system can handle, if it's a busy production statement I'd stick to a value of 100.
    Reason for this, is that your query will not take a huge amount of PGA.
    DECLARE
    TYPE t_id_tab IS TABLE OF test.c1%TYPE;
    l_id_tab t_id_tab := t_id_tab();
    Begin
    dbms_output.put_line(DBMS_UTILITY.get_time);
    select c1 bulk collect into l_id_tab
    from TEST where c1<=150000
    LIMIT 100;
    FORALL i IN l_id_tab.first .. l_id_tab.last
    delete from TEST where c1= l_id_tab(i);
    commit;
    dbms_output.put_line(DBMS_UTILITY.get_time);
    End;we use this construction to load data into our warehouse and bumped into the LIMIT 100 part while testing.
    It did speed up things significantly.
    Another (risky!) trick is to do:
    -- exclude table from archivelogging
    ALTER TABLE TEST NOLOGGING;
    -- execute plsql block
    <your code comes here>
    -- enable logging on the table
    ALTER TABLE TEST LOGGING;The risky part is that you get inconsistent archivelogging this way because your deletes arent logged.
    When you do a restore from backup and want to roll forward until the latest change in your archive logs, you'll miss these deletes and your table will not be consistent with the rest of your database.
    In our warehouse situation we dont mind, data gets refreshed every night.
    Hope this helps!
    Robin

  • Which is fast bulk delete or id's in a table and a where exists ....?

    I have some parent objects and that I use bulk collect with fetch limit and I currently store the primary keys of these parent objects to identify their child objects later by using where exists with a correlated subquery.
    I'm essentially moving objects graphs that span partitions from table to table.
    when I've done my SQL insert into select... I eventually do a delete.
    currently the delete uses the parent objects in this working table to identify the children to delete later.
    Q. What is likely to be faster?
    using a "temporary" table to requery for child objects based on the parents that I have for each batch or
    using returning clause from my insert into select so that I have rowid's or primary keys to work with later on
    when I want to perform my delete operation?
    I essentially have A's that have child B's which in tern have child C's.
    I store a batch of A pk's in a table and use those to identify the B's
    currently I don't store the B's pk but use the A pk's again to identify the B's which in turn are used to identify the C's later.
    I'm thinking if I remember the pk's I'm using at each level I can then use those later when it comes to the deletes.
    typically that's done in a returning clause and using a bulk delete from that collection later.
    thoughts?

    Parallel DML is one option. Another is to ceate a procedure (or package) that does a discreet unit of work (e.g. process parent and its children as a single business transaction). And then write a "+thread manager+" that runs x number copies of these at the same time (via DBMS_JOB for example).
    Let's say the procedure's signature is as follows:
    create or replace procedure ProcessFamily( parentID number ) is ..
    --// processes a family (parent and children)
    ..Using DBMS_JOB is pretty easy - when you start a job you get a job number for it. Looking at USER_JOBS will tell you whether that job is still in the job queue, or has completed (once off jobs are removed from the queue). The core of the this code will be a loop that checks how many jobs (threads) are running, and if less than the ceiling (e.g. it may only use 20 threads), start more ProcessFamily jobs.
    If the total number of threads/jobs to execute are known up front, then this ThreadManager can manually create a long operation entry. Such an entry contains the number of unit of works to do and then is updated with the number of units done thus far. Oracle provides time estimates for completion and percentage progress. This long operation can be tracked by most Oracle-based monitoring software and provide visibility as to what the progress is of the processing.
    The ProcessFamly procedure can also use parallel DML (if that makes sense). Or bulk processing (if needed). This approach is also scalable as h/w increases (server upgrades, new server h/w), so too does your ability to run more threads (aka jobs) at the same time.
    Now I'm not suggesting that you write a ProcessFamily() proc - I do not know the actual data and problem you're trying to solve. What I'm trying to convey is the basic principle for writing multi-thread/parallel processing software using PL/SQL. And it is not that complex. The critical thing is simply that the parallel procedure or thread be entirely thread safe - meaning that multiple copies of the same code can be started and these copies will not cause serialisation, dead locking, and other (application designed) problems.

  • Procedure hanging..

    Hi,
    alter procedure <procedure name> compile;
    After issue that command it is hanging... why?
    Thanks,

    Usually because it's trying to acquire a lock on a dictionary table, and that table is already locked.
    Occurs frequently if procedure a calls procedure b, while procedure b calls procedure a.
    Find out whether your session is waiting for locks.
    Eventually the hanging session will receive a timeout error, but this can take 5 to 10 minutes.
    Sybrand Bakker
    Senior Oracle DBA

  • Random hanging while import?

    I'm not sure what's going on but recently, my Aperture library is getting a lot of hanging while importing. It happens both with my camera and even when just importing photos from a local folder. The library is located in a thunderbolt external drive. Usually I have to force quit aperture because once the import hangs there's no way to stop it. Normal quiting of the application will get stuck "cancelling". How do I fix this?

    leonieDF wrote:
    . I copied all the files first to the desktop and then imported into aperture, still the same hang at "saving preview...".
    The hang at "Saving Preview" typically occurs if one image is being processed, that has a corruption and cannot be processed.
    Aperture is processing the previews in the background. That may take a long time. Before you force quit Aperture and suspect a hang, look at the filename in the Activity viewer. If it is hanging at the same filename without getting the preview created, then export the original as original, not the edited version delete that file from Aperture. Check that file in another program and make sure you do not import that particular file again.
    Have a look at the screenshot Mr. Spork posted. You can see the name of the currently processed file in the panel. If ithis name does not change for hours, then you have found the file that is making Aperture unresponsive or hang.
    Second test, I created a new aperture library immediately after the hang and imported the same folder of files. No hanging.
    You cannot be  sure, until the processing of all the previews has finished.
    If you isolate the file that causes the hang and check only importing that particular file in a separate library and that works well, then you know that it is the library and not the image.
    If it is the library, try rebuilding the library instead of repairing. Make a backup of the library before trying that.
    No as I mentioned above. If I force quit Aperture, repair the database, the same files will import just fine. So the problem is not with the files.
    Also I cannot rebuild the library, because that will reset all my curves. Any other fix?

  • Application hangs while trying to create a socket

    Hello,
    We have a third party application that makes HTTP connections using a old version of HTTPClient. Recently we have run into problems where the application hangs as one thread seems to hang while trying to create a socket (thread dumps show the hang occurs in native code) and other threads end up waiting for this thread as they need to obtain a lock on HTTPClient.HTTPConnection. We found out that HTTPClient was not setting a timeout on the underlying socket (SO_TIMEOUT) and the relevant patch has been implemented in the hope that if the condition arises again the offending thread will be timed out and allow other threads to try and continue.
    We will not be able to see if the patch works until Monday and I would like to understand the problem a little better if it fails. My question at what point will the socket timeout starting ticking? As our offending thread is waiting in native code is there a chance that the timeout will not be "active".
    Also can anyone provide reasons for an application hanging while trying to create a socket and any suggestions for monitoring or mitigating this problem?
    Thanks a lot.
    Sun Solaris 5.8
    JDK 1.4.1 b02

    It looks like our version of the JDK offer a connect method with a timeout value, I think this will do the trick.

  • I share an itunes account with me mum is there any way to split my phone off while not deleteing my mums stuff as well

    i share an itunes account with me mum is there any way to split my phone off while not deleteing my mums stuff as well?

    You can select with items so sync if you dont want everything on there. Just click the iphone in itunes and click music. THere you can pick and choose what you sync.

  • I borrowed a hard drive from a friend that contains many thousands of songs. Somehow when tranferring these to iTunes I managed to get several copies of each song. How can i do a bulk delete of all the copies leaving just one version of each song?

    I need help please. I borrowed a hard drive from a friend which contains many thousands of songs. When adding them to my iTunes library I somehow managed to make multiple copies of each song. Is there a way to do a bulk delete of all the duplicates? If I have to go one by one it will take a lifetime.

    I have the same problem. I keep backups on a home server and this is where my library pointed to. I changed it to the local drive and now I have two copies in the library. I need to either bulk delete or clear the library (without deleting the files) and then rebuild. How do I do either of these things?

  • JVM hangs while executing  a sql query

    My JVM hangs while I try to execute an update query. I am using JDBC thin client and Oracle 9i as database. Can someone please suggest what could be wrong.

    I have a serious problem regarding the usage of Prepared Statement.
    I am working on J2EE based application with the application server as Oracle 9ias.We have mostly used Prepared in 0ur queries.But one our application got implemented we are facing some strange problems.The first instance was a web page was getting hanged and does not give any results.But this had worked fine in all our testing environment.We analysed the table which it uses and still no result.Finally we changed prepared statement to statement and the result page came within seconds.
    The second instance is the main issue.Again a query is getting hanged when we try to process it through the web page.We again tested it by converting from prepared statement to statement and its coming within seconds.
    Can someone give me some input.Is there any databse parameter that is controlling this prepared statement or statement.

  • Just downloaded Firefox 6.0 and have restarted 4 plus times, but it continues to hang while launching. I cannot open new windows, change any settings, or do anything but Force Quit. I'm on Mac OSX 10.5.8. How do I get past this hang?

    Just downloaded Firefox 6.0 and have restarted 4 plus times, but it continues to hang while launching. I cannot open new windows, change any settings, or do anything but Force Quit. I'm on Mac OSX 10.5.8. How do I get past this hang?

    Long story short: Simply get CC for teams. At 500 bucks a year it's a steal and those 5 licenses in the base package (or was it 10 even?) cover all your computers, at least the 3 ones you mentioned. For system requirements refer to the individual product pages.
    Mylenium

  • Connect Mobile for RIM Blackberry Playbook hangs while trying to connect to server

    We have Adobe Connect 8 (Multilanguage - Portuguese) installed on a server. Connect Mobile for RIM Blackberry Playbook hangs while trying to connect to the server. Hayward Drummond has posted a notice about Adobe Connect 8.1.2 that seems to solve this problem, known as BUG 2886745. I sucessfuly downloaded this update but I´m not sure if it is compatible with Adobe Connect 8 Multilanguage - Portuguese.  Does anyone know something about it? I also need to first install version 8.1.1 in order to upgrade to 8.1.2, as remarked by Hayward. Does anyone know where can I download version 8.1.1 (Multlanguage - Portuguese)?

    try to install Firefox 8 on top of Firefox 7, or
    Profile is a folder which store all your personal data in a safe place
    * https://support.mozilla.com/en-US/kb/Profiles
    here explain how to backup profile
    * https://support.mozilla.com/en-US/kb/Backing%20up%20your%20information
    here explain how to restore it
    * https://support.mozilla.com/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile

Maybe you are looking for

  • Automator application: Rtf's converted from pdf's do not open and word files from same rtf's are blank--???

    I found directions for converting pdf's to word documents to facilitate editting.  The process used Automator by selecting pdf's to be converted to rtf's.  The resulting rtf file could then be saved as a word document.  The problem is that the result

  • I have iphoto 2 and can't read my sister's disc generated in iphoto6.

    I'm trying to create a 'slideshow' in imovie using different peoples pictures for my parent's 60 anniversary party. My sister has a newer computer and iphoto 6 while I have iphoto2. My computer tells me that I can't read her disc in my library. Do i

  • How to transport routines?

    Hi,    I wrote a Start Routine in the update rule, of a cube and tried to transport the complete update rule to the Quality system. After the transport request was released from Developement BW system, it had ended up with an error 8 and in turn also

  • Proof of exchange for iPhone 4?

    Hi all I'm trying to unlock my iPhone 4 handset so I can sell it on now that I've upgraded to the 5. I had a problem with the home button early last year and had to get an exchange from Apple. Now, to unlock it T-Mobile need a proof of that exchange.

  • New problems repairing permissions

    I have done a fresh install of Leopard using the "Erase and Install" method. Most of the other problems I was having before are now gone. Except for one. I'm now getting the following problems while doing a Permission Repair: Repairing permissions fo