Hi Maruthi , and welcome to the forum!
>> How can we create an alert
In PL/SQL, right here:
http://www.dba-oracle.com/t_email_mailing_messages_plsql.htmhttp://www.dba-oracle.com/oracle_tips_10g_utl_mail.htmCODE
create or replace procedure
e_mail_message
(
from_name varchar2,
to_name varchar2,
subject varchar2,
message varchar2
)
is
l_mailhost VARCHAR2(64) := 'burleson.cc';
l_from VARCHAR2(64) := 'linda@remote-dba.net';
l_to VARCHAR2(64) := 'don@burleson.cc';
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn := UTL_SMTP.open_connection(l_mailhost, 25);
UTL_SMTP.helo(l_mail_conn, l_mailhost);
UTL_SMTP.mail(l_mail_conn, l_from);
UTL_SMTP.rcpt(l_mail_conn, l_to);
UTL_SMTP.open_data(l_mail_conn);
UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'From: ' || l_from || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || l_subject || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'To: ' || l_to || Chr(13));
UTL_SMTP.write_data(l_mail_conn, '' || Chr(13));
FOR i IN 1 .. 10 LOOP
UTL_SMTP.write_data(l_mail_conn, 'This is a test message. Line ' || To_Char(i) || Chr(13));
END LOOP;
UTL_SMTP.close_data(l_mail_conn);
UTL_SMTP.quit(l_mail_conn);
END;
/
*****************************************************
>> send an e-mail to the user if the job fails
You simply check the status of the dbms_scheduler job (when others) and invoke the e-nail procedure.
If you don't want to write your own code, see Dr. Hall's book on Oracle Job Scheduling:
http://www.rampant-books.com/book_2005_1_scheduling.htm