Tag Archives: unix

Oracle RDBMS and UNIX/LINUX environmental variables.

Oracle RDBMS installations on UNIX and LINUX require the use of operating system parameters to operate properly. Experienced DBA will take care in setting up the operation system parameter before movement, upgrade, or installation of an Oracle RDBMS system on UNIX and LINUX. This article will cover the necessary OS variables to setup a functioning ORACLE RDBMS system.

Required Variables:

ORACLE_HOME – The ORACLE_HOME variable defines the location of the oracle installation directory. Under the ORACLE_HOME you will find such directories as BIN, DBS, NETWORK, etc. These are all core components of the Oracle RDBMS system. Without proper definition of the ORACLE_HOME most of the Oracle binaries will not execute.

ORACLE_BASE – The ORACLE_BASE variable defines the location (normally one level above the ORACLE_HOME) where the Oracle inventory files are stored and is the root directory of multiple Oracle product installs. If you have several different RDBMS versions installed on your system, normally the varies ORACLE_HOMEs would be located directly under the ORACLE_BASE directory.

ORACLE_SID – The ORACLE_SID defines the name of the instance of your database. Without proper definition of the ORACLE_SID most of the Oracle binaries will not execute.

TNS_ADMIN – The TNS_ADMIN defines the directory where your Oracle networking components are located. This directory will usually include: TNSNAMES.ORA, LISTENER.ORA, and SQLNET.ORA. THE TNS_ADMIN is normally pointed at ORACLE_HOME/network/admin.

PATH – The PATH variable points to all binaries which you may need during
administration and operation of your Oracle Server. In the Oracle environment, it is important to include $ORACLE_HOME/bin in this parameter. NOTE: You will require other executables and the PATH variable will be considerable longer then $ORACLE_HOME/bin.

LD_LIBRARY_PATH – The LD_LIBRARY_PATH variable defines the directories which contain .lib files for your binary executables. The directory $ORACLE_HOME/lib and/or $ORACLE_HOME/lib32 must be defined within this variable. Without properly defining the LD_LIBRARY_PATH variable, errors will arise during execution of Oracle binaries.

NLS_LANG – The NLS_LANG variable defines the National Language Set used within your Oracle database.

PATH – The PATH variable defines the location of every executable required for proper operation of Oracle products. For a DBA, you should edit the PATH variable to include $ORACLE_HOME/bin directory.

OPATCH – The OPATCH variable defines the directory where Oracle OPatch utility is stored. Normally, this is located in $ORACLE_HOME/OPatch. This utility is the normally tool used to install Oracle RDBMS quartly CPU patches.

Nice to have Aliases:

udump – Provides the ability to change directories to your user dump
destination.

cdump – Provides the ability to change directories to your core dump
destination.

bdump – Provides the ability to change directories to your backround dump
destination.

alert – Provides for quick opening of your alert log.

oradata – Provides the ability to change directories to datafile destination.

pfile – Provides for quick opening of your parameter file.

Example .profile file of ORACLE UNIX or LINUX server.

umask 022

ORACLE_BASE = /app/oracle/products
export ORACLE_BASE

ORACLE_HOME = $ORACLE_BASE/10.2.0
export ORACLE_HOME

ORACLE_SID = orcl
export ORACLE_SID

TNS_ADMIN = $ORACLE_HOME/network/admin
export TNS_ADMIN

PATH = $PATH:$ORACLE_HOME/bin
export PATH

OPATCH = $ORACLE_HOME/OPatch
export OPATCH

alias udump=’cd /app/oracle/product/admin/orcl/udump’
alias cdump=’cd /app/oracle/product/admin/orcl/cdump’
alias bdump=’cd /app/oracle/product/admin/orcl/bdump’
alias alert=’vi /app/oracle/product/admin/orcl/bdump/alert_lufs.log’
alias oradata=’cd /app/oracle/product/oradata/orcl’
alias pfile=’cd /app/oracle/product/10.2.0/dbs’

Larry J Catt, 9i, 10g
oracle@allcompute.com
www.allcompute.com

UNIX CRON – Shell script errors with [10]: sqlplus: not found

In normal administration of an Oracle RDBMS on UNIX or LINUX operating systems, the DBA will be required to develop shell and SQL scripts to maintain his/her RDBMS. In fact, to be considered a mid to senior DBA you will need to be well versed in scripting at the OS layer. In this article we will review a common error which occurs in a shell script called by CRON due to a lack of properly set variables.

1. In a normal scenario, the DBA has developed a shell script which calls and executes a SQL script to perform a certain maintenance task. In testing, the DBA executes the script as the oracle software owner and the script performs perfectly. However, when placed in the OS CRON for execution, the following error occurs.

[10]: sqlplus: not found

2. The error occurs because the environmental variables are not being read. Thus, the OS does not know where to find the executable: sqlplus.

3. The solution is to update your shell script and hard code the directory structure for the command sqlplus. An example would be if sqlplus is located in the following path /u01/opt/app/oracle/bin then perform the following:

Replace:

sqlplus

With:

/u01/opt/app/oracle/bin/sqlplus

This completes resolving the error message [10]: sqlplus: not found in a shell script called through CRON.

Larry J. Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com