Dbms_Parallel_Execute run as a Dbms_Scheduler job

Hi,
I have tried to use Dbms_Parallel_Execute to update a column in different tables.
This works fine when I run it from SQLPlus or similar.
But if I try to run the code as a background job using Dbms_Scheduler it hangs on the procedure Dbms_Parallel_Execute.Run_Task.
The session seems to hang forever.
If I kill the session of the background job, the task ends up in state FINISHED and the update has been completed.
If I look on the session it seems to be waiting for event "pl/sql lock timer".
Anyone who knows what can go wrong when running this code as a background job using Dbms_Scheduler?
Code example:
CREATE OR REPLACE PROCEDURE Execute_Task___ (
table_name_ IN VARCHAR2,
stmt_ IN VARCHAR2,
chunk_size_ IN NUMBER DEFAULT 10000,
parallel_level_ IN NUMBER DEFAULT 10 )
IS
task_ VARCHAR2(30) := Dbms_Parallel_Execute.Generate_Task_Name;
status_ NUMBER;
error_occurred EXCEPTION;
BEGIN
Dbms_Parallel_Execute.Create_Task(task_name => task_);
Dbms_Parallel_Execute.Create_Chunks_By_Rowid(task_name => task_,
table_owner => Fnd_Session_API.Get_App_Owner,
table_name => table_name_,
by_row => TRUE,
chunk_size => chunk_size_);
-- Example statement
-- stmt_ := 'UPDATE Test_TAB SET rowkey = sys_guid() WHERE rowkey IS NULL AND rowid BETWEEN :start_id AND :end_id';
Dbms_Parallel_Execute.Run_Task(task_name => task_,
sql_stmt => stmt_,
language_flag => Dbms_Sql.NATIVE,
parallel_level => parallel_level_);
status_ := Dbms_Parallel_Execute.Task_Status(task_);
IF (status_ IN (Dbms_Parallel_Execute.FINISHED_WITH_ERROR, Dbms_Parallel_Execute.CRASHED)) THEN
Dbms_Parallel_Execute.Resume_Task(task_);
status_ := Dbms_Parallel_Execute.Task_Status(task_);
END IF;
Dbms_Parallel_Execute.Drop_Task(task_);
EXCEPTION
WHEN OTHERS THEN
Dbms_Parallel_Execute.Drop_Task(task_);
RAISE;
END Execute_Task___;

Hi,
Check job_queue_processes parameter, it must be greater than 0.

