Dbms_scheduler problem

I'm having a problem with scheduling a job from HTML DB/Oracle Apps Express. Simply stated: it doesn't run. I have put all the actions inside a stored procedure, when I call that stored procedure as the owner of the job (and the application) from Raptor, it runs. If I call it from a process in the application, it doesn't. I do see the changes the stored procedure made however, in ALL_SCHEDULER_JOBS. I have no idea why this isn't working, does anybody have any ideas?

I think I know what happened, though I'm not sure how. When I looked at the job when started without HTML DB, the startdate was sysdate with timezone Europe, but when started thru HTML DB, startdate was sysdate, but without any timezone (at least Raptor did not show one). Since just enabling the job was enough, I removed setting the start date, and now it works.

Similar Messages

  • DBMS_SCHEDULER.run_job problem

    Hi friends.I have one problem. I use Oracle 10g(r2) in oracle enter.server. Also I can execute backupdb.sh script from terminal
    success.But I created Job sheduler as
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB
    job_name => 'BACKUP_DB_JOB',
    job_type => 'EXECUTABLE',
    job_action => '/orahome/orastart/./backupdb.sh',
    start_date => '13-jan-2010 6:32 PM',
    repeat_interval => 'FREQ=DAILY'
    END;
    although i execute following
    begin
    DBMS_SCHEDULER.run_job (job_name=>'BACKUP_DB_JOB');
    end;
    then occur error [1]: (Error): ORA-27369: job of type EXECUTABLE failed with exit code: 274660 ORA-06512: at "SYS.DBMS_ISCHED", line 150 ORA-06512: at "SYS.DBMS_SCHEDULER", line 441 ORA-06512: at line 4
    also i see detail information from dba_scheduler_job_run_details.ADDITIONAL_INFO described as
    ORA-27369: job of type EXECUTABLE failed with exit code: 274660
    STANDARD_ERROR="Oracle Scheduler error: Not running as extjob or extjobo."
    there are for extjob following
    ls -l $ORACLE_HOME/bin/extjob
    -rwsr-x--- 1 root oinstall 64842 Oct 15 06:58 /orahome/oracle/product/10.2.0/db_1/bin/extjob
    and
    ls -l $ORACLE_HOME/rdbms/admin/externaljob.ora
    -rw-rwxr-- 1 640 oinstall 1536 Jan 19 15:08 /orahome/oracle/product/10.2.0/db_1/rdbms/admin/externaljob.ora
    why that error happen?

    See the below forum for solution
    Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
    Hope this helps,
    Regards
    http://www.oracleracexpert.com
    Click here for [Block Corruption and recovery|http://www.oracleracexpert.com/2009/08/block-corruption-and-recovery.html]
    Click here for [Redo log corruption and recovery|http://www.oracleracexpert.com/2009/08/redo-log-corruption-and-recovery.html]

  • Problem with Dbms_Scheduler.Create_Job

    Hi,
    Below is my package, where in I am calling scheduler to run a job for the procedure written.
    My Main Procedure: requests_delete_proc, deletes the requests which are more than 2 year old then sysdate.
    I want to run a job monthly once for this procedure which is written under "delete_job".
    This seems to be not working. I am not able to delete the records .
    Can anyone suggest me as what is the problem pls?
    CREATE OR REPLACE
    PACKAGE BODY DELETE_REQUEST_PKG
    AS
    PROCEDURE requests_delete_proc
    AS
    request_count NUMBER;
    nodatafound EXCEPTION;
    BEGIN
    SELECT
    COUNT(request_id)
    INTO
    request_count
    FROM
    max_request_dtls
    WHERE
    requested_date < sysdate - (2*365);
    IF request_count <> 0 THEN
    DELETE
    FROM
    max_req_history_dtls
    WHERE
    request_id IN
    SELECT
    request_id
    FROM
    max_request_dtls
    WHERE
    requested_date < sysdate -(2 *365)
    DELETE
    FROM
    max_request_dtls
    WHERE
    requested_date < sysdate -(2 * 365);
    dbms_output.put_line('requests deleted');
    COMMIT;
    ELSE
    raise nodatafound;
    END IF;
    EXCEPTION
    WHEN nodatafound THEN
    dbms_output.put_line('no records found for mentioned requested date');
    END requests_delete_proc;
    PROCEDURE delete_job
    AS
    BEGIN
    DBMS_SCHEDULER.create_job (
    job_name => 'request_Delete_job',
    job_type => 'STORED_PROCEDURE',
    job_action => 'Requests_Delete_Proc',
    start_date => SYSTIMESTAMP,
    repeat_interval => 'freq=MINUTELY',
    end_date => NULL,
    enabled => TRUE,
    comments => 'Job defined entirely by the CREATE JOB procedure.');
    END delete_job;
    END DELETE_REQUEST_PKG;

    Most probably your delete statement is faulty, otherwise it should work.
    SQL>  CREATE TABLE emp_test_job AS SELECT * FROM emp;
    Table created.
    SQL> SELECT COUNT(*) FROM emp_test_job;
      COUNT(*)
            14
    SQL> CREATE OR REPLACE PACKAGE DELETE_REQUEST_PKG AS
      2   PROCEDURE requests_delete_proc;
      3   PROCEDURE delete_job;
      4  END;
      5  /
    SQL> CREATE OR REPLACE PACKAGE BODY DELETE_REQUEST_PKG AS
      2    PROCEDURE requests_delete_proc AS
      3      request_count NUMBER;
      4      nodatafound EXCEPTION;
      5    BEGIN
      6      DELETE FROM emp_test_job WHERE rownum<5;
      7    END requests_delete_proc;
      8 
      9    PROCEDURE delete_job AS
    10    BEGIN
    11      DBMS_SCHEDULER.create_job(job_name        => 'request_Delete_job',
    12                                job_type        => 'PLSQL_BLOCK',
    13                                job_action      => 'BEGIN DELETE_REQUEST_PKG.requests_delete_proc; END;',
    14                                start_date      => SYSTIMESTAMP,
    15                                repeat_interval => 'freq=MINUTELY',
    16                                end_date        => NULL,
    17                                enabled         => TRUE,
    18                                comments        => 'Job defined entirely by the CREATE JOB procedure.');
    19 
    20    END delete_job;
    21  END DELETE_REQUEST_PKG;
    22  /
    Package body created.
    SQL>
    SQL>  BEGIN
      2   DELETE_REQUEST_PKG.DELETE_JOB();
      3   END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> SELECT job_name, program_name, start_date
      2  FROM all_scheduler_jobs;
    JOB_NAME
    PROGRAM_NAME
    START_DATE
    REQUEST_DELETE_JOB
    29-NOV-10 05.38.10.703000 PM +05:30
    SQL>  SELECT COUNT(*) FROM   emp_test_job;
      COUNT(*)
             6
    SQL> SELECT COUNT(*) FROM   emp_test_job;
      COUNT(*)
             0
    SQL> BEGIN
      2  DBMS_SCHEDULER.DROP_JOB('request_Delete_job',TRUE);
      3  END;
      4  /
    PL/SQL procedure successfully completed.

  • Privilege problem on DBMS_SCHEDULER  execute linux shell script

    Hello, everybody,
    I'm a beginner on oracle development , recently , I use DBMS_SCHEDULER to execute linux shell script so that I can transmit files to another ftp server . The problem is , I can't use ordinary user to execute this shell ,but must use sys user , or the procedure will show error : Permission Denied;
    I can't change the files' privillege that need to transmit.
    I had tried these method,but no use:
    1. grant all privillege to user;
    2. change the privillege of shell and it's direcotry;
    3. use full path in shell;
    I hope someone could help me solve this problem , thank you!
    the error code :
    STANDARD_ERROR="ftp: local: test20121221173852: Permission denied
    ftp: local: test20121221173953: Permission denied
    ftp: local: test20121221174052: Permission denied
    ftp: local: test20121221174153: Permission denied"

    My /tmp/test.ksh trying to find database status.
    . ~oracle/.profile > /dev/null
    db_status=`eval sqlplus -s 'system/passwd@DEV' << EOF
    set pagesize 0 feedback off verify off heading off echo off
    select status from v\\$instance;
    exit
    EOF`
    echo $db_status > /tmp/db_status_out

  • Dbms_scheduler.create_job problem

    Hello.
    I want to use dbms_scheduler.create_job in forms for progress_bar (http://fdegrelle.over-blog.com/article-10986844.html).
    But i get Dbms_scheduler.create_job must be declared message.
    If i connect to database as sys and check packages, dbms_scheduler is not among other packages.
    How do i install it? Is there a script?
    Thanks.

    DejanH,
    The PL/SQL code included in the sample dialog use both DBMS_SCHEDULER for 10g database and DBMS_JOB for 9i database..
    The DBMS_SCHEDULER is a 10g new feature. With a 9i version, you have to use the DBMS_JOB package:
    -- Lancement de la procédure par le package dbms_job pour la version 9i --
      If v_version = 9 Then
        dbms_job.isubmit(v_jobid,'Progress_Bar;',sysdate,null);
        forms_ddl('commit') ;
      Else
      -- Lancement de la procédure par le package dbms_scheduler pour la version 10g --
      dbms_scheduler.create_job(
        job_name   => v_jobname
       ,job_type   => 'stored_procedure'
       ,job_action => 'Progress_Bar'
       ,start_date => SYSDATE
       ,enabled    => TRUE
    ...In case of a 9i version, you have to comment all lines relative to the DBMS_SCHEDULER package ;-)
    Francois

  • Problem with DBMS_SCHEDULER

    Hi All,
    I am getting error
    Error at line 1
    ORA-27452: user1.pkg_dummy.sp_dummy is an invalid name for a database object.
    ORA-06512: at "SYS.DBMS_ISCHED", line 679
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1130
    ORA-06512: at line 2
    BEGIN
    dbms_scheduler.create_schedule('user1.pkg_dummy.sp_dummy ', repeat_interval =>
    'FREQ=HOURLY;INTERVAL=1');
    END;
    But the package and procedure are available in user1 and in valid state.
    Is there any special grant to be given for package to be submited via job?
    Your responses are welcome.
    Regards,
    Tarak

    Hi
    I think you're using the wrong DBMS_SCHEDULER package. What you are doing with DBMS_SCHEDULER.CREATE_SCHEDULE is creating a schedule. You would then create a job to use that schedule.
    DBMS_SCHEDULER.CREATE_SCHEDULE
    schedule_name in varchar2,
    start_date in timestamp with timezone default null,
    repeat_interval in varchar2,
    end_date in timestamp with timezone default null,
    comments in varchar2 default null
    I think you're looking for:
    -- Job defined by an existing program and schedule.
    DBMS_SCHEDULER.create_job (
    job_name => 'test_prog_sched_job_definition',
    program_name => 'test_plsql_block_prog',
    schedule_name => 'test_hourly_schedule', <-- This would use the schedule created above
    enabled => TRUE,
    comments => 'Job defined by an existing program and schedule.');
    More info here:
    http://www.oracle-base.com/articles/10g/Scheduler10g.php
    Good luck!
    A.

  • Problems using dbms_scheduler with attached network disks

    Oracle 11.2.0.1
    I created a job which run  .bat - files.
    dbms_scheduler.create_job(
            job_name => 'JOB_FILES',
            job_type => 'EXECUTABLE',
            job_action => 'e:\dump\abc.bat',
            auto_drop => FALSE,
            enabled => TRUE);
    Content of abc.bat is
    "E:\Oracle\product\11.2.0\dbhome_1\BIN\7za a e:\dump\den3_arch_171020131420.zip x:\mtr\"
    Im trying to make an archive with files in some folder. In this example the folder is "x:\mtr\" where "x" is attached network disk.
    When i run this job It creates null archive and raises error
    ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
    If in "abc.bat" i change network disk "x" to server disk with existing folder all works properly(It archives all files).
    If i execute "abc.bat" from cmd window all works properly(It archives all files).
    Ive created java source
    create or replace and compile java source named "OSCommand" as
    import java.io.*;
    public class OSCommand{
    public static String Run(String Command){
    try{
    Process p = Runtime.getRuntime().exec(Command);
    p.waitFor();
    return("0");
    catch (Exception e){
    System.out.println("Error running command: " + Command +
    "\n" + e.getMessage());
    return(e.getMessage());
    and pl/sql function
    CREATE OR REPLACE FUNCTION OSCommand_Run(Command IN STRING)
    RETURN VARCHAR2 IS
    LANGUAGE JAVA
    NAME 'OSCommand.Run(java.lang.String) return int';
    And it works like dbms_scheduler...
    May be user need any special grants?

    user617289 wrote:
    Thats right. How can i resolve this issue?
    when all else fails Read The Fine Manual
    DBMS_SCHEDULER

  • Error While Running DBMS_SCHEDULER.RUN_JOB in Oacle 11g DB in LINUX ENvirnoment

    Dear ALL,
    I have two separate Server, One is App. Server which is on WINDOWS 2008 and the DB server on LINUX. I'm created a job for Daily logical Backup of Database through EXP command on DB Server.
    I have created DBMS_SCHEDULER.CREATE_JOB with JOB_ACTION /home/oracle/wms_dbdmp/auto_backup.sh the Location of .sh file which contain the following code
    #!/bin/bash
    exp test/test@orcl file=/home/oracle/wms_dbdmp/test.dmp log=/home/oracle/wms_dbdmp/test.log compress=N rows=Y grants=Y owner=(test) statistics=NONE
    ECHO "Export done successfully..."
    Exit 0
    Now i created job successfully, but when i'm invoking this .sh file through DBMS_SCHEDULER>RUN_JOB('backup_01');
    I'm facing error which are given as-
    ORA-27369: job of type EXECUTABLE failed with exit code: Permission denied
    ORA-06512: at "SYS.DBMS_ISCHED", line 185
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
    ORA-06512: at line 1
    I did this on WINDOWS Environment Successfully. I'm naive user for LINUX Envirnoment SO Please Guide me to rid off to this problem.
    I will be very thank full to all...

    I wrote the script as
    #!/bin/bash
    exp test/test@orcl file=/home/oracle/wms_dbdmp/test.dmp log=/home/oracle/wms_dbdmp/test.log compress=N rows=Y grants=Y owner=(test) statistics=NONE
    exit 0
    But it didn't work through procedure....how to invoke .sh file through db procedure...?

  • Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

    GUIDE TO RUNNING EXTERNAL JOBS ON 10g WITH DBMS_SCHEDULER
    NOTE: Users using 11g should use the new method of specifying a credential which eliminates many of the issues mentioned in this note.
    This guide covers several common questions and problems encountered when using
    dbms_scheduler to run external jobs, either on Windows or on UNIX.
    What operating system (OS) user does the job run as ?
    External jobs which have a credential (available in 11g) run as the user
    specified in the credential. But for jobs without credentials including
    all jobs in 10gR1 and 10gR2 there are several cases.
    - On UNIX systems, in releases including and after 10.2.0.2 there is a file $ORACLE_HOME/rdbms/admin/externaljob.ora . All external jobs not in the SYS schema and with no credential run as the user and group specified in this file. This should be nobody:nobody by default.
    - On UNIX systems, in releases prior to 10.2.0.2 there was no "externaljob.ora" file. In this case all external jobs not in the SYS schema and with no credential run as the owner and group of the $ORACLE_HOME/bin/extjob file which should be setuid and setgid. By default extjob is owned by nobody:nobody except for oracle-xe where it is owned by oracle:oraclegroup and is not setuid/setgid.
    - On Windows, external jobs not in the SYS schema and with no credential run as the user that the OracleJobScheduler Windows service runs as. This service must be started before these jobs can run.
    - In all releases on both Windows and UNIX systems, external jobs in the SYS schema without a credential run as the oracle user.
    What errors are reported in SCHEDULERJOB_RUN_DETAILS views ?
    If a job fails, the first place to look for diagnostic information is the SCHEDULERJOB_RUN_DETAILS set of views. In 10gR2 and up the first 200 characters of the standard error stream is included in the additional_info column.
    In all releases, the error number returned by the job is converted into a
    system error message (e.g. errno.h on UNIX or net helpmsg on Windows) and that
    system error message is recorded in the additional info column. If there is no
    corresponding message the number is displayed.
    In 11g and up the error number returned by the job is additionally recorded in
    the error# column. In earlier releases 27369 would always be recorded in the
    error# column.
    Generic Issues Applicable to UNIX and Windows
    - The job action (script or executable) must return 0 or the job run will be marked as failed.
    - Always use the full pathname to executables and scripts.
    - Do not count on environment variables being set in your job. Make sure that the script or executable that your jobs runs sets all required environment variables including ORACLE_HOME, ORACLE_SID, PATH etc.
    - It is not recommended to pass in a complete command line including arguments as the action. Instead it is recommended to pass in only the path to and name of the executable and to pass in arguments as job argument values.
    - Scripts with special characters in the execution path or script name may give problems.
    - Ensure that the OS user your job runs as has the required privileges/permissions to run your job. See above for how to tell who the job runs as.
    - External job actions cannot contain redirection operators e.g. > < >> | && ||
    - In general try getting a simple external job working first e.g. /bin/echo or ipconfig.exe on Windows. Also try running the job action directly from the commandline as the OS user that the job will run as.
    Windows-specific Issues
    - The OracleJobScheduler Windows service must be started before external jobs will run (except for jobs in the SYS schema and jobs with credentials).
    - The user that the OracleJobScheduler Windows service runs as must have the "Log on as batch job" Windows privilege.
    - A batch file (ending in .bat) cannot be called directly by the Scheduler. Instead cmd.exe must be used and the name of the batch file passed in as an argument. For example
    begin
    dbms_scheduler.create_job('myjob',
       job_action=>'C:\WINDOWS\SYSTEM32\CMD.EXE',
       number_of_arguments=>3,
       job_type=>'executable', enabled=>false);
    dbms_scheduler.set_job_argument_value('myjob',1,'/q');
    dbms_scheduler.set_job_argument_value('myjob',2,'/c');
    dbms_scheduler.set_job_argument_value('myjob',3,'c:\temp\test.bat');
    dbms_scheduler.enable('myjob');
    end;
    /- In 10gR1 external jobs that wrote to standard output or standard error streams would sometimes return errors. Redirect to files or suppress all output and error messages when using 10gR1 to run external jobs.
    UNIX-specific Issues
    - When running scripts, make sure that the executable bit is set.
    - When running scripts directly, make sure that the first line of the script in a valid shebang line - starting with "#!" and containing the interpreter for the script.
    - In release 10.2.0.1, jobs creating a large amount of standard error text may hang when running (this was fixed in the first 10.2.0.2 patchset). If you are seeing this issue, redirect standard error to a file in your job. This issue has been seen when running the expdp utility which may produce large amounts of standard error text.
    - the user that the job runs as (see above section) must have execute access on $ORACLE_HOME/bin and all parent directories. If this is not the case the job may be reported as failed or hang in a running state. For example if your $ORACLE_HOME is /opt/oracle/db then you would have to make sure that
    chmod a+rx /opt
    chmod a+rx /opt/oracle
    chmod a+rx /opt/oracle/db
    chmod a+rx /opt/oracle/db/bin
    - On oracle-xe, the primary group of your oracle user (if it exists) must be dba before you install oracle-xe for external jobs to work. If you have an oracle user from a regular Oracle installation it may have the primary group set to oinstall.
    - On oracle-xe, the extjobo executable is missing so external jobs in the SYS schema will not work properly. This can be fixed by copying the extjob executable to extjobo in the same directory ($ORACLE_HOME/bin).
    - Check that correct permissions are set for external job files - extjob and externaljob.ora (see below)
    Correct permissions for extjob and externaljob.ora on UNIX
    There is some confusion as to what correct permissions are for external job related files.
    In 10gR1 and 10.2.0.1 :
    - rdbms/admin/externaljob.ora should not exist
    - bin/extjob should be setuid and setgid 6550 (r-sr-s---). It should be owned by the user that jobs should run as and by the group that jobs should run as.
    - bin/extjobo should have normal 755 (rwxr-xr-x) permissions and be owned by oracle:oraclegroup
    In 10.2.0.2 and higher
    - rdbms/admin/externaljob.ora file must must be owned by root:oraclegroup and be writable only by the owner i.e. 644 (rw-r--r--) It must contain at least two lines: one specifying the run-user and one specifying the run-group.
    - bin/extjob file must be also owned by root:oraclegroup but must be setuid i.e. 4750 (-rwsr-x---)
    - bin/extjobo should have normal 755 (rwxr-xr-x) permissions and be owned by oracle:oraclegroup
    In 11g and higher
    Same as 10.2.0.2 but additionally bin/jssu should exist with root setuid
    permissions i.e. owned by root:oraclegroup with 4750 (-rwsr-x---)
    Internal Error numbers for UNIX on 10.2.0.2 or 10.1.0.6 or higher
    If you are not using a credential and are using version 10.2.0.2 or higher or 10.1.0.6 or higher you may come across an internal error number. Here are the meanings for the internal error numbers.
    274661 - can't get owner of or permissions of externaljob.ora file
    274662 - not running as root or externaljob.ora file is writable by group or other or externaljob.ora file not owned by root (can't switch user)
    274663 - setting the group or effective group failed
    274664 - setting the user or effective user failed
    274665 - a user or group id was not changed successfully
    274666 - cannot access or open externaljob.ora file
    274667 - invalid run_user specified in externaljob.ora file
    274668 - invalid run_group specified in externaljob.ora file
    274669 - error parsing externaljob.ora file
    274670 - extjobo is running as root user or group

    Hi Ravi,
    Can you help me...
    Hi All,
    I planned to create a job to do rman backup daily at 04:00 AM.
    1. I created a program as follows
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(
    program_name => 'rman_backup_prg',
    program_action => '/u02/rmanback/rman.sh',
    program_type => 'EXECUTABLE',
    comments => 'RMAN BACKUP');
    END;
    my rman script is
    #!/usr/bin/ksh
    export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    export PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin
    /u01/app/oracle/product/10.2.0/db_1/bin/exp rman/cat@catdb file=/u02/rmanback/rm
    an_220108.dmp log=/u02/rmanback/rman_220108.log owner=rman statistics=none comp
    ress=n buffer=400000
    compress *.dmp
    exit
    2. I created a schedule as follows
    BEGIN
    DBMS_SCHEDULER.CREATE_SCHEDULE(
    schedule_name => 'rman_backup_schedule',
    start_date => SYSTIMESTAMP,
    end_date => '31-DEC-16 05.00.00 AM',
    repeat_interval => 'FREQ=DAILY; BYHOUR=4',
    comments => 'Every day at 4 am');
    END;
    3. I created ajob as follows.
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'rman_backup_job',
    program_name => 'rman_backup_prg',
    schedule_name => 'rman_backup_schedule',
    enabled=> true,
    auto_drop=> false
    END;
    While I am running the job I am getting the following error anybody help me.
    ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at line 2
    If I removed "compress *.dmp" line in rman script it is working fine.
    /* additional Info from dba_scheduler_job_run_details as follows */
    ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
    STANDARD_ERROR="
    Export: Release 10.2.0.3.0 - Production on Tue Jan 22 14:30:08 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Release 10.2.0.3.0 - Production
    Export"
    Regards,
    Kiran

  • CHAIN_STALLED problem

    i have create two program first delete file from directory second use DBMS package of data pump to export file on directory than use dboth program in chain. i wanted to run cahin thorugh job.
    i'm facing one problem chain job status remain CHAIN_STALLED. Em show job runing but my work has been completed plz help why this CHAIN_STALLED occured my script is below
    crteate a chain
    BEGIN
    DBMS_SCHEDULER.CREATE_CHAIN (
    chain_name => 'my_chain1',
    rule_set_name => NULL,
    evaluation_interval => NULL,
    comments => 'My first chain');
    END;
    Add both program DEL or PUMP
    BEGIN
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
    chain_name => 'my_chain1',
    step_name => 'my_step1',
    program_name => 'DEL');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
    chain_name => 'my_chain1',
    step_name => 'my_step2',
    program_name => 'PUMP');
    END;
    after issuse
    BEGIN
    DBMS_SCHEDULER.ENABLE ('my_chain1');
    END;
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'chain_job_2',
    job_type => 'CHAIN',
    job_action => 'my_chain1',
    enabled => TRUE);
    END;
    BEGIN
    DBMS_SCHEDULER.RUN_CHAIN (
    chain_name => 'my_chain1',
    job_name => 'chain_job_2',
    start_steps => 'my_step1, my_step2');
    END;
    Edited by: Oracle Studnet on Feb 5, 2009 4:36 AM

    Hi,
    Chains must have rules that dictate how they should run,
    You will need to call define_chain_rule at least 3 times before enabling the chain.
    'TRUE' => 'START my_step1'
    'my_step1 completed' => 'START my_step2'
    'my_step2 completed' => 'END'
    See here for some examples.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/schedadmin006.htm#BAJHFHCD
    Hope this helps,
    Ravi.

  • Creating a job with DBMS_SCHEDULE  from Forms?

    I'm new to DBMS_SCHEDULER. I'd like to run a stored procedure from an Oracle Forms application passing some parameters from the Form to the procedure, then immediately running the procedure and after the procedure has finished dropping it from the job list. The procedure may take some time to run and the user doesn't want to wait before exiting the form. Can this be done?

    Sure, no problem. The job will be dropped after termination by default (autodrop). If privileges are ok it should work. Things to think about are error reporting and retries.
    regards,
    Ronald
    http://ronr.nl/unix-dba

  • STOPPED JOBS with expdp and dbms_scheduler

    Hello.
    I am working with the 10g release 2 in a RAC enviroment, and i am trying to put an export job at the scheduler.
    To launch the export i have make a shell script, then first exec the export process and after launch a bzip2 command to compress the resultant dmp file.
    The problem is that the export process finish ok, but it don't compress the file, because the scheduler mark the job as STOPPED.
    The log say:
    REASON="Stop job with force called by user: 'SYS'"
    and the expdp S.O process that launch the extjobo stay runing for ever, like if it was waiting for the expdp to exit and it can`t so the script never arrive to the part that compress the file.
    I put the script that i make to export the schema:
    #!/bin/bash
    export ORACLE_HOME=/opt/oracle/product/10.2.0/db
    export PATH=$PATH:$ORACLE_HOME/bin
    export DIRBACK=/ORACLE/BACKUPS/BMR/Dumps
    export dia=`date +%d_%m_%Y_%H_%M_%S`
    export LOG=dump_backup_bmr_$dia.log
    cd $DIRBACK
    $ORACLE_HOME/bin/expdp userid=oracle_backup/orabck@BMR dumpfile="BMR_BMR_$dia.dmp" schemas=BMR directory=Dumps logfile=$LOG
    cd $DIRBACK
    /usr/bin/bzip2 -f --best ./BMR_BMR_$dia.dmp
    cd $DIRBACK
    /bin/mail -s "DUMP BACKUP BMR DIARIO [$dia]" [email protected] < ./dump_backup_bmr_$dia.log
    I have put several cd $DIRBACK to see if it fail because the script don`t find the dmp file.
    Any idea why it STOP after finish the script ?
    PD: sorry for my poor english.
    Regards

    Hi,
    A stop is only done in two cases - if the user calls dbms_scheduler.stop_job or if the database is shutdown while a job is running. Make sure the database is not being shutdown while the job is running or inside of the job.
    If expdp is still running then this suggests that it is hanging. One possibility for that is that expdp is generating a lot of standard error messages and hanging the job (this is a known issue in 10gR2). You can try redirecting standard output and error to files to see if this helps.
    e.g.
    $ORACLE_HOME/bin/expdp > /tmp/output 2> /tmp/errors
    Hope this helps,
    Ravi.

  • Using database link via dbms_scheduler

    Hello out there,
    I have a problem calling a stored procedure via dbms_scheduler that pulls some rows over a public database link.
    The setup is the following:
    create public database link mediabase using 'mediabase';
    create or replace procedure hole_kurse as
    mdatum date;
    begin
       select max(datum) into mdatum
       from dt_wechselkurs;
       insert into dt_wechselkurs l
          (waehrung,
           datum,
           wechselkurs)
       (select
           r.waehrung,
           r.datum,
           r.wechselkurs
        from
           dt_wechselkurs@mediabase r
        where
           datum>mdatum);
        commit;
    end hole_kurse;
    begin
       dbms_scheduler.create_job(job_name          =>  'wechselkurse',
                                 job_type          =>  'STORED_PROCEDURE',
                                 job_action        =>  'hole_kurse',
                                 start_date        =>  sysdate,
                                 repeat_interval   =>  'FREQ=DAILY; BYHOUR=7; BYMINUTE=0; BYSECOND=0');
       dbms_scheduler.enable(name => 'wechselkurse');
       commit;
    end;
    /I can access the database link in SQL and I can call the procedure hole_kurse from SQL without any errors. But the job fails writing "ORA-01017: invalid username/password; logon denied" into alert.log. I also tried using dbms_job which used to work with Oracle 10g but now fails with the same error.
    My Oracle version is 11.2.0.2 64bit on Window Server 2008R2.
    So what do I have to change that my job will run?
    Many thanks in advance,
    dhalek

    I'm not completely sure, but here is a possibility:
    The [url http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5005.htm#i2061505]docs have this to say:
    >
    If you specify CONNECT TO user IDENTIFIED BY password, then the database link connects with the specified user and password.
    If you specify CONNECT TO CURRENT_USER, then the database link connects with the user in effect based on the scope in which the link is used.
    If you omit both of those clauses, then the database link connects to the remote database as the locally connected user.
    >
    Your dblink is like this:
    create public database link mediabase using 'mediabase';That is the third case described, so the link connects as "the locally connected user", which in the scheduler session is probably not your user.
    You may try it with the second case described in the docs:
    create public database link mediabase CONNECT TO CURRENT_USER using 'mediabase';If I understand the docs correct, then within the procedure the dblink will use the schema that the procedure is owned by (unless the procedure is using invoker-rights, then it will be the invoking user.)
    It is just a guess, but you can try it and see ;-)

  • Getting error while trying to execute a external job using dbms_scheduler

    Hello,
    I create a job using alpha account.
    begin
    dbms_scheduler.create_job(
    job_name => 'jps_test_executable',
    job_type => 'EXECUTABLE',
    job_action => '/usr/bin/ksh',
    number_of_arguments => 2
    dbms_scheduler.set_job_argument_value (
    job_name => 'jps_test_executable',
    argument_position => 1,
    argument_value => '/tmp/abc.sh'
    and when I execute the job in the schema using alpha account it works fine.
    BEGIN
    DBMS_SCHEDULER.run_job (job_name => 'jps_test_executable',
    use_current_session => FALSE);
    END;
    Works fine.
    But if I try to execute the same job using some other account say beta in the same schema , I am getting error
    ORA-27476 :”SMS.RUN_SMS_JOBS Does not exist ORA-06512 at “SYS.DBMS_ISCHED” line 2793 ORA-06512 :at “SYS.DBMS_SCHEDULER”,line 1794
    even I give the fill qualifier, still I am getting the error.
    BEGIN
    DBMS_SCHEDULER.run_job (job_name => 'alpha.jps_test_executable',
    use_current_session => FALSE);
    END;
    Any help will be appreciated.
    Thank you,
    Raj

    It's the expected behavior:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#CIHHBGGI
    RUN_JOB requires that you be the owner of the job or have ALTER privileges on that job. You can also run a job if you have the CREATE ANY JOB privilege.So, you need to grant the required privilege:
    aplha@orcl> grant alter on alpha.jps_test_executable to beta;HTH
    Enrique
    PS If your problem was solved consider marking the question as answered.

  • Error with dbms_scheduler and shell script execution

    Hi,guys.
    I have an issue with a dbms_scheduler and a shell script execution. So, the shell script as it self works fine, when i'm executing ./test.sh all process is running, but when i'm executing the script from dbms_scheduler it just simply doesn't work. Actually it works, but some of executable information in sh doesn't work, seems it just jump over of the part of the script. Sendmail part is running, maybe there is problem with rman script as it self?
    DB version: 10g
    And my scripts:
    Shell scripts (permisons 755):
    #!/bin/ksh
    export PATH=/home/oracle/product/asm_home/bin:/home/oracle/product/db_home/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
    export ORACLE_BASE=/home/oracle/product
    export ORACLE_SID=zabbix
    export ORACLE_HOME=/home/oracle/product/db_home
    ${ORACLE_HOME}/bin/rman<<EOF
    connect target /
    run {backup recovery area delete all input;}
    EOF
    {       echo "From:[email protected]"
            echo "To: [email protected]"
            echo "Subject: Recovery area"
            echo 'Content-Type: text/html'
            echo
            echo '<html><body><table border="1" cellspacing="1">'
            echo '<tr><td><b>Process</b></td><td><b>Statuss</b></td></tr>'
            echo "<tr><td>RMAN</td><td><b>Works</b></td></tr>"
            echo "</table></body></html>"
    } | sendmail -tIn the first part i'm exporting all of the important stuff for oracle, then I call RMAN with specific atributes. And then there is just simply sendmail functionality inside script to represent if script works (for now).
    And below pl/sql script:
    begin
      DBMS_SCHEDULER.CREATE_JOB
      job_name => 'FLASH_RECOVERY',
      job_type => 'EXECUTABLE',
      job_action => '/home/oracle/backup/test.sh',
      start_date => sysdate,
      job_class => 'DEFAULT_JOB_CLASS',
      enabled => TRUE,
      auto_drop => FALSE,
      comments => 'FLASH RECOVERY USAGE AREA backup and delete'
      END;
      /And this job execution:
           begin
               DBMS_SCHEDULER.run_job (job_name =>'FLASH_RECOVERY',use_current_session => TRUE);
           end;What can be wrong? For me, I think it's something with permisions.
    I hope you got my idea and could help me.
    Tom
    Edited by: safazaurs on 2013.18.2 22:16

    There is no error, i just receive all the time e-mail, seems it jumps over rman. I tried almost everything and still couldn't get result as i want. And, if i'm running script from command line - it works. Rman calls, and starts to recover archivelogs.

Maybe you are looking for

  • Anyone ever had the "landscape" screen fail on you ?

    You might know that just when I am ready to acquire the iPhone 5S my iPhone 4's landscape screen feature has suddenly lost this feature . What would it cost to restore this feature so I can sell it full featured 100% ? Thanks.

  • Start automatically an action only when another action finish

    Hi all, first, sorry for my bad English.... I am an Italian Architect, I use Photoshop actions mostly to manage many big tiff files. I try to solve this problem since long time.... but so far I can't..  :-( This is my problem: I woul'd like to use so

  • Writing the datas from 2 files into 3rd File?

    Hi, I am reading datas from 2 files Say, Example1.txt Ashok Babu Chenthil Danny Example2 .txt ^data1^data2^data3 ^data1^data2^data3 ^data1^data2^data3 ^data1^data2^data3 I want those data's to be written in a 3rd file. Say, Example3.txt Ashok^ data1^

  • Button's link that will download a .pdf / .indd

    I have a couple of buttons and want one to download a .pdf and the other to download a .indd from the remote site. I've entered the folder/filename.indd into the link box and it isn't working. I assume that I am not doing this correctly. I also tried

  • Has anyone else send their ipod nano first generation in for replacement?

    Hi, has anyone else sent their ipod nano first generation in for a replacement? I sent mine a couple weeks ago but the status still doesnt have any information and i just want to make sure they at least received it, any information is helpful!