I get incorrect email content from the Oracle (11gR2) schedule job email notification:
The email notification has shows incorrect value for the part of the "Subject".
-- this part should shows another server name.
I separately tested:
On the server and using the same user and I get the correct output (correct server name).
If I re-create a new job and add the email notification (via the same attached code) I get the correct "Subject".
In case the sys_context('userenv') parameter was changed since the scheduled job was created -- the scheduled job will show the old parameter value. I guess I could fix this by dropping and recreating the scheduled job. But that will erase the job history -- I guess so -- if, so that is not a choice.
Otherwise how can I let it show the correct server name in the current job itself....
job_name => 'MY_JOB',
recipients => 'email@example.com',
sender => 'firstname.lastname@example.org',
events => 'job_failed',
subject => 'My Job Failed: %job_owner%.%job_name%'||' - '||SYS_CONTEXT('USERENV','SERVER_HOST'),
body => 'Job Failed: %job_owner%.%job_name% Event: %event_type% Date: %event_timestamp% Error code: %error_code% Error message: %error_message%'