SYS. DBMS_SCHEDULER. CREATE_JOB

I have written following code, I think I know that this will run ipcards.ipcards_data procedure daily at 12:40:35 if I am not correct then what else is necessary.

BEGIN

SYS. DBMS_SCHEDULER. DROP_JOB

(job_name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA');

END;

/



BEGIN

SYS. DBMS_SCHEDULER. CREATE_JOB

(

job_name = > ' IPCARDS. AVAILABLE_IP_CARDS_DATA'

, start_date = > TO_TIMESTAMP_TZ ('12:40:35.000000 21/01/2020 + 05:00 ',' yyyy/mm/dd hh24:mi:ss.ff tzh:tzm')

", repeat_interval = > ' FREQ = DAILY"

, end_date = > NULL

, job_class = > 'DEFAULT_JOB_CLASS '.

, job_type = > 'PLSQL_BLOCK '.

, job_action = > ' BEGIN ipcards.ipcards_data; END; '

, comments = > NULL

);

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

, attribute = > 'RESTARTABLE.

value = > FALSE);

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

, attribute = > 'LOGGING_LEVEL.

, value = > SYS. DBMS_SCHEDULER. LOGGING_OFF);

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE_NULL

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

attribute = > 'MAX_FAILURES');

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE_NULL

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

attribute = > 'MAX_RUNS');

BEGIN

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

, attribute = > 'STOP_ON_WINDOW_CLOSE '.

value = > FALSE);

EXCEPTION

-can fail if the program is EXECUTABLE type...

WHILE OTHERS THEN

NULL;

END;

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

, attribute = > 'JOB_PRIORITY '.

value = > 3);

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE_NULL

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

attribute = > 'SCHEDULE_LIMIT');

SYS. DBMS_SCHEDULER. SET_ATTRIBUTE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA'

, attribute = > 'AUTO_DROP '.

value = > TRUE);



SYS. DBMS_SCHEDULER. ENABLE

(name = > ' IPCARDS.) AVAILABLE_IP_CARDS_DATA');

END;

/

Seems to be correct, should start each day at 12:40:35 (zone + 05.00) from January 21, 2020. It takes 10 years to know if is correct or not ;)

Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

Tags: Database

