2 Replies Latest reply: May 15, 2014 10:00 AM by joey RSS

    Individual Email Notification for Job Failed

    joey

      I have a need to send a separate email notification to the user if one specific job failed.  This is a scheduled job. 

       

      My initial idea is:

      *Modify the post export batch script to create a file that serves as a flag whether the process completed or not.

      *Set up a scheduled job (Windows, not Data Pump) to run after the normal job should have completed.  If the flag file is not present, send an email to the user.

       

      This just seems pretty ugly to me.  Are there any other ideas on an individual email notification for failure of a specific job?  Thanks for any ideas or past experience!

        • Individual Email Notification for Job Failed
          Gareth Horton

          Joey

           

          If you have 8.5, then the best idea is to create some post-process script to create a custom alert for this specific process.

           

          For Each ev As JobLogEvent In Log.GetEvents()

          ' TODO: Operate on JobLogEvent 'ev' as desired.

          If ev.Alert = "SystemAlertProcessFailed" then

               Log.AddEvent("The Specific Process Failed", "Process_Specific_Failed")

               end if

          next

           

          This will raise an alert called "Process_Specific_Failed" which you can then create an alert for on the alerts page.

           

          Gareth     

           

          Originally posted by Joey:

          I have a need to send a separate email notification to the user if one specific job failed.  This is a scheduled job. 

           

          My initial idea is:

          *Modify the post export batch script to create a file that serves as a flag whether the process completed or not.

          *Set up a scheduled job (Windows, not Data Pump) to run after the normal job should have completed.  If the flag file is not present, send an email to the user.

           

          This just seems pretty ugly to me.  Are there any other ideas on an individual email notification for failure of a specific job?  Thanks for any ideas or past experience! [/b][/quote]

          • Individual Email Notification for Job Failed
            joey

            Thanks for your suggestion! I think it will work very well for our situation.  I'm going to need a little help on Data Pump scritping.  Up until this point all that I've done is call batch scripts.

             

            I set up an event AMS_FAILURE with the specific email that I would like to send.  Then I added this scipt to the Post Process Script.

             

            For Each ev As JobLogEvent In Log.GetEvents()

             

            If ev.Alert = "SystemAlertProcessFailed" then

                 Log.AddEvent("AMS REPLICATION FAILED", "AMS_FAILURE")

            end if

            next

             

            I see that this is working pretty well but I need to tweak it a little, and haven't been able to figure out how from the Help File. 

             

            The biggest problem is that I have an input distribution for this Process.  Every time this runs successfully, I seem to now get an error in the Post Process because the input files cannot be found (they were already moved).  I did not get this error before the script.  Any ideas on what I need to tweak to avoid this error?

             

            The other issue is that I think I'll need to add more error checks.  For example I'd need to check for ev.Alert = "SystemAlertDistributionError" as well as "SystemAlertJobFailed" and a few others. If these have happend, I'll need to add the event.  Does this sound correct? 

             

            Thanks for your help!