Dbms_scheduler.add_job_email_notification

Hi,
With our latest upgrade to Oracle 11g R2 Database, I tried to generate job email notification using the new feature dbms_sheduler.add_job_email_notification for the JOB_STARTED,JOB_STOPPED,JOB_FAILED,JOB_BROKEN,JOB_COMPLETED and JOB_DISABLED events. This does work fine for all but JOB_DISABLED event. I am not sure why it is not generating for JOB_DISABLED event. When looking at the job details, the raise_events attribute has the value "JOB_STARTED,JOB_FAILED,JOB_BROKEN,JOB_STOPPED,JOB_SCH_LIM_REACHED,JOB_DISABLED" for that scheduler job, this means it raises the JOB_DISABLED event, but it does not generate the notification if we try disabling the job with DBMS_SCHEDULER.disable_job procedure. We need to send this notification to the programmers if one of the programmers disables a job for a maintenance reason. Can anybody please help on this?
Regards,
Natarajan

Hi,
Request the experts to please reply.

Similar Messages

  • Dbms_Scheduler.Set_Scheduler_Attribute fails for email_server_credential

    I am using an Oracle 11g XE DB (11.2.0.2.0). I want to configure a job to send e-mails if the job state changes.
    I use the following procedure:
       Procedure Config_E_Mail Is
          V_Server Varchar2(50) := 'smtp.mail.com:587';
          V_Sender Varchar2(70) := '[email protected]'; 
          V_Recipients Varchar2(100) := '[email protected]';
          V_Events Varchar2(200) := 'job_failed, job_broken, job_stopped, job_disabled';   
       Begin
          begin
                Dbms_Scheduler.drop_Credential(Credential_Name => 'my_cred12345', force => true);
          exception
                when others then
                    null;
          end;
          Dbms_Scheduler.Create_Credential(Credential_Name => 'my_cred12345', Username => '[email protected]', Password => '12345678');
          Dbms_Scheduler.Set_Scheduler_Attribute('email_server_credential', 'my_cred12345');  -- Code fails at this line         
          Dbms_Scheduler.Set_Scheduler_Attribute('email_server', V_Server);     
          Dbms_Scheduler.Set_Scheduler_Attribute('email_sender', V_Sender);        
          Dbms_Scheduler.Add_Job_Email_Notification     
             Job_Name   =>  P_Job_Name,                 
             Recipients =>  V_Recipients,               
             Events     =>  V_Events        
       End;
    This code compiles OK. I have give this user the following privileges:
    create job, MANAGE SCHEDULER &  SCHEDULER_ADMIN ROLE.
    Problem is, when running, the code fails at the highlighted line (i.e. Dbms_Scheduler.Set_Scheduler_Attribute('email_server_credential'....)
    Error is:
    ERROR at line 1:
    ORA-27486: insufficient privileges
    ORA-06512: at "SYS.DBMS_ISCHED", line 4609
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 3245
    ORA-06512: at "PEGA.INT_CREATE_JOB", line 56
    ORA-06512: at "PEGA.INT_CREATE_JOB", line 73
    ORA-06512: at line 1
    Any help would be greatly appreciated.

    When I run in SQL*Plus as a anonymous block, this is the error I get:
    SQL> ED
    Wrote file afiedt.buf
      1     DECLARE
      2        V_Server Varchar2(50) := 'smtp.mail.com:587';
      3        V_Sender Varchar2(70) := '[email protected]';
      4        V_Recipients Varchar2(100) := '[email protected]';
      5        v_password varchar2(15) := '12345678';
      6        V_Events Varchar2(200) := 'job_failed, job_broken, job_stopped, job_disabled';
      7     Begin
      8        DBMS_OUTPUT.PUT_LINE('10');
      9        Dbms_Scheduler.Set_Scheduler_Attribute('email_server', V_Server);   DBMS_OUTPUT.PUT_LINE('20');
    10        Dbms_Scheduler.Set_Scheduler_Attribute('email_sender', V_Sender);
    11        BEGIN
    12           DBMS_OUTPUT.PUT_LINE('30');
    13           Dbms_Scheduler.drop_Credential(Credential_Name => 'cred_rohan_123', force => true);
    14        EXCEPTION
    15           WHEN OTHERS THEN
    16              NULL; -- Only for testing purposes
    17        END;
    18        DBMS_OUTPUT.PUT_LINE('40');
    19        Dbms_Scheduler.Create_Credential(Credential_Name => 'cred_rohan_123', Username => V_Recipients , Password => v_password );
    20        DBMS_OUTPUT.PUT_LINE('50');
    21        Dbms_Scheduler.Set_Scheduler_Attribute('email_server_credential', 'cred_rohan_123'); -- Error is here.
    22        DBMS_OUTPUT.PUT_LINE('60');
    23        Dbms_Scheduler.Add_Job_Email_Notification
    24        (
    25           Job_Name   =>  'JOB_INS_TO_TAB1',
    26           Recipients =>  V_Recipients,
    27           Events     =>  V_Events
    28        );
    29*    End;
    SQL> /
    10
    20
    30
    40
    50
       DECLARE
    ERROR at line 1:
    ORA-27486: insufficient privileges
    ORA-06512: at "SYS.DBMS_ISCHED", line 4609
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 3245
    ORA-06512: at line 21
    The privileges the user PEGA has are these:
    SQL> l
      1* SELECT * FROM user_sys_privs
    SQL> /
    USERNAME        PRIVILEGE                                     ADM
    PEGA            UNLIMITED TABLESPACE                          NO
    PEGA            CREATE JOB                                    NO
    PEGA            MANAGE SCHEDULER                              NO
    SQL>

  • Schell Script to Schdule In Dbms_Schedule

    Hi All,
    I've a script to schedule in dbms_scheduler, here is the usage of script in linux command line..
    "/home/oracle/scripts/run.sh table_name"
    Any inputs how to schedule it in dbms scheduler daily to run 1200 AM

    @sushaant - the post you refer to has no relevance to using DBMS_SCHEDULER - it is just using a cron job to run a shell script.
    @Ramu - if the shell script is on the same server as the oracle database, you need to do the following
    1) Create a credential that has the unix user you want to run the script as.
    Note the script itself MUST set up any environment needed for the job to run - DBMS_SCHEDULER will not execute the .profile of the user you supply in the credential so don't assume in run.sh that any $PATH will exist or any other environment variables, you must set these explicitly. E.g. if you use a unix command, you should ensure you specify the full path to it in run.sh.
    BEGIN
    DBMS_SCHEDULER.CREATE_CREDENTIAL('YOUR_CREDENTIAL', 'username', 'password');
    END;
    2) In sqlplus, create a job with an external job that references run.sh and add argument. Change yourjob to be the job name
    you want to see when the job runs and your_table_name to the table that should be used in this particular job.
    dbms_scheduler.create_program(
    job_name=>'yourprogram',
    job_type=>'EXECUTABLE',
    job_action=>'/home/oracle/scripts/run.sh',
    number_of_arguments=>1);
    4) Create a job which links the program to the schedule and runs daily at midday and create other jobs for other tables giving them different parameters. If you have several of these to run but don't want them to run at the same time, look at the CREATE_CHAIN commands in the Oracle 11gR2 database admin guide as there are two whole chapters (28 & 29) on the scheduler ( http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#i1033533 )
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'run_tablename1',
    program_name => 'yourprogram',
    repeat_interval => 'FREQ=DAILY;BYHOUR=12',
    credential_name => 'YOUR_CREDENTIAL',
    comments => 'Daily at noon');
    dbms_scheduler.set_job_argument_value@orl1(job_name=>'run_tablename1', argument_position=>1, argument_value='your_table_name');
    END;
    Note that as you are passing a table_name to the run.sh, i'm guessing it might be running some Oracle commands such as an analyse so if run.sh contains PLSQL commands, you could create a PLSQL package or procedure in the database and instead of creating an external program that runs a shells script, just run the PLSQL directly from DBMS_SCHEDULER. This is simpler as you don't need to create credentials etc.. needed for an external program.
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM (
    job_name => 'yourname',
    job_type => 'STORED_PROCEDURE',
    job_action => 'YOUR_PKG.DO_STUFF',
    start_date => '18-MAY-13 12.00.00 AM',
    repeat_interval => 'FREQ=DAILY', /* every day */
    end_date => '17-MAY-14 12.00.00 AM',
    auto_drop => FALSE,
    comments => 'My new job');
    END;
    dbms_scheduler.set_job_argument_value@orl1(job_name=>'yourjob',
    argument_position=>1, argument_value='your_table_name');
    and again create a chain if you want to run several when one completes.
    You need to select from various tables to see the result of the jobs and whether they succeed or not such as
    select * From user_scheduler_job_run_details where job_Name='run_tablename1'
    SELECT * FROM USER_SCHEDULER_JOB_LOG;
    select * from user_scheduler_running_jobs
    You can add email notifications using DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION
    See the admin guide for more details.

  • Substitute of ADD_JOB_EMAIL_NOTIFICATION procedure

    I wanted to know what is the substitute in Oracle 11g database enterprise manager for the notifications which are invoked using DBMS_SCHEDULER.add_job_email_notification procedure. I want to have an email notification on the completion of a backup job using EM.
    I hope my question is clear of what are the steps to configure a notification for a backup job completion using enterprise manager.
    Please revert with the reply to my query.
    Regards

    Hi,
    Request the experts to please reply.

  • Email notification was sent out twice

    I created two jobs using DBMS_SCHEDULER.CREATE_JOB. The first job was to update the table and the second job was to check the status of the first job in dba_scheduler_job_run_details. I also add email notification on the second job by using DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION which sends the email to myself. The problem was the email notification was sent to me twice everytime when I do that. My script is as the follows.
    DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (
    job_name => 'KUDSJ_ENOT_ADBD_ENDPROC'
    ,recipients => '[email protected]'
    ,sender => '[email protected]'
    ,subject => 'Company Schedule Job - %job_owner%.%job_name% - %event_type%'
    ,body => '%event_type% occurred at %event_timestamp%. %error_message%'
    ,events => 'JOB_SUCCEEDED');
    DBMS_SCHEDULER.SET_ATTRIBUTE(
    'KUDSJ_ENOT_ADBD_ENDPROC', 'logging_level', DBMS_SCHEDULER.LOGGING_FULL);
    I am not sure where the problem is. Please help. Thanks.
    cy

    You meant that I should set recipients to null when I do the remove_job_email_notification. I did drop_job and remove_job_email_notification a couple of times already. Could you tell me more specific? Thanks.
    This is what I did.
    DBMS_SCHEDULER.DROP_JOB(job_name => 'KUDSJ_ENOT_ADB_XXXXX');
    DBMS_SCHEDULER.REMOVE_JOB_EMAIL_NOTIFICATION(job_name => 'KUDSJ_ENOT_ADB_XXXXX', events => 'JOB_STARTED, JOB_SUCCEEDED');
    cy

  • How can i add email notifications to a scheduler program

    Hi,
    We have a scheduler chain that calls 2 scheduler programs.
    The chains are controlled by a scheduler job that has job_type as CHAIN.
    My challenge is how to add email notfications on the failure or success of the programs.
    I know about this procedure DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION, but this is only applicable to jobs and not programs(i believe).
    Is there an alternative way to trigger off emails for scheduler programs please?
    Thank you

    Hi gloria79,
    Mail uses Contacts to store email addresses and group addresses.  You would need to create the desired group on your MacBook.
    This article discussed how it works.
    Mail (Mavericks): Address messages
    http://support.apple.com/kb/PH14922
    Thank you for using Apple Support Communities.
    Nubz

  • Email notification issue in some schemas

    Hi,
    My problem is almost identical as here DBMS_SCHEDULER send email notification issue
    One privileged scheduler user - user1 receive email notifications while two another (user2, user3) no.
    More plot is below i know 'what' resolve the problem but don't know how to do it :-)
    I want to execute code below on user3 schema, we tried this successfully on user2 (code executed directly on schema with temporary sys.dbms_aq access) so he receive his notifications.
    Problem is - we do not have direct access to second account (user3) how to execute this code as user3 ?
    declare
      reginfo1    sys.aq$_reg_info;
      reginfolist sys.aq$_reg_info_list;
    begin
      reginfo1    := sys.aq$_reg_info('SYS.SCHEDULER$_EVENT_QUEUE:SCHED$_AGT2$_X',
                                      1,
                                      'plsql://SYS.SCHEDULER$_JOB_EVENT_HANDLER',
                                      null);
      reginfolist := sys.aq$_reg_info_list(reginfo1);
      dbms_aq.register(reginfolist, 1);
    end;
    Already tried create procedure on user3 and execute immediate annonymous block but it still register with USER# 1 not 3 in  DBA_QUEUE_SUBSCRIBERS.
    More detailed plot:
    Jobs for user2 and user3 was created by user1, so JOB_CREATOR was user1 but OWNER was user2 or user3.
    We started with notifications configuration witch was ended with error on both user2 and user3 accounts:
    ORA-24093: AQ agent SCHED$_AGT2$_XX not granted privileges of database user1
    W get rid wit this using
    dbms_aqadm.enable_db_access(SCHED$_AGT2$_2, user1);
    dbms_aqadm.enable_db_access(SCHED$_AGT2$_3, user1);
    So user1 get privilege on agents for user2 and user3
    I believe error was already there because DBMS_SCHEDULER.add_job_email_notification is more automatic it probably registered subscriber that belongs to user2 and user3 with wrong USER# ID that belongs to user1.
    Database is 11.2.0.3

    it doesn't work because notifications are set from user1 account so USER# is still 1 even when I removed record first.
    This is my aproach based on Ask Tom: On Becoming Others, Limits, and Restoration
    >sqlplus user1
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SQL> grant execute on sys.dbms_aq to user1;
    Grant succeeded.
    SQL> alter user user3 grant connect through user1;
    User altered.
    SQL> connect user1[user3]
    Enter password:
    Connected.
    SQL> create or replace procedure sched_not_add_q as
      2    reginfo1    sys.aq$_reg_info;
      3    reginfolist sys.aq$_reg_info_list;
      4  begin
      5    reginfo1    := sys.aq$_reg_info('SYS.SCHEDULER$_EVENT_QUEUE:SCHED$_AGT2$_3',
      6                                    1,
      7                                    'plsql://SYS.SCHEDULER$_JOB_EVENT_HANDLER',
      8                                    null);
      9    reginfolist := sys.aq$_reg_info_list(reginfo1);
    10    dbms_aq.register(reginfolist, 1);
    11  end;
    12  /
    Procedure created.
    SQL> exec sched_not_add_q;
    PL/SQL procedure successfully completed.
    SQL> drop procedure sched_not_add_q;
    Procedure dropped.
    SQL> connect user1
    Connected.
    SQL> revoke execute on sys.dbms_aq from user3;
    Revoke succeeded.
    SQL> alter user user3 revoke connect through user1;
    User altered.
    SQL> exit;
    >
    So it works now.

  • Query on event based job in a client schema and not SYS schema

    Hi, I am fairly new to oracle job scheduler and wanted your inputs on how to create a event based job that sends a mail based on success of another job.
    I was able to implement this with the jobs being created under SYS schema. I did get email notifcation when errors were logged in exception table.
    However, now the requirement has changed to create the jobs under a client specific schema.
    The jobs got created successfully in CLIENT schema but the event based job is not working. It does not send the email notification.
    I feel this is to do with not correctly subscribing to the event queue {sys.scheduler$_event_queue}.
    Can CLIENT schema use the agent "AGENT" created under SYS to subscribe to the Scheduler event queue {sys.scheduler$_event_queue}? CLIENT is the schema in which the all jobs and procedures are created.
    BEGIN
    DBMS_AQADM.ENABLE_DB_ACCESS('AGENT', 'CLIENT');
    END;
    --Main Job that will load data and errors will be logged into exception table
    BEGIN    
    dbms_scheduler.create_job( job_name=> 'CLIENT.LOAD_DATA',                              
    job_type=>'PLSQL_BLOCK',                              
    job_action=>'BEGIN  CLIENT.p_loaddata;                                     
    END;',                              
    start_date=>systimestamp,                              
    repeat_interval=>'FREQ=MINUTELY;INTERVAL=1;',                              
    number_of_arguments=>0,                              
    enabled=> true);
    END;
    --set raise_events attribute = job_succeeded for main job
    BEGIN
    DBMS_SCHEDULER.set_attribute ('CLIENT.LOAD_DATA', 'raise_events', DBMS_SCHEDULER.job_succeeded);
    END;
    --Event Job that will send email based on condition. Condition is checked in procedure CLIENT.p_check_sendmail; If errors are found in the exception table, this job will raise exception and will be JOB_FAILED status. This job will send a email notification.
    BEGIN 
    DBMS_SCHEDULER.create_job (       job_name          => 'CLIENT.EMAIL_JOB',     
    job_type          => 'PLSQL_BLOCK',     
    job_action        => 'BEGIN  CLIENT.p_check_sendmail;                                   END;',     
    event_condition  => 'tab.user_data.event_type = ''JOB_SUCCEEDED'' and tab.user_data.object_name = ''LOAD_DATA''',      
    queue_spec        => 'sys.scheduler$_event_queue,AGENT',      
    enabled          => true);
    END;
    BEGIN    
    dbms_scheduler.add_job_email_notification ( job_name => 'CLIENT.EMAIL_JOB',     recipients => '[email protected]',events => 'JOB_FAILED');
    END;
    Is the way i am subscribing to the event queue correct? Could you please share an example/document of event based job in a schema other than SYS and how subscription is being done to event queue?
    Thanks

    Hi,
    It's a good decision you made because you shouldn't create objects in the SYS schema. I see you're using the add_job_email_notification procedure, so I'm assuming you're on 11g onwards.
    This procedure is meant to make the job easy for you. That is, you don't need to worry about setting up AQ, the procedure does it all for you. All you need to do is setup the mail server if not already done, and call this procedure to add the mail notification. That's it.
    You can also specify a filter to the add_job_email_notification procedure, so maybe you could specify directly your CLIENT.LOAD_DATA job to this procedure.

  • CUOM email notification displaying wrong IP for CUOM(version 2.3)

    Hi,
    Any of you encounter before that the notification displays the wrong IP address(10.0.0.1) for the CUOM when they send the email notification? I had checked the device list and it does not show any IP address which the email is point to(e.g. 10.0.0.1).
    =============================================================================
    ** This message is generated from Cisco Unified Operations Manager **
    EVENT ID                = 00004QJ
    ALERT ID                = 00001MZ
    CREATION TIME           = Tue 30-Aug-2011 06:01:43 GMT+08:00
    STATUS                  = Active
    SEVERITY                = Critical
    MANAGED OBJECT          = XXXunity
    EVENT DESCRIPTION       = HighUtilization::Component= PSR-XXXunity/0;  ProcessorUtilizationThreshold= 90;  CpuUtilFiveMin= 94  %;  DescriptionURL= < http://10.0.0.1:1741/CSCOnm/servlet/com.cisco.nm.help.ServerHelpEngine?tag=HighUtilization >; 
    ** Related Tools **
    Detailed Device View = http://10.0.0.1:1741/iptm/ddv.do?deviceInstanceName=XXXunity&deviceCapability=MediaServer
    Event History = http://10.0.0.1:1741/iptm/AFDFHReportAction.do?EventName=HighUtilization&ReportType=eventReport&DeviceName=XXXunity&Component=PSR-XXXunity%2F0&InstanceName=PSR-XXXunity%2F0
    Edit Threshold = http://10.0.0.1:1741/iptm/ThresholdMain.do?Source=VHM&PTMDeviceName=XXXunity&Class=SystemProcessor&InstanceName=PSR-XXXunity%2F0
    Alert Details = http://10.0.0.1:1741/iptm/Events.do?DeviceName=XXXunity&DeviceName=XXXunity
    =============================================================================
    Why is the email displaying the wrong CUOM ip address? Where does the email get the CUOM IP address value from? I am using another IP address to access the CUOM now.
    Thanks.
    Regards,
    Victor

    I got this to work by creating the notification on the job_name.job_subname in this way:
    BEGIN
    DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (
    job_name => 'ChainJob.ChainSubJob',
    recipients => '[email protected]',
    sender => '[email protected]',
    subject => 'Scheduler Job Notification-%job_owner%.%job_name%-%event_type%',
    body => '%event_type%',
    events => 'JOB_FAILED, JOB_BROKEN,JOB_DISABLED,JOB_SUCCEEDED,JOB_SCH_LIM_REACHED');
    END;
    Where ChainSubJob is the Step in your chain that you want alerted on.
    If you aren't sure what you steps are called, you can always view the details by looking at the following - you'll see the JOB_SUBNAME listed here:
    select * from user_scheduler_job_run_details;

  • Email notification using Oracle Job

    Hi,
    I am trying to setup a email notification job using Oracle 11gR2. Per online documnetation I have done the following setup, but the email notification job is failing. If you guys have any ideas, please assist.
    Step 1:
    BEGIN
      DBMS_SCHEDULER.set_scheduler_attribute('email_server', 'oracle.kotaise.com:25');
      DBMS_SCHEDULER.set_scheduler_attribute('email_sender', '[email protected]');
    END;
    Step2:
    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name        => 'email_notification_job',
        job_type        => 'PLSQL_BLOCK',
        job_action      => 'BEGIN NULL; END;',
        start_date      => SYSTIMESTAMP,
        repeat_interval => 'freq=minutely; bysecond=0',   
        enabled         => TRUE);
    END;
    Step 3:
    BEGIN
    DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (
      job_name   =>  'email_notification_job',
      recipients =>  '[email protected]',
      sender     =>  '[email protected]',
      subject    =>  'Scheduler Job Notification-%job_owner%.%job_name%-%event_type%',
      body       =>   '%event_type% occurred at %event_timestamp%. %error_message%',
      events     =>  'JOB_FAILED, JOB_BROKEN, JOB_DISABLED, JOB_SCH_LIM_REACHED');
    END;
    Step 4:
    I have created the following  job that executes a package which executes a package "test_package.pdata". This package is not created yet, becuase I wanted to see whether the email notification is working or not. As expected the "TEST_JOB" is failed becuase of missing package. But the email notification job "'email_notification_job'", which runs every minute, failed to send an email notification.
    BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB
           job_name        => 'test_job'
          ,start_date      => SYSTIMESTAMP
          ,repeat_interval => 'freq=minutely; bysecond=0'
          ,end_date        => NULL
          ,job_class       => 'DEFAULT_JOB_CLASS'
          ,job_type        => 'PLSQL_BLOCK'
          ,job_action      => 'BEGIN test_package.pdata; END;'
          ,comments        => NULL
          ,enabled         => TRUE
    end;
    I have queried the DBA_SCHEDULER_NOTIFICATIONS table, and I see that the email notification job did not started.
    JOB_NAME                                      RECIPIENT                     EVENT
    EMAIL_NOTIFICATION_JOB      [email protected]      JOB_FAILED
    EMAIL_NOTIFICATION_JOB      [email protected]      JOB_BROKEN
    EMAIL_NOTIFICATION_JOB      [email protected]      JOB_SCH_LIM_REACHED
    EMAIL_NOTIFICATION_JOB      [email protected]      JOB_DISABLED
    Thanks

    Hi,
    The DBA_SCHEDULER_NOTIFICATIONS show the notification settings, not the notifications that were sent. To see that, run the follwoing query:
    select queue,
           msg_state,
           enq_time,
           enq_user_id,
           deq_time,
           deq_user_id,
           t.user_data.event_type,
           t.user_data.object_owner,
           t.user_data.object_name,
           t.user_data.event_timestamp
      from sys.AQ$SCHEDULER$_EVENT_QTAB t;
    Does it show anything for your job?

  • ADD_JOB_EMAIL_NOTIFICATION  failed

    Hi Oracle expert,
    I downloaded the job email notification and installed in our existing development DB oracle 10g.
    The installation was successfully.
    However when I tried to run the procedure it endup with errors as follows:
    SQL> exec add_job_email_notification('BACKUP_IDTAPPS.XXX.COM_000009','s
    [email protected]','JOB_FAILED');
    BEGIN add_job_email_notification('BACKUP_IDTAPPS.XXX.COM_000009','steve
    [email protected]','JOB_FAILED'); END;
    ERROR at line 1:
    ORA-00931: missing identifier
    ORA-06512: at "SYS.DBMS_UTILITY", line 125
    ORA-06512: at "SYS.DBMS_ISCHED", line 3559
    ORA-06512: at "SYS.DBMS_ISCHED", line 3532
    ORA-06512: at "SYS.ADD_JOB_EMAIL_NOTIFICATION", line 37
    ORA-06512: at line 1
    Any one have ideas?
    Below is the procedure code from Oracle.
    job_name IN VARCHAR2,
    recipient_address IN VARCHAR2,
    events IN VARCHAR2 DEFAULT
    'JOB_FAILED,JOB_BROKEN,JOB_SCH_LIM_REACHED,JOB_CHAIN_STALLED',
    sender_address IN VARCHAR2 DEFAULT '[email protected]',
    subject_prefix IN VARCHAR2 DEFAULT 'Oracle Scheduler Job Notification',
    email_server_host IN VARCHAR2 DEFAULT 'mail.XXX.com',
    email_server_port IN PLS_INTEGER DEFAULT 25
    ) AS
    events_on NUMBER := 0;
    job_object VARCHAR2(35);
    job_owner VARCHAR2(35);
    canon_job_name VARCHAR2(30);
    canon_job_owner VARCHAR2(30);
    caller VARCHAR2(30) := sys_context('USERENV','SESSION_USER');
    notifier_job_name VARCHAR2(80);
    new_raise_events NUMBER := 0;
    cur_raise_events VARCHAR2(200);
    priv_count NUMBER;
    event_condition VARCHAR2(4000);
    comments_text VARCHAR2(100) :=
    'Auto-generated job to send email alerts for job ';
    type event_name_list is table of varchar2(30);
    type event_number_list is table of number;
    event_names event_name_list := event_name_list('JOB_STARTED',
    'JOB_SUCCEEDED', 'JOB_FAILED', 'JOB_BROKEN', 'JOB_COMPLETED',
    'JOB_STOPPED', 'JOB_SCH_LIM_REACHED', 'JOB_DISABLED',
    'JOB_CHAIN_STALLED', 'JOB_OVER_MAX_DUR');
    event_numbers event_number_list :=
    event_number_list(1,2,4,8,16,32,64,128,256,512);
    event_found pls_integer := 0;
    event_10862 pls_integer := 0;
    begin
    -- get job name and owner
    sys.dbms_isched.resolve_name(job_name, job_object, job_owner, caller);
    -- canonicalize job name and owner
    dbms_utility.canonicalize(job_object, canon_job_name, 30);
    dbms_utility.canonicalize(job_owner, canon_job_owner, 30);
    comments_text := comments_text ||'"'||canon_job_owner ||'"."'||canon_job_name||'"' ;
    -- check if the caller has privileges on the job
    -- check if the caller is the job owner or 'SYS'
    IF canon_job_owner = caller or caller = 'SYS' THEN
    goto privilege_check_passed;
    END IF;
    -- check whether the caller has been granted ALTER on the job or
    -- CREATE ANY JOB or SCHEDULER_ADMIN or DBA directly
    select count(*) into priv_count from dba_sys_privs where grantee=caller and
    privilege='CREATE ANY JOB';
    IF priv_count > 0 THEN goto privilege_check_passed; END IF;
    select count(*) into priv_count from dba_role_privs where grantee=caller and
    granted_role='SCHEDULER_ADMIN';
    IF priv_count > 0 THEN goto privilege_check_passed; END IF;
    select count(*) into priv_count from dba_tab_privs where grantee=caller and
    owner=canon_job_owner and table_name=canon_job_name;
    IF priv_count > 0 THEN goto privilege_check_passed; END IF;
    -- recursive privileges check for CREATE ANY JOB system priv
    -- includes a recursive roles check so SCHEDULER_ADMIN will also work
    -- this is slow but all simple privilege checks have failed
    select count(*) into priv_count from (
    select grantee, granted from
    /* roles granted */
    select grantee, granted_role granted from dba_role_privs
    /* system privileges granted */
    union
    select grantee, privilege granted from dba_sys_privs
    start with grantee = caller connect by grantee = prior granted )
    where granted = 'CREATE ANY JOB';
    IF priv_count > 0 THEN goto privilege_check_passed; END IF;
    -- recursive privileges check whether the caller has object privileges on the job
    -- this is slow but all simple privilege checks have failed
    select count(*) into priv_count from (
    select * from
    /* object privileges granted */
    select table_name g1, owner g2, grantee obj, grantee own, privilege typ
    from dba_tab_privs
    /* role privileges granted */
    union
    select granted_role g1, granted_role g2, grantee, grantee, null
    from dba_role_privs
    start with g1 = canon_job_name and g2 = canon_Job_owner
    connect by g1 = prior obj and g2 = prior own)
    where obj=caller;
    IF priv_count > 0 THEN goto privilege_check_passed; END IF;
    -- no privileges, throw job_does_exist error
    dbms_sys_error.raise_system_error(-23308, canon_job_owner, canon_job_name,
    TRUE);
    <<privilege_check_passed>>
    -- retrieve current events turned on. cast NO_DATA_FOUND to job not found
    begin
    select raise_events into cur_raise_events from dba_scheduler_jobs where
    job_name=canon_job_name and owner=canon_job_owner ;
    exception when no_data_found then
    dbms_sys_error.raise_system_error(-23308, canon_job_owner, canon_job_name,
    TRUE);
    when others then raise;
    end;
    -- generate event_condition
    event_condition := 'tab.user_data.object_owner = '''||canon_job_owner||
    ''' AND tab.user_data.object_name = '''||canon_job_name|| '''';
    if instr(UPPER(events),'JOB_ALL_EVENTS')>0 then
    -- by default we have no events clause so all events will trigger an e-mail
    event_found := 1;
    else
    event_condition := event_condition ||' AND tab.user_data.event_type in (';
    for i in event_names.first..event_names.last loop
    if instr(UPPER(events),event_names(i))>0 then
    event_condition := event_condition || ''''||event_names(i)||''',';
    event_found := 1;
    end if;
    end loop;
    if instr(UPPER(events),'JOB_RUN_COMPLETED')>0 then
    event_condition := event_condition ||
    '''JOB_SUCCEEDED'',''JOB_FAILED'',''JOB_STOPPED'',';
    event_found := 1;
    end if;
    -- strip last comma and add close brace
    event_condition := regexp_replace(event_condition, ',$');
    event_condition := event_condition || ')';
    end if;
    -- if no events have been specified, throw an error
    if event_found = 0 then
    dbms_sys_error.raise_system_error(-24098, events, 'EVENTS',TRUE);
    end if;
    -- collect all events to turn on
    if cur_raise_events is null then
    cur_raise_events := UPPER(events) ;
    else
    cur_raise_events := UPPER(events) ||','||UPPER(cur_raise_events) ;
    end if;
    for i in event_names.first..event_names.last loop
    if instr(cur_raise_events,event_names(i))>0 then
    new_raise_events := new_raise_events + event_numbers(i);
    end if;
    end loop;
    if instr(cur_raise_events,'JOB_RUN_COMPLETED')>0 then
    new_raise_events := new_raise_events -
    bitand(new_raise_events,sys.dbms_scheduler.job_run_completed) +
    sys.dbms_scheduler.job_run_completed;
    end if;
    if instr(cur_raise_events,'JOB_ALL_EVENTS')>0 then
    new_raise_events := new_raise_events -
    bitand(new_raise_events,sys.dbms_scheduler.job_all_events) +
    sys.dbms_scheduler.job_all_events;
    end if;
    -- turn on events the user is interested in
    dbms_scheduler.set_attribute
    ( '"'||canon_job_owner||'"."'||canon_job_name||'"' , 'raise_events' ,
    new_raise_events);
    -- set event 10862 if not set so that we can add a subscriber
    -- this is necessary because if event 10862 is not set then AQ is in backward
    -- compatibility mode which checks the login user instead of the current user
    -- for privileges.
    dbms_system.read_ev(10862, event_10862);
    IF event_10862 = 0 THEN
    EXECUTE IMMEDIATE
    'ALTER SESSION SET EVENTS ''10862 TRACE NAME CONTEXT FOREVER, LEVEL 1''';
    END IF;
    -- add a new subscriber for this notification
    BEGIN
    dbms_aqadm.add_subscriber
    (queue_name => 'SYS.SCHEDULER$_EVENT_QUEUE',
    subscriber => sys.aq$_agent(canon_job_owner, NULL, NULL),
    rule => 'tab.user_data.object_owner = '''||canon_job_owner||'''');
    EXCEPTION WHEN others then
    -- unset event 10862, if we set it above
    IF event_10862 = 0 THEN
    EXECUTE IMMEDIATE 'ALTER SESSION SET EVENTS ' ||
    '''10862 TRACE NAME CONTEXT OFF''' ;
    END IF;
    if sqlcode = -24034 then NULL;
    else raise;
    end if;
    end;
    -- unset event 10862, if we set it above
    IF event_10862 = 0 THEN
    EXECUTE IMMEDIATE 'ALTER SESSION SET EVENTS ' ||
    '''10862 TRACE NAME CONTEXT OFF''' ;
    END IF;
    -- allow the job owner to access our events queue via this subscriber
    dbms_aqadm.enable_db_access(canon_job_owner,'"'||canon_job_owner||'"');
    -- if this procedure has been run already for this job, drop previously
    -- created email notification jobs. One of the parameters might have changed
    -- and existing email notification jobs might have been altered or broken.
    FOR old_notify_job IN
    ( SELECT '"'||owner||'"."'||job_name ||'"' name FROM dba_scheduler_jobs WHERE
    owner = canon_job_owner and job_name like substr(canon_job_name,1,10) || '_EMAILER%'
    and comments = comments_text and program_owner = 'SYS'
    and program_name = 'EMAIL_NOTIFICATION_PROGRAM'
    LOOP
    dbms_scheduler.drop_job(old_notify_job.name);
    END LOOP;
    -- now create a notifier job which waits on job events
    BEGIN
    -- try using a simple name without an added number suffix
    notifier_job_name := substr(canon_job_name,1,10) || '_EMAILER' ;
    notifier_job_name := '"' || canon_job_owner || '"."' || notifier_job_name ||'"' ;
    dbms_scheduler.create_job(notifier_job_name,
    program_name => 'sys.email_notification_program',
    event_condition => event_condition,
    queue_spec =>'sys.scheduler$_event_queue,"'
    || canon_job_owner||'"',
    comments => comments_text);
    EXCEPTION WHEN OTHERS THEN
    IF sqlcode != -27477 THEN RAISE; END IF;
    -- a job already exists using our simple name, add a numerical suffix
    notifier_job_name :=
    dbms_scheduler.generate_job_name( '"'||substr(canon_job_name,1,10)||'_EMAILER"');
    notifier_job_name := '"' || canon_job_owner || '"."' || notifier_job_name ||'"' ;
    dbms_scheduler.create_job(notifier_job_name,
    program_name => 'sys.email_notification_program',
    event_condition => event_condition,
    queue_spec =>'sys.scheduler$_event_queue,"'
    || canon_job_owner||'"',
    comments => comments_text);
    END;
    dbms_scheduler.set_job_argument_value(notifier_job_name,2,
    recipient_address);
    dbms_scheduler.set_job_argument_value(notifier_job_name,3,
    email_server_host);
    dbms_scheduler.set_job_argument_value(notifier_job_name,4,
    sender_address);
    dbms_scheduler.set_job_argument_value(notifier_job_name,5,
    subject_prefix);
    dbms_scheduler.set_job_argument_value(notifier_job_name,6,
    to_char(email_server_port));
    dbms_scheduler.enable(notifier_job_name);
    end;

    Hi,
    add_job_email_notification can only be used on jobs created with dbms_scheduler (or via the dbms_scheduler EM interface under the server tab, under Oracle Scheduler).
    This backup job may be a regular EM job (from the Jobs link on the EM front page) in which case you would have to setup EM job notification. I don't know how to configure this but the folks in the Grid Control forum would know.
    If this is a dbms_scheduler job then you should also specify the schema that the job is in. i.e. 'SCOTT.DAILYFULLBACKUP' . You can tell if this is a dbms_scheduler job by seeing if it is in the dba_scheduler_jobs view or checking the jobs under the server tab under Oracle Scheduler.
    Hope this helps,
    Ravi.

  • [Oracle 10g] Download of add_job_email_notification package

    Hi,
    Does anyone have the link to the download the add_job_email_notification package for Oracle 10g? I googled, but didn't find it, only a link that doesn't exist anymore.
    Thanks is advance

    841527 wrote:
    I think the intention of this forum was to help. If I'd find it in Google I wouldn't waste my time and the others time here...
    I need this specific package to monitor jobs scheduled using DBMS_SCHEDULER.
    ThanksMaybe not in google, but in oracle.com . . .
    go to www.oracle.com
    click on the "Oracle Technology Network" button near the upper right corner
    enter "add_job_email_notification" in the search field and click the magnifying glass icon.
    The information you seek is on the resulting page.

  • 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

  • Stored Proc running twice using DBMS_Scheduler

    Hello all,
    I have a vb front end that calls a main stored proc which submits scheduler jobs to execute several stored procs asynchronously. Everything is working, except the part that the several stored procs are running twice. In the troubleshooting, I have eliminated the front end from being the culprit and the stored procs themselves. Essentially, when I call the stored proc using dbms_scheduler.create_job, it runs twice, even manually. I am about at wits end trying to figure out why: Using Oracle 11gR2
    I started off setting up the programs
    begin
    --create program
    dbms_scheduler.create_program
    ( program_name => 'prog_name'
    ,program_type => 'STORED_PROCEDURE'
    ,program_action => 'usp_sub_proc_1'
    ,number_of_arguments => 8
    ,enabled => FALSE
    dbms_scheduler.DEFINE_PROGRAM_ARGUMENT
    ( program_name=> 'prog_name'
    ,argument_position=>1
    ,argument_name => 'name'
    ,argument_type=>'VARCHAR2'
    /*the remaining 7 arguments are in code but not display for space reasons*/
    dbms_scheduler.enable('prog_name');
    end;Then the main stored proc executes this code:
    declare v_job_name varchar2(100);
        v_1 varchar(50) := 'All';
        v_2 varchar(50) := 'All';
        v_3 varchar(50) := 'All';
        v_4 varchar(50) := 'All';
        v_5 varchar(50) := 'TEST';
        i_6 integer := 1;
        v_7 varchar(50) := 'TEST_NE';
        ts_8 timestamp := current_timestamp;
    begin
        v_job_name := 'uj_dmo_1';
    dbms_scheduler.create_job (v_job_name
                                            ,program_name => 'prog_name'
                                            ,job_class => 'UCLASS_1'
                                            ,auto_drop => TRUE
    --set parameters
    dbms_scheduler.set_job_argument_value(v_job_name,1, v_1);
    dbms_scheduler.set_job_argument_value(v_job_name,2, v_2);
    dbms_scheduler.set_job_argument_value(v_job_name,3, v_3);
    dbms_scheduler.set_job_argument_value(v_job_name,4, v_4);
    dbms_scheduler.set_job_argument_value(v_job_name,5, v_5);
    dbms_scheduler.set_job_argument_value(v_job_name,6, to_char(i_6));
    dbms_scheduler.set_job_argument_value(v_job_name,7, v_7);
    dbms_scheduler.set_job_argument_value(v_job_name ,8, to_char(ts_8));
    --enable job
    dbms_scheduler.enable(v_job_name);
    --execute job
    dbms_scheduler.run_job(job_name => v_job_name , use_current_session => FALSE);
    end;
    ...And this is where I get the double execution of the job, but I am just not seeing it in my syntax, dba_scheduler_jobs, logging, etc. Any help is greatly appreciated, thanks!!

    Well apparently I will not win any Captain Obvious awards;
    With 34MCA2K2's response with "what doesn't work" for some reason turned the light on. After some more testing here is what I found.
    This code works as expected :
    Exhibit A
    begin
    dbms_scheduler.create_job (job_name =>'TESTER'
                                   ,job_type => 'PLSQL_BLOCK'
                                   ,job_action => 'declare test1 integer := 1; begin test1 := test1 + 5; end;'
                                   ,auto_drop => True
       /*dbms_scheduler.enable('TESTER');   */
       dbms_scheduler.run_job(job_name => 'TESTER', use_current_session =>FALSE);   
    end;As does this:
    Exhibit B
    begin
    dbms_scheduler.create_job (job_name =>'TESTER'
                                   ,job_type => 'PLSQL_BLOCK'
                                   ,job_action => 'declare test1 integer := 1; begin test1 := test1 + 5; end;'
                                   ,auto_drop => True
       dbms_scheduler.enable('TESTER');  
      /*dbms_scheduler.run_job(job_name => 'TESTER', use_current_session =>FALSE);    */
    end;Exhibit A will create the job and is visible in the schedulerjobs view, and the RUN_JOB will execute it even when not enabled, but the pl/sql will not drop the job.
    Exhibit B will create the job and once enabled, executes the job and then drops from schedulerjobs view.
    Therefore, my desired results for running the jobs once asynchronously and dropping immediately is....
    begin
        v_job_name := 'uj_dmo_1';
    dbms_scheduler.create_job (v_job_name
                                            ,program_name => 'prog_name'
                                            ,job_class => 'UCLASS_1'
                                            ,auto_drop => TRUE
    --set parameters
    dbms_scheduler.set_job_argument_value(v_job_name,1, v_1);
    dbms_scheduler.set_job_argument_value(v_job_name,2, v_2);
    dbms_scheduler.set_job_argument_value(v_job_name,3, v_3);
    dbms_scheduler.set_job_argument_value(v_job_name,4, v_4);
    dbms_scheduler.set_job_argument_value(v_job_name,5, v_5);
    dbms_scheduler.set_job_argument_value(v_job_name,6, to_char(i_6));
    dbms_scheduler.set_job_argument_value(v_job_name,7, v_7);
    dbms_scheduler.set_job_argument_value(v_job_name ,8, to_char(ts_8));
    /*enable job*/
    dbms_scheduler.enable(v_job_name);
    /*execute job (Do not execute the code below, it will lead to multiple executions)
    dbms_scheduler.run_job(job_name => v_job_name , use_current_session => FALSE); */
    end;

Maybe you are looking for