
The file watcher will need access to the OS to check for files, so we must create a credential for it to log on with.


I've set the interval to 1 minute for these tests, but I would probably not set it that low in a production system. File watchers can be defined to monitor locations on the local server and remote servers, provided they have an agent installed on them.īy default, file watchers only check for the arrival of files every 10 minutes, but this default interval can be changed by issuing the following statement. The examples below show the removal of a specific event notification and all notifications for a specified job.ĭBMS_SCHEDULER.remove_job_email_notification (Ī file watcher is a new scheduler object that enables a new type of event-based job that is triggered by the arrival of a file in a specified location. In both cases, if these are set to NULL (the default values), it is assumed notifications for all recipients/events for the specific job should be removed. In addition to the job_name parameter, it accepts recipients and events parameters. Job_subname% %event_type% Date: %event_timestamp%Įmail notifications are removed using the REMOVE_JOB_EMAIL_NOTIFICATION procedure. Ion - %job_owner%.%job_name%.% Event: %event_type% Oracle Scheduler Job Notificat Job: %job_owner%.%job_name%.%job_subname% We can use the same view to see the subject and body of the email that will be sent for the specific notification. TEST_NOTIFICATION_JOB JOB_FAILED :event.error_code=600 JOB_NAME RECIPIENT EVENT FILTER_CONDITION SELECT job_name, recipient, event, filter_condition We can see the notification details using the %_SCHEDULER_NOTIFICATIONS views. The following notification only fires if a job fails with a "600" error code.įilter_condition => ':event.error_code=600') Recipients => => 'job_started, job_succeeded') It uses the default subject and body.ĭBMS_SCHEDULER.add_job_email_notification ( The following notification fires when the job starts or succeeds. With the job in place we can associate an email notification with it. Repeat_interval => 'freq=minutely bysecond=0', The following job is an empty stub that fires once a minute for 1 hour. Both these scheduler attributes are set below.ĭBMS_t_scheduler_attribute('email_server', ':25') ĭBMS_t_scheduler_attribute('email_sender', we must define a job to associate the notification to. You can also optionally set a default sender address, which is used if the sender parameter is not specified when defining the notification. The events parameter determines which job events fire a notification, while the filer_condition parameter can reduce the notifications by filtering out those events that do not meet specific criteria, based on the SCHEDULER$_EVENT_INFO Object Type.īefore using email notifications, you must tell the scheduler which SMTP server to use to send the emails. Fortunately, the default values of the subject and body parameters provide plenty of information, so customizing these values is not really necessary. The subject and body of the email notification can be customized using a number of variables that are identified using the "%variable-name%" format. The DBMS_SCHEDULER package now includes procedures to control email notifications associated with jobs.Īn email notification is associated with a job using the ADD_JOB_EMAIL_NOTIFICATION procedure. If the value is set to non-zero, both schedulers will be enabled. If the value is set to 0, both schedulers will be disabled. In 11g Release 2, both DBMS_JOB and DBMS_SCHEDULER share the same job queue coordinator, so the value of the JOB_QUEUE_PROCESSES parameter affects both schedulers for the first time. Once again, the latest release of the database comes with new scheduler features.


Since its introduction in Oracle 10g Release 1, the "new" Oracle Scheduler has been improved with every release. Home » Articles » 11g » Here Scheduler Enhancements in Oracle Database 11g Release 2
