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

 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
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

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

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Oracle Shell Scripting Best Practices

Oracle Database Tips by Donald BurlesonDecember 26, 2015

Question: What are the best practices for using OS shell scripts?  I'm charged with managing all the oracle crontab entries on a 16-way Linux server, and we use a variety of shell like ksh, csh and bash.  What are the best practices for using Oracle shell scripts?

Answer:  There is an excellent overview of Oracle shell scripting best practices in book "Oracle Shell Scripting" by Jon Emmons, and see the book "Oracle Job Scheduling" for an overview of using dbms_scheduler for executing external shell scripts within Oracle.

See these important notes on color coding your prompt, OS prompt best practices, and making the prompt include the host name, instance name and current directory.

DBA's have been using cron jobs to schedule external Oracle jobs since the early 1990's, long before Oracle introduced their own job scheduling functionality (dbms_job and dbms_scheduler).  External job include anything that interfaces with OS files such as:

  • Server-side monitoring (e.g. vmstat to Oracle capture scripts)

  • Alert log scanning

  • Trace and dump file management

  • Archived redo log management

  • Automated external batch jobs that interface with other OS utilities

The standards and best practices for shell scripting vary widely between shops, but in general they falls into these areas:

  • Shell script standards - It's always best to standardize on a shell.  Historically, most shops used Korn shell (ksh), but today many shops use the Bourne Again shell (bash).

  • Job invocation best practices - After 10gr2 introduced secure external job scheduling with dbms_scheduler (with the create external job privilege), some shops abandoned cron-based jobs and moved everything into Oracle.  One benefits of scheduling Oracle external tasks via dbms_scheduler is that the job is not "forgotten" if the system is down, as-is the case with crontab entries.  Other shops use more sophisticated job scheduling software such as Appworx, where complex job dependencies exist.

  • Shell coding standards - All shell scripts should follow general coding best practices, including standardized reusable sub-shells for repetitive tasks (e.g. invoking SQL*Plus), and adhere to standards for coding style and comments.  The best references on best practices for Oracle shell scripting in the outstanding book "Oracle Shell Scripting" by Jon Emmons.

See these related notes on Oracle best practices and standards:


If you like Oracle tuning, you might enjoy my book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.



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.