Similar Messages

  • Dbms_scheduler job neither succeeds nor errors its just keep running for ever

    Hi All,
    I am trying to run a shell script from plsql using the dbms_scheduler, job is getting created and it keeps running for ever without success or error.
    Can some please help me where I am doing the mistake.
    Thanks
    DB Version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    Plsql Script:
    BEGIN
       DBMS_SCHEDULER.create_job (
          job_name              => 'SFTP_PAYMENTECH_BATCHID1',
          job_type              => 'EXECUTABLE',
          job_action            => '/app07/ebdev/ebdevappl/xxtpc/bin/test.sh',
          number_of_arguments   => 1,
          enabled               => FALSE,
          auto_drop             => TRUE,
          comments              => 'SFTP Batch File to Paymentech');
       DBMS_OUTPUT.put_line (
          'Job Created Successfully:' || 'SFTP PAYMENTECH BATCHID');
       fnd_file.put_line (
          fnd_file.output,
          'Job Created Successfully:' || 'SFTP PAYMENTECH BATCHID');
       COMMIT;
       DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
          job_name            => 'SFTP_PAYMENTECH_BATCHID1',
          argument_position   => 1,
          argument_value      => '66667'                        /*v_printer_name*/
       DBMS_SCHEDULER.enable (name => 'SFTP_PAYMENTECH_BATCHID1');
    EXCEPTION
       WHEN OTHERS
       THEN
          fnd_file.put_line (fnd_file.output,
                             'Error while creating the Job:' || SQLERRM);
          DBMS_OUTPUT.put_line ('Error while creating the Job:' || SQLERRM);
    END;
    Shell Script which I am calling:
    #!/usr/bin/ksh
    FILENAME=$1
    PMTHOST=198.xx.xx.xx
    PMTUSER=xxxxx
    PMTPW=xxxxx
    a='apps'
    b='xxxxxx'
    c='EBDEV'
    INST=`echo $TWO_TASK | sed 's/_BALANCE//'`
    echo INSTANCE: $INST
    echo
    File_Path=$XXTPC_TOP/iby/out
    echo File Name: $FILENAME
    echo $PMTHOST
    echo $PMTUSER
    echo
    echo Date: `date`
    echo
    echo File System User: `whoami`
    echo
    echo Instance: $TWO_TASK
    echo
    echo File_Path: $File_Path
    echo
    echo PMT SFTP
    # Fetch file using MBATCHID as File Name
    cd $File_Path
    echo
    echo -----------------------------------------------
    echo
    echo Current File          :$FILENAME
    l_date_time=`date +%Y%m%d%H%M%S`
    echo SFTP Remittance File
    # sftp $PMTUSER@$PMTHOST << EOF
    lftp -u $PMTUSER,$PMTPW sftp://$PMTHOST << EOF
    lcd $File_Path
    cd test/945299
    put $FILENAME
    exit
    EOF
    #`sqlplus -s apps/tpcdev2013@EBDEV @try.sql $FILENAME`

    Have you tried running the script manually to confirm it isnt just hanging on input for the lftp ?
    You could add a -o <file> to the lftp command line which would output debug info into <file> so you could see.
    Creation of the job looks fine so as GregV said, what output do you have in ALL_SCHEDULER_RUNNING_JOBS and any ADDITIONAL_INFO in the ALL_SCHEDULER_JOB_RUN_DETAILS or in $ORACLE_HOME/scheduler/log that might indicate what the problem is ?
    If this answer was helpful, please mark as helpful answer. 

  • "Who ran me" - how to determine the name of the dbms_scheduler job that ran me

    Hi Community
    I can see plenty of examples out on the interweb which shows how you can use dbms_utility.format_call_stack to find the hierarchy of procs, functions and packages that got me to a particular point in my code.
    For example, if proc (procedure) A calls proc B, which in turn calls proc C, in the code for proc C, I can query the call stack to find out that proc C was called by proc B which in turn was called by proc A
    However, I want to extend this further.
    For example, using the example above, if proc A in turn was started by a dbms_scheduler job, I want to determine (within proc C) the name of the dbms_scheduler job which started the whole process off.
    The reason I want to do this is that I have inherited a (massive) system which is undocumented. In many places within the code, email alerts are sent out using a custom "MAIL" package to designated users (now including me) when certain long-running processes reach certain milestones and/or complete.
    I have added to the custom "MAIL" package a trailer on the mails to show the call stack. I also want to show the name of the dbms_scheduler job which started it all.
    Over time, this info may help me in building the "map" of how the whole undocumented system hangs together and in the meantime, to assist in troubleshooting problems
    Looking forward to hearing from you
    Alan

    Use USER_SCHEDULER_RUNNING_JOBS or DBA_SCHEDULER_RUNNING_JOBS there is column SESSION_ID and when you know your session ID build query is very simple.
    select owner, job_name
    into ...
    from dba_scheduler_runnig_jobs
    where session_id=sys_context('USERENV','SESSIONID');
    You must declare local variables in PL/SQL procedure to read owner and job_name into them. Second thing, you must handle possible exception no_data_found than can be raised when procedure is not run from job.

  • Run time difference on jobs creaed prior to 11/6/2011 EST and post date.

    Hi,
    I have a DBMS_SCHEDULER job created prior to 11/6/2011 with repeat interval. After 11/6/2011(Daylight savings change) I observed the jobs are running 1hr earlier than the time specified. They don't seem to be following the current time of database. My sysdate shows correct time. How do I enforce the schedule to follow sysdate time with Daylight savings enabled.
    DBMS_SCHEDULER.create_schedule (
    schedule_name => 'SCH_Holidays',
    repeat_interval => 'FREQ=YEARLY;BYDATE=20110101,20111104,20111107;',
    comments => 'Static Holidays'
    BEGIN
    DBMS_SCHEDULER.create_job (     
    job_name => 'EMAIL_REPEAT',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN
    NULL;
    END;',
    start_date => SYSTIMESTAMP,
    repeat_interval => 'freq=DAILY; BYDAY=MON,TUE,WED,THU,FRI; BYHOUR=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20; BYMINUTE=0,15,30,45; EXCLUDE=SCH_Holidays;',
    enabled => TRUE,
    comments => 'EMAIL REPEAT JOB EVERY 15 min Starting from 2:00 till 20:00'
    END;
    select LOG_DATE,JOB_NAME from dba_scheduler_job_run_details where LOG_DATE >trunc(sysdate-3) and JOB_NAME='EMAIL_REPEAT'
    LOG_DATE JOB_NAME
    04-NOV-11 02.00.46.853302 AM -04:00 EMAIL_REPEAT
    07-NOV-11 01.00.52.908917 AM -05:00 EMAIL_REPEAT

    On our database here is the output of what patches are applied. Does any of the patches not applied contributing to this behaviour ?
    V3 (or later) Time Zone Update is applied
    V4 (or later) Time Zone Update is applied
    V6 tzdata2007f (or later) Time Zone Update is not applied
    V7 tzdata2007k (or later) Time Zone Update is not applied
    V9 tzdata2008f (or later) Time Zone Update is not applied
    V10 tzdata2008i (or later) Time Zone Update is not applied
    V11 tzdata2009g (or later) Time Zone Update is not applied
    V13 tzdata2009s (or later) Time Zone Update is not applied
    V14 tzdata2010i (or later) Time Zone Update is not applied
    V15 tzdata2010o (or later) Time Zone Update is not applied
    V16 tzdata2011g (or later) Time Zone Update is not applied

  • Query to get script for dbms_scheduler jobs

    Hi,
    I created 3 dbms_scheduler jobs on customer DB earlier. Now with the latest version of Toad they have, when I try to describe these jobs it gives me an error saying ADMIN MODULE REQUIRED to describe such objects.
    I contacted Toad for the same and they asked the customer to purchase ADMIN MODULE which th customer is not willing.
    My problem is that I need the scipts of each of these DBMS_SCHEDULER jobs and programs, However I am not able to locate a DATA DICTIONARY that would store the source for each of them like we have for PROCEDURES etc USER_SOURCE data dictionary.
    Is anyone aware of any such Data Dictionary or has a quey though which I can retrive Scheduler Jobs and Programs scripts.
    Please Help.

    Ok got it :)
    To show details on job run:
    select log_date
    , job_name
    , status
    , req_start_date
    , actual_start_date
    , run_duration
    from dba_scheduler_job_run_details;
    To show running jobs:
    select job_name
    , session_id
    , running_instance
    , elapsed_time
    , cpu_used
    from dba_scheduler_running_jobs;
    To show job history:
    select log_date
    , job_name
    , status
    from dba_scheduler_job_log;
    show all schedules:
    select schedule_name, schedule_type, start_date, repeat_interval
    from dba_scheduler_schedules;
    show all jobs and their attributes:
    select *
    from dba_scheduler_jobs;
    show all program-objects and their attributes
    select *
    from dba_scheduler_programs;
    show all program-arguments:
    select *
    from dba_scheduler_program_args;
    Thanks

  • Procedure doesn't work in a DBMS_SCHEDULER job

    I have a problem with an dbms_scheduler job.
    We have a procedure with a select and the follwing where clause
    and tb.geaendert_am >= systimestamp - interval '5' minute;
    The column tb.geaendert_am is a timestamp column and means changed_on.
    That procedure we call in a dbms_scheduler job, which runs every 5 minutes.
    What we want is to collect all rows which are new since last job run.
    Now happens following
    The job run and collect all rows, also row alter than 5 Minute.
    On every run the procedure collect all old and new rows.
    When we run the procedure manually, also the single select, we get the correct collection of all rows which are new since last job run.
    Have anyone a idea?
    I now the where clause is not perfect and we have some more inconsistency.
    (At the first run we don't get all rows which older than 5 minutes before systimestamp)
    In the moment we discuss if it make more since to mark the rows which we have collected.
    But that is not the question, the question is why a soure manually works well
    and when it runs in the Job we have a wrongness.
    Thanks in advanced.
    Regards
    Michael

    Hi Sven
    thanks for answering.
    I told you what is wrong ;-)
    My select with the where "systimestamp - interval '5' minute" clause runing well.Every time I get only new rows
    That select is implemented in a procedure. Starting the procedure from sqlplus or sqldeveloper, the select running well.I get only new rows.
    But when it would be started by dbms_scheduler we get everytime all rows, the old, also the new rows.
    When I start the Procedure shortly after the job or parallel to the job my select shows only the new rows which are not older than 5 Minutes
    Conclusion, when the procedure would be startet by the job we get to much rows.
    The difference is, one runs on the database server, one runs on an client.
    I have considered also to mark the data set with select for update. But I see following issues.
    1) The job is for an monitoring tool, that tool would be not discrete anymore.
    2) What happen in a case with an error, "for update of" lock only a new column which I add to mark the rows.
    Perhaps I get a impact in the application that it must not happen. The application is very time sensitive.
    3) What is with the transaction, my procedure must be anonymous.
    It is shure that we get no effect in application?
    Our java application communicate with a lot of other application, partly java aplication, partly Oracle BPEL applications.
    So our monitoring tool should not interrupt the sensitive chain.
    Regards,
    Michael
    Edited by: MichaelMerkel on 11.03.2011 02:15

  • How Can I Run a SQL Loader Job from Schedular

    How Can I Run a SQL Loader Job from Schedular , So that It Runs every Day.

    Depends on a couple of factors.
    If you are on a UNIX platform, you can create a shell script and schedule it with cron.
    If you are on a Windows platform, you can create a batch file and schedule it with the Windows scheduler.
    Or, if you are on Oracle 9i or 10g, you could use the external table feature instead of SQL*Loader. Then you could write a stored procedure to process the external table and schedule it using the Oracle scheduler (DBMS_JOB). This would probably be my preference.

  • Exclude DBMS_SCHEDULER jobs in DATA PUMP import

    Hello,
    I need to exclude all DBMS_SCHEDULER jobs during DATA PUMP import.
    I tried to do this with: EXCLUDE=JOB but this only works on DBMS_JOB.
    Is there a way to exclude all DBMS_SCHEDULER jobs during import?
    Kind Regards

    There are PROCOBJ that can be excluded (Procedural objects in the selected schemas) but I'm affraid it exclude not only DBMS_SCHEDULER jobs.
    Any ideas?

  • Can the standard program RFBIBL00 be run as a background job ?

    Hi all,
    Can the standard program RFBIBL00 be run as a background job for the call transaction mode.
    As I tried I got the job cancelled with message"Job RFBIBL00: Data does not match the job definition; job terminated".
    As i run it in foreground it executes properly.
    Why is it failing in background? Please help.
    Thanks ,
    Stock

    Hi,
    You need to copy the program RFBIBL00 & modify the program to build the logic to upload through application server. Then schedule the modified program in background & it wl work.
    Best regards,
    Prashatn

  • "BBP_SC_TRANSFER_GROUPED" to run as a scheduled job

    Hi,
            I need to make the program BBP_SC_TRANSFER_GROUPED, run as a scheduled job. please guide me the steps to do that. Thanks in advance.

    Hi Krishna Vardhan,
    You can schedule this report using SA38txn.
    Input the report name and click on Background tab on the menu bar and in the next screen click on Variants tab on the menu bar and in the next screen click on create tab next to the variant field and create a variant.
    Enter the criteria for the variant and click on attributes and enter the short description for variant and also choose the preferences for various attributes and clcik the save icon to save the variant.
    Then goto SA38 txn again and input the report name and clcik on the with variant tab on the menu bar and click background tab and enter the required variant name in the next screen and click on Schedule tab and schedule the job periodically based on your requirement.
    Hope this makes you more clear and helps in resolving your issue. Clarifications are welcome.
    Award points for helpful answers.
    Rgds,
    Teja

  • DDL for DBMS_SCHEDULER job

    How do I generate the DDL for an existing DBMS_SCHEDULER job? I've tried using DBMS_METADATA.GET_DDL, but that doesn't seem to work with the scheduler jobs.

    Susan's method is probably the best.
    Another slightly more clunky way is to export the user's schema (using expdp) and then use impdp with the SQLFILE option, so the generated file will then contain the DDL to create the job.
    Note than none of these methods will work if you have set non-varchar2 (i.e. object) argument values for the job.
    Hope this helps,
    Ravi.

  • Running a SQL Loaded Job from Schedular

    How Can I Run a SQL Loader Job from Schedular ,
    Message was edited by:
    jus

    The trick is to create a wrapper script that is referred to by the PROGRAM object with arguments. The wrapper should do the work.
    /usr/local/bin/do_sqlldr.sh:
    #!/usr/bin/env ksh
    # setup actions
    sqlldr control=...
    Don't forget to check who is the owner of $ORACLE_HOME/bin/extjob and that the owner is available.
    My question is how this can be fitted in an DTAP environment where Developement and Test environment are on the same server and have the same job definitions. Development and Test should use different datafile and logfile locations.
    regards,
    Ronald
    http://ronr.nl/unix-dba

  • Error message when trying to run check device credential job

    unable to run check device credintial job. says to check cda.log:

    You're seeing CSCte49301.
    Symptom:
    The EssentialsDM daemon hangs in a Waiting to initialize state (as seen in the output of the pdshow command).  Additionally, one might see "Error connecting to JRM" in Resource Manager Essentials applications.
    Conditions:
    This occurs on Windows servers after the patch for KB968930 is installed, and only if the Windows Remote Management service was started prior to starting CiscoWorks Daemon Manager.
    Workaround:
    Shutdown CiscoWorks Daemon Manager with the following command from the server's command prompt:
    net stop crmdmgtd
    Delete the following two files:
    NMSROOT\MDC\tomcat\webapps\rme\WEB-INF\lib\ctmregistry
    NMSROOT\MDC\tomcat\webapps\rme\WEB-INF\lib\ctmregistry.backup
    Restart CiscoWorks Daemon Manager with the following command:
    net start crmdmgtd
    If that does not work, then the Windows Remote Management service must be stopped, and disabled.  Then, CiscoWorks Daemon Manager must be restarted.

  • Cron job : how to run scripts as cron job

    Hi friend,
    Sorry one very small question ..
    Can someone tell me how can i run scripts as cron job .. on HP UX.
    thanks
    ashish

    Hi Ashish,
    open one telnet session.
    crontab -e
    then give the periodicity day and time
    like below
    05 00 * * 1-6  /usr/local/bin/database_backup.sh
    and now create the script file with the command or script to execute.
    Regards
    Ashok Dalai

  • How to run backup to tape job manually without schedule

    Hi,
    I have a DPM 2012 backup server.i want to run backup to tape job manually without schedule.
    pl... explain me
    Thanks,
    Gayan

    Hi, you can restor a datasoruce to Tape or do a Recoverypoint with Destination to tape.
    Seidl Michael | http://www.techguy.at |
    twitter.com/techguyat | facebook.com/techguyat

