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 


 

 

 


 

 

 
 

How to Write an Oracle Shell Script

Oracle Database Tips by Donald BurlesonAugust 9, 2015

Check out this valuable book by Jon Emmons on Linux for the Oracle DBA for more tips and tricks.

Suppose there exists a need to find a UNIX script that searches every file on the UNIX server for a file that queries the dba_2pc_pending view. 

Assume the name and location of the file have been completely forgotten, and we need a script to quickly locate our SQL statement.  

  1. The first step is to write a command that will display all file names on the server.  This is quite simple in UNIX, and it returns a list of every file on the server:

 find . -print    

/home/oracle/sqlnet.log
/home/oracle/export.sh
/home/oracle/mon
/home/oracle/mon/a.ksh
/home/oracle/mon/alert.ksh
/home/oracle/mon/count.ksh
/home/oracle/mon/create_mon1_tables.ksh
/home/oracle/mon/fix_db.ksh
/home/oracle/mon/get_vmstat.ksh
/home/oracle/mon/oracheck.lst
/home/oracle/mon/alerts_PROD.lst
/home/oracle/mon/mail_reports.ksh  

  1.  We now have a complete list of all of the UNIX files.  Because we know that the grep commands accepts file names as an argument, we can use xargs to search each file for our Oracle table name:

 >find . -print|xargs grep -i dba_2pc_pending

home/oracle/sql/pending.sql:   dba_2pc_pending  

 find / -print
"add listing"

 This ability to take a basic UNIX command and chain it with other commands is a fundamental principal in UNIX shell programming for Oracle.

 

 
 
 
Get the Complete Details on
Linux System Management for Oracle DBAs  


The landmark book "Linux for the Oracle DBA: The Definitive Reference" provides comprehensive yet specific knowledge on administering Oracle on Linux.   A must-have reference for every DBA running or planning to run Oracle on a Linux platform.

Buy it for 30% off directly from the publisher.
 

 


 

 

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.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster