Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Scheduled job completion verification

Oracle Database Tips by Donald Burleson

 

When scheduling jobs via dbms_scheduler or on a cron, all jobs should be configured to look for an affirmative completion message and complain if it is not found.

Many PL/SQL jobs will contain the affirmative message "successfully completed.".

 
For all of our scheduled jobs, we must grep for this and only send an e-mail when the message "successfully completed." IS NOT found.  For example, a cron job may look like this:

00 07 * * * /home/get_stats.ksh > /tmp/cleanup.lst

The code inside this ksh file will access Oracle and you can spool and check, like this:

#!/bin/ksh
 
# First, we must set the environment . . . .
ORACLE_SID=$1
export ORACLE_SID
ORACLE_HOME=`cat /etc/oratab|grep $ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
MON=`echo ~oracle/bei`
export MON
 
# Enter SQL*Plus and spool output:
$ORACLE_HOME/bin/sqlplus -s perfstat/perfstat<<!
 
spool $MON/run_job.lst
exec my_stored_procedure
spool off
 
exit
!

# Now we look for the "successfully completed."
# message from the PL/SQL procedure
# We can simply grep for it and send an alert
# if it's not in the output
 
rm -f /tmp/check.lst
 
grep -i "successfully completed." \
   ~oracle/bei/run_job.lst > /tmp/check.lst

var=`cat /tmp/check.lst|wc -l`

echo $var
if [[ $var -lt 1 ]];
then
  echo "Job Execution Error"
  cat /tmp/cleanup.lst|mailx \
     -s "Our job failed!"\
     lellison@mycompany.com

 
 

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.