cat > dep.sql
SET MARKUP HTML ON SPOOL ON
set termout off
set pages 999
set pagesize 999
set feedback off
SET MARKUP HTML ON TABLE “class=sysaud cellspacing=2 border=’2′ width=’95%’ align=’center’ ” ENTMAP OFF
spool dep.html
set pagesize 1000
set pause off
set linesize 150
prompt
prompt Failed Jobs
prompt
prompt
/* Below can be any query based on your requirement*/
select * from dept;
spool off
exit
cat > dep.sh
. ~/.bash_profile
Inst_name=echo $TWO_TASK|tr [a-z] [A-Z]
Mail_id=appsdba@appsdba.info
output_report=/home/oracle/scripts/jobsfailed.html
export content=${output_report}
export subject=”FND Debug Profile is enabled in ${Inst_name}”
rm -f ${output_report}
cd $HOME/scripts
sqlplus scott/tiger @/home/oracle/scripts/dep.sql
echo “Sending email”
(
echo “Subject: $subject”
echo “To: $Mail_id”
echo “MIME-version: 1.0”
echo “content-Type: text/html”
echo “content-Disposition: inline”
cat $content
) | sendmail -t