Can I create an alert on a user-defined ORA- error?

I want EM to notify me when the following error happens:

raise_application_error(-20118, 'myerror');
  • Does the error appear in the alert log? Oct 13, 2016 at 12:57
  • No it does not.
    – kupa
    Oct 13, 2016 at 13:03
  • Can you make it write to the alert log? Or make it write to a file? It's relatively trivial using Metric Extensions if you can do that. Oct 13, 2016 at 13:18
  • 2
    Look up DBMS_SYSTEM.KSDWRT Oct 13, 2016 at 13:28
  • 1
    After that I have set in "Metric and Policy Settings" metric "Generic Alert Log Error". Thank you.
    – kupa
    Oct 13, 2016 at 14:17

1 Answer 1


You could use DBMS_SYSTEM.KSDWRT to write the error to the alert log when you catch the relevant exception.

Then you can configure Enterprise Manager to alert on that error code. You've two options here:

  1. Modify the regex for the existing error log analysis to cover this error code. This would be much easier, but might be a little inflexible.

  2. Write a Metric Extension to check the alert log for this error. This would be a lot more difficult, but would allow you to create customised error messages and responses to this specific error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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