1

Good day,

Setup: Oracle 11G on Solaris 10 x86

We'd like to capture the errors/failures of our nightly scheduled procedures/ packages in the OS's syslog. That log will then be sent to a remote NMS managed by the NOC who'll alert the on-call personnel. Can and how can this be done?

Thanks.

| improve this question | | | | |
  • I guess that depends on how exactly you run your "scheduled procedures/ packages". – mustaccio Sep 16 '16 at 21:21
  • A scheduler PL/SQL package manages that. Would like to do something like, exception when others then *Write message to OS's syslog here* commit; raise; – jasmaar Sep 16 '16 at 21:36
3

Of course it can be done, the question is, do you really want this?

Scheduler jobs can raise events (put in a queue). You can capture (dequeue) those events using Advanced Queueing. For example:

Monitoring Job State with Events Raised by the Scheduler

How To Use DBMS_SCHEDULER To Publish Events For Oracle Advanced Queueing (Doc ID 871718.1)

Once you have the events and details, you need to write them to syslog. You can do this by using external procedures, for example:

write to syslog from pl/sql

Or, you could keep it nice and simple, and use the built-in e-mail notification support for Scheduler, for example:

BEGIN
 DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (
  job_name   =>  'EOD_JOB',
  recipients =>  'jsmith@example.com, rjones@example.com',
  sender     =>  'do_not_reply@example.com',
  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;
/

Monitoring Job State with E-mail Notifications

| improve this answer | | | | |
  • Thanks for the response. We need to use the Syslog as the NOC doesn't have a system to scan emails for errors or alert on call via email. I'll take a look at the link. – jasmaar Sep 16 '16 at 21:56
  • community.oracle.com/thread/2343125 Worked perfectly with some tweaking. – jasmaar Sep 20 '16 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.