My procedure hang and wait long time

i have a procedure that runs only following sql statement when i execute this procedure it take long time!!one day !!how could i improve the speed??
for job in (select r.job_name,r.run_id from
applsys.fnd_sch_job_runs r
where r.start_date< add_months(sysdate,-8))
loop
delete from applsys.fnd_sch_job_run_details
where run_id = job.run_id;
delete from applsys.fnd_sch_job_runs r where r.job_name=job.job_name ;
commit;
end loop;
*************************************************************

Your code...
for job in (select r.job_name,
                   r.run_id
              from applsys.fnd_sch_job_runs r
             where r.start_date < add_months( sysdate, -8 ) )
loop
  delete
    from applsys.fnd_sch_job_run_details
   where run_id = job.run_id;
  delete
    from applsys.fnd_sch_job_runs r
   where r.job_name =j ob.job_name ;
commit;
end loop;I will bet that there is an FK on fnd_sch_job_run_details that references fnd_sch_job_runs.
If that FK is not indexed then you will (in addition to locking fnd_sch_job_run_details) perform a FTS on fnd_sch_job_run_details for each row deleted from fnd_sch_job_runs.
Avoid this by:
1. Make sure that if there is an FK on fnd_sch_job_run_details that references fnd_sch_job_runs, that it is indexed.
2. Replace the cursor loop with something like
delete
  from applsys.fnd_sch_job_run_details
where run_id IN ( select r.run_id
                     from applsys.fnd_sch_job_runs r
                    where r.start_date < add_months( sysdate, -8 ) );
delete
  from applsys.fnd_sch_job_runs r
where r.start_date < add_months( sysdate, -8 );
commit;