Similar Questions

  • dbms_scheduler.create_job

    Hello
    I have a stored procedure in the scheme of mauser.
    and grant execute this DS to ERPUSER,
    When connect you to oracle in sqlplus with ERPUSER (no mauser) a runtime error see the
    Help, please.


    Start
    dbms_scheduler.create_job
    (
    job_name = > 'Send_Data_To_HR_Tables ',.
    schedule_name = > "EVERY_4_MINS"
    job_type = > 'procedure_stockee ',.
    job_action = > ' MAUSER. SENDDATATOHRTABLES',.
    enabled = > true,
    Comments = > 'send my tabales data to HR tables. "
    );
    end;

    "ORA-27481: ' ERPUSER. SEND_DATA_TO_HR_TABLES' has an invalid schedule
    "ORA-27476: ' ERPUSER. EVERY_4_MINS' does not exist
    ORA-06512: at "SYS." DBMS_ISCHED", line 99
    ORA-06512: at "SYS." DBMS_SCHEDULER', line 348
    ORA-06512: at line 3 level



    Thank you and best regards
    allahmorad

    Try using schedule_name or repeat_interval settings but not both:

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL>
    SQL> show user;
    USER is "SCOTT"
    SQL>
    SQL> create procedure p
      2  as
      3  begin
      4  insert into times values(sysdate);
      5  end;
      6  /
    
    Procedure created.
    
    SQL> show errors
    No errors.
    SQL>
    SQL> begin
      2  dbms_scheduler.create_schedule(
      3  schedule_name => 'every_4_mn',
      4  start_date => systimestamp,
      5  repeat_interval => 'freq=minutely;interval=4');
      6  --
      7  dbms_scheduler.create_job(
      8  job_name => 'savedate',
      9  schedule_name => 'every_4_mn',
     10  job_type => 'stored_procedure',
     11  job_action => 'scott.p',
     12  enabled=>true,
     13  auto_drop=>false);
     14  end;
     15  /
    
    PL/SQL procedure successfully completed.
    

    Wait a while and check:

    SQL> select sysdate from dual;
    
    SYSDATE
    ---------------
    05-JUL 19:18:34
    
    SQL> /
    
    SYSDATE
    ---------------
    05-JUL 19:18:57
    
    SQL> select * from times;
    
    C1
    ---------------
    05-JUL 19:19:00
    05-JUL 19:15:00
    

    Edited by: P. Forstmann on 5 Jul. 2010 19:19

  • Put Repeat_interval in place in dbms_scheduler.create_job

    Gurus,
    I need to set up a job to run 4 times per year (1st of JAN, APR, Jul-OCT to 09:00).
    I tried the following code and received the error of invalid values for repeat_interval. Please help me solve this problem.

    dbms_scheduler.create_job (job_name = > "PROCESS_JOB")
    job_type = > 'procedure_stockee ',.
    job_action = > 'SNAP_PROC ',.
    start_date = > trunc (sysdate) + 9/24.
    repeat_interval = > ' FREQ = MONTHLY; INFECTION IS JAN, APRIL, JULY-OCT.; BYDAY = 1; BYHOUR = 9',
    End_date = > null,
    activated = > false,
    auto_drop = > false,
    Comments = > ' snapshot process);
    --
    Anan

    If you want the 1st day of the month, use BYMONTHDAY = 1 instead of BYDAY = 1

    Kind regards
    Bob

    Take a look at the response of Centinul to {message: id = 9352583} for an example of the use of the DBMS_SCHEDULE. Procedure EVALUATE_CALENDAR_STRING.

    Published by: BobLilly on May 22, 2012 17:08

  • dbms_scheduler.create_job and create_program to run the shell program

    dbms_scheduler.create_job and create_program to run the shell UNIX of PL/SQL program

    I guess that the problem could be a shell program. "send_file_susin.sh", I did run the CFT program which is to transfer files. While I tried to this problem, I heard that I should use dbms_scheduler.create_program and create_job to execute the shell command. Therefore,.

    I've done
    () dbms_scheduler.create_program
    program name = > "SEND_FILE_SUSIN"
    program_type = > "EXECUTABLE."
    program_action = > ' / fsoracle/app/oracle/inst2/if_cft/send_file_susin.sh',
    number_of_arguments = > 0,
    enabled = > TRUE,
    Comments = > 'Test '.
    );
    commit;
    in a package, then I run the package.
    program and job

    DBMS_SCHEDULER exec. () CREATE_JOB
    job_name = > 'run_sh1 ',.
    program name = > "send_file_susin"
    start_date = > sysdate + 1/2880.
    repeat_interval = > null,
    End_date = > null,
    job_class = > 'DEFAULT_JOB_CLASS ',.
    enabled = > true
    )

    When I ran, I would check there program and job send_file_susin in the sched.programs and sched.job classes. The job will run about 30 seconds later.
    After 30 seconds, I saw the work was done, but I couldn't see the log of the CFT program. This means that the file have not been transferred...

    I don't know what is wrong with it... Please, someone that solve?
    Thank you very much in advance.

    Hello

    You don't have to create a program first, put directly in the work should work as well.

    Your pl/sql code is correct, then you should check out a few things with the shell script

    -is set + rx
    -is the first line #! / bin/sh
    -should I use the full path to the executable files for example/usr/bin/ftp
    -It defines the variables

    If that all seems well, consider adding lines of logging to your shell script to debug what goes wrong.

    See this post for more tips

    Guide to the external work on with dbms_scheduler 10g for example scripts, batch files

    Any other questions about the Scheduler, you can use the forum Planner here

    Planner

    Hope this helps,
    Ravi.

  • a problem using dbms_scheduler.create_job. I can't do the work

    I do work to run sh program with 5 arguments, even if I put the time, work does not work...
    Please tell me, why it does not work...-. -;

    I write the source for jobs below...

    exec (dbms_scheduler.create_job)
    job_name = > 'run_sh ',.
    job_type = > 'EXECUTABLE. "
    job_action = > ' /fsoracle/app/oracle/inst2/if_cft/test.sh ZADA/fsoracle/app/oracle/product/rdbms/log/KFG. DD SHRCOM. HR DIRECTOR. A03 KFG. DD SHRCOM. HR DIRECTOR. A03 25 25',
    start_date = > sysdate + 1/1440
    );

    Hello

    You don't have to create a program first, put directly in the work should work as well.

    Your pl/sql code is correct, then you should check out a few things with the shell script

    -is set + rx
    -is the first line #! / bin/sh
    -should I use the full path to the executable files for example/usr/bin/ftp
    -It defines the variables

    If that all seems well, consider adding lines of logging to your shell script to debug what goes wrong.

    See this post for more tips

    Guide to the external work on with dbms_scheduler 10g for example scripts, batch files

    Any other questions about the Scheduler, you can use the forum Planner here

    Planner

    Hope this helps,
    Ravi.

  • Error with dbms_scheduler.create_job

    Hi all

    I am trying to run CREATE_JOB, get the error below.
    I gess I have specified the valid month, but could not solve the problem. What could be the error?
       SQL> BEGIN
      2      dbms_scheduler.create_job(
      3              job_name => 'DEMO_STUDENT_TOT',
      4              job_type => 'PLSQL_BLOCK',
      5              job_action => 'begin student_sum; end; ',
      6              start_date => '7/14/2009 7:40 AM',
      7              repeat_interval => 'FREQ=DAILY',
      8              enabled => TRUE,
      9              comments => 'Demo for job schedule.');
     10  END;
     11  /
    BEGIN
    *
    ERROR at line 1:
    ORA-01843: not a valid month
    ORA-06512: at line 2
       
    Thank you

    Refer to the documentation: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#i1000363

    You have:

    start_date => '7/14/2009 7:40 AM',
    

    but the documentation says start_date is a timestamp.

    You must use to_timestamp()...

  • planning using the tasks dbms_scheduler.create_job

    Hi all experts,

    I am really grateful to now take you for your replies, a look at this, I created a job with 'dbms_scheduler.create_job' and blow is the result of the view 'dba_schduler_jobs' why it shows "0" run_count... I went through everything as many links like:

    Answers to "why my jobs are not running?

    and applied and checked all the settings, I use oracle 10.2.0.1.0 on windows server 2003 32-bit
    SQL> BEGIN
         DBMS_SCHEDULER.CREATE_JOB (
             job_name => 'clouser'
            ,job_type => 'PLSQL_BLOCK'
         ,job_action => 'begin package.procedure("po_closure"); end;'
         ,start_date => to_date('17-04-2009 22:00:00', 'dd-mm-yyyy hh24:mi:ss')
         ,repeat_interval => 'FREQ=DAILY;byminute=10'
         ,enabled => TRUE
         ,comments => 'op closure everyday at 11PM'
    );
    END;
    / 
    PL/SQL procedure successfully completed.
     
    SQL> select owner,job_name name,run_count run,start_date
      2  from dba_scheduler_jobs
      3  where owner='FINANCEDEV';
     
    OWNER                          NAME                                  RUN
    ------------------------------ ------------------------------ ----------
    START_DATE
    ---------------------------------------------------------------------------
    FINANCEDEV                     CLOUSER                                 0
    17-APR-09 02.45.10.000000 PM +05:30
     
    FINANCEDEV                     CLOUSER_MAIN                            0
    18-APR-09 10.25.00.000000 AM +05:30
     
    FINANCEDEV                     CLOUSER_MAIN1                           0
    18-APR-09 10.45.00.000000 AM +05:30
     
     
    OWNER                          NAME                                  RUN
    ------------------------------ ------------------------------ ----------
    START_DATE
    ---------------------------------------------------------------------------
    FINANCEDEV                     CLOUSER_MAIN4                           0
    18-APR-09 10.45.00.000000 AM +05:30
     
    FINANCEDEV                     CLOUSER_MAIN5                           0
    18-APR-09 10.43.00.000000 AM +05:30
    the time I planned has already passed and I check it again and again, but no luck, can you please explain why is it so?

    Thanks in advance

    Thanks and greetings
    VD

    Published by: vikrant dixit on April 17, 2009 22:33

    Vikrant,

    You must set your procedure or package that you call job_action and see why it's a failure. Make sure that you can perform your procedure with no problems

    Using the suite perform your procedure and see if it ends correctly and if not solve the problem and use job I posted in my previous post.

    declare
    begin
       input_value varchar2(...) := 'some value';
       schema_name.package_name.procedure_name(input_value);
    end;
    

    Hope helps thie
    Concerning

  • repeat_interval in DBMS_SCHEDULER.create_job - for the 2nd day of each month

    Hi all

    I want to clarify in the repeat_interval the Scheduler for this task must be run on the second of each month at 20:00.
    I've been racking my brains out but nothings coming out.

    Any suggestions?

    You probably want a range like this:

    FREQ=MONTHLY;BYMONTHDAY=2;BYHOUR=20;BYMINUTE=0;BYSECOND=0;
    

    You can use the DBMS_SCHEDULER. EVALUATE_CALENDAR_STRING function to test, as follows:

    SQL > DECLARE
      2  start_date        TIMESTAMP;
      3  return_date_after TIMESTAMP;
      4  next_run_date     TIMESTAMP;
      5  BEGIN
      6  start_date :=
      7    to_timestamp_tz('01-JAN-2003 10:00:00','DD-MON-YYYY HH24:MI:SS');
      8  return_date_after := start_date;
      9  FOR i IN 1..5 LOOP
     10    DBMS_SCHEDULER.EVALUATE_CALENDAR_STRING(
     11      'FREQ=MONTHLY;BYMONTHDAY=2;BYHOUR=20;BYMINUTE=0;BYSECOND=0;',
     12      start_date, return_date_after, next_run_date);
     13  DBMS_OUTPUT.PUT_LINE('next_run_date: ' || next_run_date);
     14  return_date_after := next_run_date;
     15  END LOOP;
     16  END;
     17  /
    next_run_date: 01/02/2003 08:00:00.000000 PM
    next_run_date: 02/02/2003 08:00:00.000000 PM
    next_run_date: 03/02/2003 08:00:00.000000 PM
    next_run_date: 04/02/2003 08:00:00.000000 PM
    next_run_date: 05/02/2003 08:00:00.000000 PM
    
  • Planner linking not post other than the user sys

    Hello

    The below mentioned job scheduler works successfully from the SYS user, but fails in the attempt of another user.

    Start
    SYS. DBMS_SCHEDULER. () CREATE_JOB
    job_name = > 'RUN_DDL_JOB ',.
    start_date = > SYSDATE,.
    repeat_interval = > NULL,
    End_date = > NULL,
    job_class = > 'DEFAULT_JOB_CLASS ',.
    job_type = > 'EXECUTABLE. "
    job_action = > "c:\windows\system32\cmd.exe /c C:\Anjan\run_ddl.bat > C:\Anjan\run_ddl.log',"
    auto_drop = > TRUE,
    enabled = > TRUE);
    end;


    In the User_Scheduler_Job_Run_Details table, error message below is,.
    ORA-27370: slave to the job could not launch an EXECUTABLE type work
    ORA-27300: dependent operation of the OS: access enforcement officer failed with the State: 2
    ORA-27301: OS Error Message: the system cannot find the specified file.
    ORA-27302: an error occurred in: 6a sjsec
    ORA-27303: additional information: the system cannot find the specified file.


    I found below thread similar to the problem, but no solution found.
    Re: executable dbms_scheduler errors


    I use Oracle 10.2.0.1.

    Thank you
    Anjan

    You can create the position of OEM Planner (Business Manager)

    Logged in as SYS to EM
    On the Administration tab > Scheduler option > link jobs

    Then create the job, you will find the OWNER under the NAME field, create the work by providing appropriate parameter values.

    Take a look at this below

    BEGIN
    () sys.dbms_scheduler.create_job
    job_name => ""ADMIN"". "" TEST_JOB' '.
    job_type-online "PLSQL_BLOCK."
    job_action => ' begin
    -Insert here the PL/SQL code
    end;',
    start_date-online systimestamp to the time zone '+ 6:00 ',
    job_class-online "DEFAULT_JOB_CLASS."
    observations-online "test job"
    auto_drop => FALSE,
    enabled-online TRUE);
    END;

    In your scenario that should be: job_name => ' 'your_USER. RUN_DDL_JOB"", "
    change the prefix of your code, the i.e:user_name of schema name that you want to run the task

    This problem is related with the privileges on the work of the Planner, when your job owner is SYS, and if the user HR has no privilege to run the created SYSTEM of jobs, he is unable to perform this work as HR.
    by creating employment by above way you actually create work for your user name and give him the privilege to run.

    You should look at these privileges below

    JOB SCHEDULER OBJECTS: The following privileges are necessary to perform procedures in the DBMS_SCHEDULER package.
    CREATE JOB to create jobs, schedules and programs in the scheme of the dealer
    CREATE ANY JOB create, modify or delete jobs, schedules and programs in any schema
    Note: This extremely powerful privilege allows the recipient to run code as any other user. She should be granted with caution.

    RUN ANY PROGRAM use any program in a job in the scheme of the dealer
    EXECUTE ANY CLASS specify no job in a job class in the schema of the dealer
    SCHEDULER to MANAGE create, modify or delete no matter what group of class, window or work

    Published by: adnanKaysar on April 12, 2010 17:16

  • Conclusion running info JOBS

    Hellou,

    Please can someone tell me what is the problem?

    My appeal JOB_TEST_PREPROCESS jobs program and this program in this procedure call procedure, I call this:

    SELECT rj.log_id IN the dba_scheduler_running_jobs rj l_job_log_id
    WHERE rj.job_name = i_job_name
    AND rj.owner = i_job_owner;

    When I run the present:

    BEGIN

    dbms_scheduler.drop_job ('JOB_TEST_PREPROCESS');

    sys.dbms_scheduler.create_job (job_name = > 'JOB_TEST_PREPROCESS',)

    program name = > "PROG_TEST_PREPROCESS"

    = start_date > to_date (null).

    repeat_interval = > ",

    End_date = > to_date (null).

    job_class = > 'DEFAULT_JOB_CLASS ',.

    enabled = > TRUE,

    auto_drop = > false,

    Comments = > ");

    end;

    > > then it will find me my current JOB and everything is OK

    but when I run the present:

    BEGIN

    dbms_scheduler.run_job ('JOB_TEST_PREPROCESS');

    END;

    then my procedure always fail on NO_DATA_FOUN (select isn't running the task because it is not in the dba_scheduler_running_jobs)

    What is the problem.

    Thank you

    Moreover, I even filed a bug for this issue:

    Bug 19185117 : USER_SCHEDULER_RUNNING_JOBS EMPTY IF WORK IS PERFORMED BY RUN_JOB WITH USE_CURRENT_SESSION set to TRUE

    It led to a correction of documentation, but only in 12 c:

    http://docs.Oracle.com/database/121/ARPLS/d_sched.htm#ARPLS72396

    Using of RUN_JOB with use_current_session =TRUE does not update the status of the job and the work does not appear in *_SCHEDULER_RUNNING_JOBS views.

  • Error while trying to run oracle shell

    With the help of 11g

    Shell script

    #! / bin/bash

    Claire

    echo "testing123.

    named transfer2.sh (it's just a shell script test will be real scp a file to a remote server, but I can not even this one to work first).

    I can't run no problem under linux

    > sh transfer2.sh

    testing123

    I want to be able to schedule this to run from oracle.

    my tests so far:

    BEGIN

    DBMS_SCHEDULER. () CREATE_JOB

    job_name = > 'TEST_SHELL ',.

    JOB_TYPE = > 'EXECUTABLE. "

    job_action = > ' / myfiles/transfer2.sh '.

    start_date = > SYSDATE,.

    REPEAT_INTERVAL = > 'FREQ = HOURLY;',

    activated = > FALSE,

    Comments = > 'shell script to Oracle.

    );

    end;

    /

    now to run the task

    BEGIN

    dbms_scheduler.run_job ('TEST_SHELL', true);

    end;

    /

    Error from line 43 in order:

    BEGIN

    dbms_scheduler.run_job ('TEST_SHELL', true);

    end;

    Error report:

    ORA-27369: jobs of type EXECUTABLE failed with exit code: 255

    ORA-06512: at "SYS." DBMS_ISCHED", line 185

    ORA-06512: at "SYS." DBMS_SCHEDULER", line 486

    ORA-06512: at line 2

    27369 00000 - "type EXECUTABLE job failed with exit code: %s."

    * Cause: A problem arose when running EXECUTABLE type work.

    The cause of the problem is identified by the exit code.

    * Action: Correct the cause of the code output and the reporter at work.

    I put the myfiles directory to 0777

    I put all the files in the myfiles directory to 0777

    so everyone should have access to run scripts here.

    I also put the extjob file to 0777

    any help appreciated.

    Thank you.

    Hello

    The error you see is because the work is a failure. If you're on 11g, try using a credential to perform the task or check the post below a guide to perform the work on 10g

    Re: Guide to the external work on with dbms_scheduler 10g for example scripts, batch fi

    For example:

    BEGIN

    () sys.dbms_scheduler.create_job

    job_name => ' 'SYS '. ' ' MYJOB1 ' ',

    job_type-online "EXECUTABLE."

    job_action => "/ usr/bin/bash"

    start_date-online systimestamp zone ' Asia/Baku. "

    job_class-online "DEFAULT_JOB_CLASS."

    auto_drop => FALSE,

    number_of_arguments-online 1

    enabled-online FALSE);

    sys.dbms_scheduler.set_job_argument_value (=> of job_name ' "SYS".) "MYJOB1" (', argument_position-online 1, argument_value => ' / u01/app/ora10g/test1.sh');

    sys.dbms_scheduler. Enable (' "SYS".) ("' MYJOB1" ');

    END;

  • WORK on a specific node

    Is it possible to run a scheduled task to run on a specific node.
    BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB_CLASS
        (
          job_class_name          => 'TEST'
         ,resource_consumer_group => 'DEFAULT_CONSUMER_GROUP'
         ,service                 => 'ORCL'
         ,log_history             => 30
         ,comments                => NULL
        );
    END;
    / 
    

    ORCL must exist:

    SELECT NAME FROM DBA_SERVICES:
    NAME
    ----------------
    SYS$BACKGROUND
    SYS$USERS
    ORCLXDB
    ORCL                                                            
    
    BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB
        (
           job_name        => 'SYS.TEST_JOB'
          ,start_date      => TO_TIMESTAMP_TZ('sysdate','yyyy/mm/dd hh24:mi:ss.ff tzr')
          ,repeat_interval => NULL
          ,end_date        => NULL
          ,job_class       => 'TEST'
          ,job_type        => 'PLSQL_BLOCK'
          ,job_action      => 'begin null; end;'
          ,comments        => NULL
        );
    /
    
  • Having trouble getting a job to run using Task Scheduler

    I'm using Oracle 11 g. I run a sql script that schedules a task:
    exec sys.dbms_scheduler.create_job( job_name => '"SYSTEM"."UCR"', job_type => 'EXECUTABLE', job_action => 'D:\UserCountReport\bin\ucr.bat', repeat_interval => 'FREQ=HOURLY;BYHOUR=3;BYMINUTE=0;BYSECOND=0',start_date => to_timestamp_tz('2011-07-21 US/Eastern', 'YYYY-MM-DD TZR'), job_class => 'DEFAULT_JOB_CLASS', auto_drop => FALSE,enabled => FALSE);
    exec sys.dbms_scheduler.set_attribute( name => '"SYSTEM"."UCR"',  attribute => 'job_weight',  value => 1);
    exec sys.dbms_scheduler.enable( '"SYSTEM"."UCR"' );
    commit;
    exit;
    When I am connected to the database, I run these commands:
    SQL> SELECT JOB_NAME, STATE, job_action, repeat_interval FROM DBA_SCHEDULER_JOBS
     where job_name='UCR';
    
    JOB_NAME
    --------------------------------------------------------------------------------
    
    STATE
    ---------------------------------------------
    JOB_ACTION
    --------------------------------------------------------------------------------
    
    REPEAT_INTERVAL
    --------------------------------------------------------------------------------
    
    UCR
    SCHEDULED
    C:\UserCountReport\bin\ucr.bat
    FREQ=HOURLY;BYHOUR=9;BYMINUTE=0;BYSECOND=0
    
    
    SQL> SELECT JOB_NAME, status FROM DBA_SCHEDULER_JOB_LOG where job_name = 'UCR';
    
    JOB_NAME
    --------------------------------------------------------------------------------
    
    STATUS
    --------------------------------------------------------------------------------
    
    UCR
    SUCCEEDED
    
    UCR
    SUCCEEDED
    
    UCR
    SUCCEEDED
    However, I get no sign that the work was performed while Oracle said that all tracks have managed. The batch file that work is supposed to run creates a file and wrote something to him. However, the file is not written. When I run the command prompt batch file, it runs correctly.

    I tried following the instructions here:
    Answers to "why my jobs are not running?

    However, all three of these commands return errors:
    SQL> select value from v$parameter where name='job_queue_processes';
    select value from v$parameter where name='job_queue_processes'
                      *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    SQL> select count(*) from dba_scheduler_running_jobs;
    select count(*) from dba_scheduler_running_jobs
                         *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    SQL> select count(*) from dba_jobs_running;
    select count(*) from dba_jobs_running
                         *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    I tried several other commands in this list and I get errors as well.

    I'm not quite sure where to go here to solve this problem. Any help would be appreciated. Thank you.

    Published by: 874375 on July 22, 2011 09:14

    Published by: 874375 on July 22, 2011 09:18

    See the DBA_SCHEDULER_JOB_LOG view ADDITIONAL_INFO column.

    You can also read my post. You will need to provide the cmd.exe to the JOB_ACTION parameter, but the name of the script and other command line parameters (like "/ C") should be added as arguments.

    At least that's how I ran with it successfully in the past.

  • Task Scheduler does not run

    I'm having a problem using more job, I could not solve for now, need, you are your help...
    BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB
        (
           job_name        => 'CBAINFO.INTRANET_REPORTING_TABLES'
          ,start_date      => TO_TIMESTAMP_TZ('2011/03/18 10:42:30.000000 +05:00','yyyy/mm/dd hh24:mi:ss.ff tzh:tzm')
          ,repeat_interval => 'FREQ=DAILY'
          ,end_date        => NULL
          ,job_class       => 'DEFAULT_JOB_CLASS'
          ,job_type        => 'PLSQL_BLOCK'
          ,job_action      => 'BEGIN EXEC REPORTING_TABLES; END;'
          ,comments        => 'This Job will create reporting tables for intranet queries'
        );
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'RESTARTABLE'
         ,value     => FALSE);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'LOGGING_LEVEL'
         ,value     => SYS.DBMS_SCHEDULER.LOGGING_OFF);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'MAX_FAILURES');
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'MAX_RUNS');
      BEGIN
        SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
          ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
           ,attribute => 'STOP_ON_WINDOW_CLOSE'
           ,value     => FALSE);
      EXCEPTION
        -- could fail if program is of type EXECUTABLE...
        WHEN OTHERS THEN
          NULL;
      END;
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'JOB_PRIORITY'
         ,value     => 3);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'SCHEDULE_LIMIT');
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
        ( name      => 'CBAINFO.INTRANET_REPORTING_TABLES'
         ,attribute => 'AUTO_DROP'
         ,value     => TRUE);
    
      SYS.DBMS_SCHEDULER.ENABLE
        (name                  => 'CBAINFO.INTRANET_REPORTING_TABLES');
    END;
    /
    
    Error at line 2
    ORA-06550: line 1, column 481:
    PLS-00103: Encountered the symbol "REPORTING_TABLES" when expecting one of the following:   := . ( @ % ;
    The symbol ":=" was substituted for "REPORTING_TABLES" to continue.
    ORA-06512: at "SYS.DBMS_ISCHED", line 154
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 450
    ORA-06512: at line 2
    
    Script Terminated on line 2.

    Your job_action won't. EXEC is not stametent of PL/SQL, SQL * Plus command.
    Use

     ,job_action      => 'BEGIN  REPORTING_TABLES; END;'
    
  • Terminate a work schedule when it worked long

    Hello

    I wish to terminate a job when he worked for more then 4 minutes

    It is because of the connection to remote database. That statement hangs when the location of the database remaote

    insert into TRANS_LOG_CH select * from TRANS_LOG_TEMP@china where TRANS_LOG_KEY = log_key;

    Currently I am using the following code, but it does not work after 4 minutes according to the needs

    BEGIN
    () sys.dbms_scheduler.create_job
    job_name = > "'TEST'". "" TEST' ',
    job_type = > 'PLSQL_BLOCK ',.
    job_action = > ' start
    TEST. TRANS_LOG_FROM_CHINA (50);
    end;',
    repeat_interval = > ' FREQ = MINUTELY; RANGE = 2',
    start_date = > to_timestamp_tz (' 2010-12-20 15:49 Europe/Lisbon ',' YYYY-MM-DD HH24:MI:SS TZR' ").
    job_class = > ' «DEFAULT_JOB_CLASS»»
    Comments = > 'Copy data from Chinese - 2 Minutes',
    auto_drop = > FALSE,
    activated = > FALSE);
    sys.dbms_scheduler.set_attribute (name = > ' 'ATC01'.) ("" ' TEST ' ", attribute = > 'schedule_limit', value = > numtodsinterval (4, ' minute'));
    sys.dbms_scheduler.set_attribute (name = > ' 'ATC01'.) ("" ' TEST ' ", attribute = > 'max_run_duration', value = > numtodsinterval (4, ' minute'));
    sys.dbms_scheduler.set_attribute (name = > ' 'ATC01'.) ("" ' TEST ' ", attribute = > 'raise_events', value = > dbms_scheduler.job_stopped);
    sys.dbms_scheduler.set_attribute (name = > ' 'ATC01'.) "" ' TEST ' ", attribute = > 'logging_level', value = > DBMS_SCHEDULER. LOGGING_OFF);
    sys.dbms_scheduler.set_attribute (name = > ' 'ATC01'.) ("" ' TEST ' ", attribute = > 'job_weight', value = > 1);
    END;

    Very welcome ideas

    Thank you

    Pete

    Published by: Pete88 on January 5, 2011 10:27

    Published by: Pete88 on January 5, 2011 10:28

    Did you know that there is a planner sup forum?

    Planner

    Van
    Trent

  • Different result by EXEC and job execution

    Greetings!

    I've got simple procedure:

    CREATE OR REPLACE PROCEDURE alertlog.check_log IS
    IP_ADDRESS VARCHAR2 (16);
    BEGIN
    SELECT ('USERENV', 'IP_ADDRESS') sys_context IN ip_address sys.dual;
    FOR alert_conn IN (SELECT alert_date, alert_text FROM alert_log WHERE alert_date > SYSDATE - 20/1440 and REGEXP_LIKE (alert_text, 'ORA')-)
    LOOP
    INSERT INTO ALERT_LOG_CONT@EMGRID VALUES (IP_ADDRESS, alert_conn.alert_date, alert_conn.alert_text);
    END LOOP;
    UPDATE SID_LIST@EMGRID SET LAST_UPLOAD = SYSDATE WHERE IPADDR = IP_ADDRESS;
    COMMIT;
    END;
    /

    And job

    BEGIN
    () sys.dbms_scheduler.create_job
    job_name = > ""ALERTLOG"". "" CHECK_LOG_JOB' '.
    job_type = > 'PLSQL_BLOCK ',.
    job_action = > ' start
    alertlog.check_log;
    end;',
    repeat_interval = > ' FREQ = MINUTELY; INTERVAL = 15; BYDAY IS MON, MAR, SEA, GAME, FRI, SAT, SUN.; BYHOUR = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23',.
    start_date = > to_timestamp_tz ('01-12-2010 13:09:57 am Europe/Moscow ',' YYYY-MM-DD HH24:MI:SS TZR').
    job_class = > ' «DEFAULT_JOB_CLASS»»
    auto_drop = > FALSE,
    activated = > FALSE);
    sys.dbms_scheduler.set_attribute (name = > ' "ALERTLOG".) "' FFF ' ', attribute = > 'logging_level', value = > DBMS_SCHEDULER. LOGGING_OFF);
    sys.dbms_scheduler.set_attribute (name = > ' "ALERTLOG".) ("' FFF ' ', attribute = > 'job_weight', value = > 1);
    sys.dbms_scheduler. Enable (' "ALERTLOG".) ("' FFF ' ');
    END;
    /

    When I run alertlog.check_log EXEC in sqlplus the result is good:
    IPADDR EVENT_DATE ERROR_LINE
    10.20.17.38 2010-12-01 13:19:01.0 ORA-TEST

    But while it is being work - it does not get an ip address:

    IPADDR EVENT_DATE ERROR_LINE
    2010-12-01 13:19:01.0 ORA-TEST

    What I am doing wrong?



    Update:

    And it is not also SID_LIST@EMGRID a day
    UPDATE SID_LIST@EMGRID SET LAST_UPLOAD = SYSDATE WHERE IPADDR = IP_ADDRESS;

    Published by: Skalny on 01.12.2010 13:41

    Hello

    SELECT ('USERENV', 'IP_ADDRESS') sys_context IN ip_address sys.dual;

    In a work, this will give no return value, because a job is run inside the database and has no connection to client, if IP_ADDRESS will be null. This is why your update does not work.

    For a job, you can use UTL_INADDR. GET_HOST_ADDRESS.

    Herald tiomela
    http://htendam.WordPress.com

Maybe you are looking for