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

Oracle UNIX/Linux script tips

Shell Variables

Shell variables give us a place to store values for use by the system, our shell, shell scripts or by programs we run.  Each session in UNIX has a set of variables that collectively are referred to as the environmental variables. 

Also see find ORACLE_HOME and find ORACLE_SID scripts.

These variables tell the system where to find applications and documentation, where the user's home directory is, the current working directory and much more.  You can easily view all the environmental variables in the current session with the env command:

$ env
SSH_CLIENT= 54620 22

These are some of the default variables provided by the system.  As Oracle users we?re also familiar with shell variables such as $ORACLE_HOME and $ORACLE_SID.

While most of the environmental variables in the output above are set by the system, variables like $ORACLE_HOME need to be set by the user.  In the bourne and bash shells, environmental variables are set by giving the variable name, the equal sign (=) and then the value the variable should be set to.  The variable must then be exported with the export command so it can become available to subsequent commands.

$ ORACLE_HOME=/u01/app/oracle/product/10.2.0/Db_1
$ export ORACLE_HOME

When setting variables you simply use the variable name; however, as we see in the above example we use the $ prefix to retrieve the value of a variable.  You may also see the variable definition followed by the export on the same line separated by a semicolon.  The semicolon marks the end of the first command allowing the commands to be executed as if they were on separate lines.

These exported environmental variables typically affect how UNIX and Linux behave or how other commands run.  Though not a rule, environmental variable names are typically all uppercase.  Lowercase variable names are typically used for local shell variables that are only needed in the current session or script.  Local shell variables need not be exported.

$ day=Monday
$ echo $day

It's important to remember that shell variables are specific to a session, not a user.  That means if you change the environment variables in one session it will not have any effect on other active sessions.

Beyond the familiar Oracle related shell variables we?ll be using shell variables for storing date information, file and directory names, passwords and much more.



This is an excerpt from the book "Oracle Shell Scripting" by Rampant TechPress. 

You can buy it directly from the publisher for only $34.95.  Also, see the Oracle script collection for over 600 working Oracle scripts to download.



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.