Similar Messages

  • I used to have iPhone and iPad long time which all my photos where in iCloud then I bought a new iPad last year and I could not get my previous photos what can I do to get them back

    I Used to have all my photos in my iPad and iPhone long time ago and then I bought a new iPad last year but I never get my previous photos again what can I do please help me

    Photo stream photos only remain in iCloud for 30 days and your iCloud back only remains on iCloud for 180 days.  If you're looking for photos from last year I'm afraid they wouldn't be in iCloud at this point.  Unless you have another backup on your computer or they are still on one of your other devices they're gone now.

  • I cannot download in-app purchase  . I'm live in Thailand and download in thai store only   but i  can not download in-app  . My appleID name Cradit and user long time

    Hi...
           I cannot download in-app purchase  . I'm live in Thailand and download in thai store only   but i  can not download in-app  . My appleID name Cradit and user long time help me please .  Thank you

    What happens when you try?
    Any info about your issue at all?

  • Oracle 11gR2 alter database open hangs for a long time

    Hi,
    We are cloning oracle apps database with RAC to non-RAC. We did the ORACLE_HOME clone and then duplicated the database with rman.
    It completed successfully.
    While trying to bounce the database, the db startup option hangs at "alter database open" for a long time
    There are no errors in the alert log file. It just waits at "alter database open"
    Please help and thanks in advance.
    Regards
    Sasikala

    These are the lines in the trace file
    Instance name: stdby
    Redo thread mounted by this instance: 0 <none>
    Oracle process number: 9
    Unix process pid: 434204, image: oracle@developmentDR (MMAN)
    *** 2011-01-31 09:32:40.713
    *** SESSION ID:(208.1) 2011-01-31 09:32:40.713
    *** CLIENT ID:() 2011-01-31 09:32:40.713
    *** SERVICE NAME:() 2011-01-31 09:32:40.713
    *** MODULE NAME:() 2011-01-31 09:32:40.713
    *** ACTION NAME:() 2011-01-31 09:32:40.713
    def_comp: comp id 7 bp state 4
    And I din try opening the db with resetlogs. Do you want me to do that?
    thanks

  • Extraction jobs waits long time

    Hi,
    I tried to extract 0ORGUNIT information from one of our test systems.
    As can be read from the job log at the end, the jobs sits and waits for about 14 hours before actually starting data extraction. We're talking a mere 46.000 entries here. I'm trying to understand why the jobs waits soo long.
    Any idea is welcome?
    16:17:18 Job started                                                                               
    16:17:18 Step 001 started (program SBIE0001, variant &0000000100868, user name 972044)               
    16:17:19 DATASOURCE = 0ORGUNIT_ATTR                                                                  
    16:17:19 *************************************************************************                   
    16:17:19 *           Current values of selected profile parameter                *                   
    16:17:19 *************************************************************************                   
    16:17:19 * abap/heap_area_nondia......... 2000683008                              *                  
    16:17:19 * abap/heap_area_total.......... 2000683008                              *                  
    16:17:19 * abap/heaplimit................ 40894464                                *                  
    16:17:19 * zcsa/installed_languages...... NEFD                                    *                  
    16:17:19 * zcsa/system_language.......... E                                       *                  
    16:17:19 * ztta/max_memreq_MB............ 64                                      *                  
    16:17:19 * ztta/roll_area................ 10485760                                *                  
    16:17:19 * ztta/roll_extension........... 2000683008                              *                  
    16:17:19 *************************************************************************                   
    05:54:05 BEGIN BW_BTE_CALL_BW204020_E 46.091                                                         
    05:54:05 END BW_BTE_CALL_BW204020_E 46.091                                                           
    05:54:05 BEGIN EXIT_SAPLRSAP_002 46.091                                                              
    06:29:42 END EXIT_SAPLRSAP_002 46.091                                                                
    06:29:42 Asynchronous sending of data package 000001 in task 0002 (1 parallel tasks)                 
    06:30:33 tRFC: Data package = 000001, TID = 2DDE00246B9444ED2B370016, duration = 00:00:46, ARFCSTATE =
    06:30:33 tRFC: Begin = 24.08.2006 06:29:47, End = 24.08.2006 06:30:33                                
    06:30:33 Job finished

    Gimmo,
    Apart from my interactive session and the batch job nothing happens on the system.
    sm50 shows no activity other than mine.
    Sufficient resources are available.
    What I do see in sm12 (locks) is:
    Cli User         Time       Mode   Table      Lock argument     
    040 972044       09:27:24   E      EDIDC      0400000000005084008
    Selected lock entries:              1                           
    I suspect somethings not right in the ALE arena?
    Regards,
    Eric

  • My mac shutdown suddenly fr0m time to other and take long time to open

    hi everybody,
    I think i have big problem ,i have macbookpro I5 13" early 2011  , i just changed the board to I7 ( used  board got it from net ) after USB ports in my original logicboard are damaged due to drop  , after changing the board the mac is unstable, it take long time(half hour!) to show up anything after press power,  yes I press power and there are no response  from the mac (black monitor as its ) , just   i hear  a noise from the empty CD drive . once it open it work fine for a while (may 2 hours or more ) and then shutdown suddenly! and you have wait more than half hour to open it again if im lucky.
    Itried to rest the mac many times, replace the RAM places , i thought may the problem come from overheating the CPU, i monitored the CPU tempreture just before the suddenly shutdown was 57C
    please help ,any suggetions ?

    Run an Apple hardware Test:
    support.apple.com/kb/ht1509http://
    You may have to use OPTION D to start it.
    See what that picks up. 
    You may also bring the MBP to an Apple store or AASP for a diagnostic evaluation.
    Ciao.

  • Browsers crash or hang for a long time too often

    I would have posted this in the Safari forum, but even with Firefox and Camino, I have the same problem. I do a bit of multitasking. I am always Photoshopping at my job and I always have anywhere from 3-8 tabs open. I know that's a lot, but is it not unusual for, every few hours or so, my browser to lock up, crash, or hang for a really long time? I get the spinning wheel and no response from my browsers. It seems to happen randomly, not when I am doing anything specific. I usually have to Force Quit and re-open. Sometimes restoring my previous session works, sometimes it doesn't. Any advice?

    Myself and several friends were experiencing the same thing after the latest security update. In Disk Utility try selecting your hard drive and clicking 'Repair permissions'. I no longer have these problems.

  • Device and printers long time to open iprint printers

    Hi all,
    We have some laptops (windows732bit iprint client 5.92/5.94) that go offsite each night and have found that when opening devices and printers, or word etc that check the printers and can take a long time to respond/show the printers. No doubt this is because of the ipp printers installed from iprint, the less amount of network printers the quicker it opens etc.
    Is there a way to shorten/eliminate the timeout for checking of network printers at all?
    Thanks.

    Originally Posted by clarja
    Hi all,
    We have some laptops (windows732bit iprint client 5.92/5.94) that go offsite each night and have found that when opening devices and printers, or word etc that check the printers and can take a long time to respond/show the printers. No doubt this is because of the ipp printers installed from iprint, the less amount of network printers the quicker it opens etc.
    Is there a way to shorten/eliminate the timeout for checking of network printers at all?
    Thanks.
    Hi,
    try the latest client there is a fix a "slow issue" not sure if it's the same issue that you have but worth a try:
    Fixes introduced in the 5.96 iPrint Client
    Print Spooler Crash with WinXP/Win7 and 5.94 iPrint Client. (See TID 7014728)
    iPrint client 5.94 slow updating windows printer properties page (Bug 865327)
    On these computers, what printer model is installed and what driver + version are they using?
    Thomas

  • Why I get script nnt working message often and for long time computer hangs and I can't work? Any solution?

    It is common many time I open link or try to attach a file to email I get script not working message. This at times not go away even I stop it and I can't close sites also. I have to close through Ctrl+Alt+Delete route.
    What could be the reason and any solution?

    "SELECT RcptNo FROM RcptTable WHERE ReceiptTime = '"+receipt_time+"'"
    In MS Access, this exception occurs when the column names specified in the query are not correct. Check the table definition and verify the column names.

  • Stored Procedure  is taking too long time to Execute.

    Hi all,
    I have a stored procedure which executes in 2 hr in one database, but the same stored procedure is taking more than 6 hour in the other database.
    Both the database are in oracle 11.2
    Can you please suggest what might be the reasons.
    Thanks.

    In most sites I've worked at it's almost impossible to trace sessions, because you don't have read permissions on the tracefile directory (or access to the server at all). My first check would therefore be to look in my session browser to see what the session is actually doing. What is the current SQL statement? What is the current wait event? What cursors has the session spent time on? If the procedure just slogs through one cursor or one INSERT statement etc then you have a straightforward SQL tuning problem. If it's more complex then it will help to know which part is taking the time.
    If you have a licence for the diagnostic pack you can query v$active_session_history, e.g. (developed for 10.2.0.3, could maybe do more in 11.2):
    SELECT CAST(ash.started AS DATE) started
         , ash.elapsed
         , s.sql_text
         , CASE WHEN ash.sql_id = :sql_id AND :status = 'ACTIVE' THEN 'Y' END AS executing
         , s.executions
         , CAST(NUMTODSINTERVAL(elapsed_time/NULLIF(executions,0)/1e6,'SECOND') AS INTERVAL DAY(0) TO SECOND(1)) AS avg_time
         , CAST(NUMTODSINTERVAL(elapsed_time/1e6,'SECOND') AS INTERVAL DAY(0) TO SECOND(1)) AS total_time
         , ROUND(s.parse_calls/NULLIF(s.executions,0),1) avg_parses
         , ROUND(s.fetches/NULLIF(s.executions,0),1) avg_fetches
         , ROUND(s.rows_processed/NULLIF(s.executions,0),1) avg_rows_processed
         , s.module, s.action
         , ash.sql_id
         , ash.sql_child_number
         , ash.sql_plan_hash_value
         , ash.started
    FROM   ( SELECT MIN(sample_time) AS started
                  , CAST(MAX(sample_time) - MIN(sample_time) AS INTERVAL DAY(0) TO SECOND(0)) AS elapsed
                  , sql_id
                  , sql_child_number
                  , sql_plan_hash_value
             FROM   v$active_session_history
             WHERE  session_id = :sid
             AND    session_serial# = :serial#
             GROUP BY sql_id, sql_child_number, sql_plan_hash_value ) ash
           LEFT JOIN
           ( SELECT sql_id, plan_hash_value
                  , sql_text, SUM(executions) OVER (PARTITION BY sql_id) AS executions, module, action, rows_processed, fetches, parse_calls, elapsed_time
                  , ROW_NUMBER() OVER (PARTITION BY sql_id ORDER BY last_load_time DESC) AS seq
             FROM   v$sql ) s
           ON s.sql_id = ash.sql_id AND s.plan_hash_value = ash.sql_plan_hash_value
    WHERE  s.seq = 1
    ORDER BY 1 DESC;:sid and :serial# come from v$session. In PL/SQL Developer I defined this as a tab named 'Session queries' in the session browser.
    I have another tab named 'Object wait totals this query' containing:
    SELECT LTRIM(ep.owner || '.' || ep.object_name || '.' || ep.procedure_name,'.') AS plsql_entry_procedure
         , LTRIM(cp.owner || '.' || cp.object_name || '.' || cp.procedure_name,'.') AS plsql_procedure
         , session_state
         , CASE WHEN blocking_session_status IN ('NOT IN WAIT','NO HOLDER','UNKNOWN') THEN NULL ELSE blocking_session_status END AS blocking_session_status
         , event
         , wait_class
         , ROUND(SUM(wait_time)/100,1) as wait_time_secs
         , ROUND(SUM(time_waited)/100,1) as time_waited_secs
         , LTRIM(o.owner || '.' || o.object_name,'.') AS wait_object
    FROM   v$active_session_history h
           LEFT JOIN dba_procedures ep
           ON   ep.object_id = h.plsql_entry_object_id AND ep.subprogram_id = h.plsql_entry_subprogram_id
           LEFT JOIN dba_procedures cp
           ON   cp.object_id = h.plsql_object_id AND cp.subprogram_id = h.plsql_subprogram_id
           LEFT JOIN dba_objects o ON o.object_id = h.current_obj#
    WHERE  h.session_id = :sid
    AND    h.session_serial# = :serial#
    AND    h.user_id = :user#
    AND    h.sql_id = :sql_id
    AND    h.sql_child_number = :sql_child_number
    GROUP BY
           ep.owner, ep.object_name, ep.procedure_name
         , cp.owner, cp.object_name, cp.procedure_name
         , session_state
         , CASE WHEN blocking_session_status IN ('NOT IN WAIT','NO HOLDER','UNKNOWN') THEN NULL ELSE blocking_session_status END
         , event
         , wait_class
         , o.owner
         , o.object_nameIt's not perfect and the numbers aren't reliable, but it gives me an idea where the time might be going. While I'm at it, v$session_longops is worth a look, so I also have 'Longops' as:
    SELECT sid
         , CASE WHEN l.time_remaining> 0 OR l.sofar < l.totalwork THEN 'Yes' END AS "Active?"
         , l.opname AS operation
         , l.totalwork || ' ' || l.units AS totalwork
         , NVL(l.target,l.target_desc) AS target
         , ROUND(100 * l.sofar/GREATEST(l.totalwork,1),1) AS "Complete %"
         , NULLIF(RTRIM(RTRIM(LTRIM(LTRIM(numtodsinterval(l.elapsed_seconds,'SECOND'),'+0'),' '),'0'),'.'),'00:00:00') AS elapsed
         , l.start_time
         , CASE
               WHEN  l.time_remaining = 0 THEN l.last_update_time
               ELSE SYSDATE + l.time_remaining/86400
           END AS est_completion
         , l.sql_id
         , l.sql_address
         , l.sql_hash_value
    FROM v$session_longops l
    WHERE :sid IN (sid,qcsid)
    AND  l.start_time >= TO_DATE(:logon_time,'DD/MM/YYYY HH24:MI:SS')
    ORDER BY l.start_time descand 'Longops this query' as:
    SELECT sid
         , CASE WHEN l.time_remaining> 0 OR l.sofar < l.totalwork THEN 'Yes' END AS "Active?"
         , l.opname AS operation
         , l.totalwork || ' ' || l.units AS totalwork
         , NVL(l.target,l.target_desc) AS target
         , ROUND(100 * l.sofar/GREATEST(l.totalwork,1),1) AS "Complete %"
         , NULLIF(RTRIM(RTRIM(LTRIM(LTRIM(numtodsinterval(l.elapsed_seconds,'SECOND'),'+0'),' '),'0'),'.'),'00:00:00') AS elapsed
         , l.start_time
         , CASE
               WHEN  l.time_remaining = 0 THEN l.last_update_time
               ELSE SYSDATE + l.time_remaining/86400
           END AS est_completion
         , l.sql_id
         , l.sql_address
         , l.sql_hash_value
    FROM v$session_longops l
    WHERE :sid IN (sid,qcsid)
    AND  l.start_time >= TO_DATE(:logon_time,'DD/MM/YYYY HH24:MI:SS')
    AND  l.sql_id = :sql_id
    ORDER BY l.start_time descYou can also get this sort of information out of OEM if you're lucky enough to have access to it - if not, ask for it!
    Apart from this type of monitoring, you might try using DBMS_PROFILER (point and click in most IDEs, but you can use it from the SQL*Plus prompt), and also instrument your code with calls to DBMS_APPLICATION_INFO.SET_CLIENT_INFO so you can easily tell from v$session which section of code is being executed.

  • A database procedure call takes a long time but user is okay with that

    Is there a way of showing to the user a progress bar type WITHOUT using javabeans to indicate the status of a database process ? I think there is a timer of some description, can anyone post sample code please.
    The user is fine that a process will can take up to 10 minutes to run. (it is a batch processing routine and involves many other procedures, etc in the database to run)
    I am running:
    Forms [32 Bit] Version 10.1.2.3.0 (Production)
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning and Data Mining options
    Oracle Toolkit Version 10.1.2.0.2 (Production)
    PL/SQL Version 10.1.0.5.0 (Production)
    Oracle Procedure Builder V10.1.2.3.0 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 10.1.2.3.0 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
    Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE     10.1.0.5.0     Production

    Create an item which width is 100%, change the visual properties to show it like a bar.
    Show it on separate window with a separate canvas.
    Create a procedure which:
    - Change the length of your bar:
    SET_ITEM_PROPERTY('<Your bar item>', WIDTH, <Width of your bar item> * <Percent of the bar to show> / 100);
    - shows the window in front
    SHOW_WINDOW('<Your window>');
    - hide the window if <Percent of the bar to show> is greater or equal 100
    HIDE_WINDOW('<Your window>');

  • .psb file will not save - "Saving 0%" hangs for a LONG time.

    Using Adobe Photoshop CC 2014. Dual 6-core xeon system running Windows 7 Ultimate x64. 32GB RAM, SSD boot drive and SSD scratch drive, with my project files on an internal 3TB 7200RPM drive.
    I have a fairly large .psb (16 bit, 12,000px wide, embedded linked smart objects, and some smaller smart objects that are 32 bit). It also contains some vector layers and many layer effects. It is fairly well optimized. The 32-bit layers are external linked files and vectors have been used to help mitigate file size.
    Last night, immediately after a restart, I set it to save and it took a while, so I went in the house and ended up falling asleep on the couch. This morning, it was still at 0%. I was able to cancel the save without issue and further optimize the file (got it down to 4.5 GB), but it still won't save or save as.
    I am able to cancel the save without issue. This happens no matter what drive I save to. All my drives are less than half full, this is a brand new machine that performs REALLY well in all other cases (Premiere/Maya).
    What are my options here? I have about an hour and a half of work that I will lose of I don't get to save this thing. That's bad - I have a tight deadline.
    EDIT: I just created a new canvas and manually dragged each layer/folder one at a time to the new document from the old. That one won't save either - it just sits at 0%. This tells me the issue is with the layers somewhere (or with Photoshop's inability to save them).
    Help!!

    Great news! Nice that command removed the bottleneck.   What percent of your ram is allocated to Photoshop?
    When you say CC, I assume CC 2014, the latest update is
    Adobe Photoshop Version: 2014.2.2 20141204.r.310 2014/12/04:23:59:59 CL 994532  x64
    10.10.2 is not without its' heartbreaks. We have fielded a lot of complaints over it and interaction with Adobe software. (mostly CS5).
    Gene

  • HT5312 My rescue email has been abandoned and deleted long time ago, and I don't remember the answers to the security questions, thus won't be receiving any resets. please advise

    I purchased a new iphone 5 S yesterday, and when i wanted to purchase one of the apps it required confirmation to the secuirity questions- which i do not remember!
    I Tried to logg in to my apple Id to receive a reset to the secuirity questions, however it is linked to an old email that no longer exist !
    Strangely I have edited my apple ID account and have deleted that old email- which no longer exist! but it seems that it is still linked to my account as a rescue email!

    You need to contact Apple. Click here, phone them, and ask for the Account Security team, or fill out and submit this form.
    (90587)

  • Find and kill "long time" blocking sessions

    Dear Experts,
    I'm looking for a way to kill sessions that are blocking for more than 5 minutes.
    I can find the blocking sessions thanks to v$lock and its block field. But how can I know when this blocking session started ?
    Best Regards,
    Guillaume

    Dear Experts,
    I'm looking for a way to kill sessions that are
    blocking for more than 5 minutes.
    I can find the blocking sessions thanks to v$lock and
    its block field. But how can I know when this
    blocking session started ?I am not sure that you are right consistent in your question
    You should not search when the blocking session started but when the blocking transaction started.
    Column logon_time in v$session gives the start time of the session.
    However what you are searching should be column start_time in v$transaction.
    SELECT t.start_time
    FROM v$transaction t, v$session s
    WHERE t.addr = s.taddr
          AND other conditions here

  • Update doing full table scan and taking long time

    Hi All,
    I am running an update statement which is doing a full table scan.
    UPDATE Database.TABLE AS T
    SET COMMENTS = CAST(CAST(COALESCE(T.COMMENTS,0) AS INTEGER) + 1 AS
    CHARACTER)
    WHERE T.TRACKINGPOINT = 'NDEL'
    AND T.REFERENCENUMBER =
    SUBSTRING(Root.XML.EE_EAI_MESSAGE.ReferenceNumber || '
    ' FROM 1 FOR 32);
    Any advice.
    Regards,
    Umair

    Mustafa,
    No Developer is writing it in his program.
    Regards,
    Umair

Maybe you are looking for

  • Green screen, downlading files and updating programs often stuck at 99%.

    Okey so I have got this problem for a 20 days, since I build my own computer. Some videos on youtube and other video stream sites bug out in the way that the video just goes green, and starts fast forwarding. Then I think streams on twitch.tv for exa

  • I'm getting an iPhoto incomplete message when I try to open my iPhoto.

    I'm now getting an error message that says, "You can't open the application iPhoto because it may be damaged or incomplete."  The icon disappeared out of Launcher, and in my Applications folder, there's a circle with a line through it over the iPhoto

  • How do I handle my Final SELECT based on a @ReportType Run Parameter

    So I have multiple CTEs in my SQL... WITH CTE_1 AS (SELECT...) CTE_2 AS (SELECT...) CTE_3 AS (SELECT...) My Final SELECT then will be based on my CTE drill-downs and the filtering will be based on the @ReportType that will be chosen within SSRS and R

  • Error with define substitution variable in SQL

    Hi there, I am using PL/SQL developer and trying to define a substitution variable as follows: define freq = 'Weekly' Then later on, in my SQL statement, I used this variable in WHERE statement as follows: WHERE ... (&freq = 'Weekly') and ... But I g

  • How do I determine the number of plots on a waveform graph?

    How do I determine the number of plots that have previously been plotted on a waveform graph? I am loading dynamic data from a file. If I convert to an array and size it and there is only one plot, I get the number of data points and I don't know how