3 Replies Latest reply: May 29, 2014 9:13 AM by spajdy RSS

    How to configure dbms_scheduler to spool the output of particualr job and email it

    user598419

      Hi,

       

      I have a requirement capture the DBMS_SCHEDULER_JOB (SQL/PLSQL) output and email it.

       

      E.G

       

      Begin

      DBMS_SCHEDULER.CREATE_JOB (

      job_name                => 'TBS_Monitoring',

      job_type                    => 'PLSQL_BLOCK',

      job_action                => 'select * from v$tablespace;',

      start_date                 => SYSTIMESTAMP,

      repeat_interval        => 'freq=hourly; byminute=0; bysecond=0',

      end_date                  => null,

      job_class                 => 'DEFAULT_JOB_CLASS',

      enabled                    => TRUE,

      auto_drop                 => FALSE,

      comments                => 'tablespace monitoring script');

      end;

      /

       

      From the above example, i want to get output of 'select * from v$tablespace' and email it.

       

      I understand dbms_scheduler has predefined events(start, complete, failed) for which it can fire emails.. But can it capture the SQL output and email it?