Maybe you are looking for

  • Print issue after Yosemite upgrade

    Mac Book Pro 15-inch 2.5GHz quad-core Intel Core i7 Turbo Boost up to 3.7GHz 16GB 1600MHz memory 512GB PCIe-based flash storage 1 Intel Iris Pro Graphics NVIDIA GeForce GT 750M with 2GB GDDR5 memory I am not able to Print after upgrade to Yosemite. I

  • Can't remove Gimp drivers to install new Epson driver

    I just bought a new Photo printer (Epson Stylus Photo R1800.) I go to add the printer in the Printer Setup Utility click Add (The printer appears in the Printer Browser) I select it; Then it wants me to select the driver from the list in the "Print U

  • Downloaded latest update now pages that worked before result in firefox not responding why

    latest update 16.0.1 speedtest.net not loading causes firefox to stop and not respond firefox not always loading first time sometimes takes 2/3 attempts none of these problems before latest update why?

  • How to transfer External Applications Information

    WE HAVE SEVERAL INSTANCES OF PORTAL+LOGIN SERVER, ONE PER COMPANY. IS IT POSSIBLE SOMEHOW TO EXPORT/IMPORT THE DIFFERENT EXTERNAL APPLICATIONS WE CREATED IN ONE OF THE PORTAL TO THE OTHERS? OR DO WE HAVE TO CREATE THEM IN EACH ONE MANUALLY? TKS!!

  • Why are images desaturated?

    I've struggled with this problem off an on for years, never truly understanding what fixed or caused the problem. I work on a MAC OSX and use Lightroom 4 and Photoshop CS4 exclusively.  In the past, I was told the issue was my color profile, and I've