LINUXOR.SK ... open source notes ...

Oracle RAC - .bash_profile of the user oracle

category: solutionz · date: 2016-12-31 · updated: 2026-10-02 · author: LALA

Oracle RAC Solution · Config document · referenced from Database creation and user environments

noteThe if tests in this file compare against strings in typographic quotes (“oracle”, “/bin/ksh”). They can never be true, so the ulimit lines never run. The file is shown as it was; do not copy that block.

The login profile of the database owner oracle. It sets the environment for the database home and the local instance, and defines the two aliases that switch the same shell to the Grid Infrastructure home and back.

ItemValue
Path/home/oracle/.bash_profile
Shown hereoradb01
Deployed onoradb01 and oradb02, two lines differ
Read byevery login shell of oracle, for example su - oracle
Owner and modenot in the notes
Used withgrid_env and db_env

The file

bash
# Settings specific to the user "oracle"
umask 022

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=oradb01.example.net; export ORACLE_HOSTNAME
ORACLE_UNQNAME=clsdb; export ORACLE_UNQNAME
ORACLE_BASE=/data/u01/app/oracle; export ORACLE_BASE
ORACLE_SID=clsdb1; export ORACLE_SID
ORACLE_HOME=/data/u01/app/oracle/db11204; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
GRID_HOME=/data/u01/app/grid11204; export GRID_HOME
DB_HOME=$ORACLE_BASE/db11204; export DB_HOME

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

BASE_PATH=/usr/sbin:$PATH:$HOME/bin; export BASE_PATH
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH

alias sql='sqlplus / as sysdba'
alias grid_env='. /home/oracle/grid_env'
alias db_env='. /home/oracle/db_env'

On the second node the notes show only the two lines that differ:

HostLineValue
oradb01ORACLE_HOSTNAMEoradb01.example.net
oradb02ORACLE_HOSTNAMEoradb02.example.net
oradb01ORACLE_SIDclsdb1
oradb02ORACLE_SIDclsdb2

The typographic quotes

The block under "User specific environment and startup programs" looks pasted from a formatted document: the quotes around oracle and /bin/ksh are the curly characters “ and ”, not the ASCII ". To the shell they are ordinary characters and part of the word. The first test therefore compares the user name oracle with the eight-character string “oracle”, which is never equal, and nothing inside the outer if runs: neither the ksh branch nor the else branch. No error is printed, which is why it went unnoticed.

The consequence is small, because the limits do not depend on this file. The hard and soft limits of oracle come from limits.conf, and /etc/profile.local carries a working block of the same kind, with ASCII quotes and with other values (131072). The block here is dead text.

The other lines

LineWhat it does
umask 022Files created by oracle are readable by group and others
ORACLE_HOSTNAMEThe public name of the node, differs per node
ORACLE_UNQNAME=clsdbThe unique name of the database
ORACLE_SIDThe local instance, clsdb1 or clsdb2
GRID_HOME, DB_HOMENot read by Oracle. They are the two values grid_env and db_env copy into ORACLE_HOME
BASE_PATHThe PATH as it was before any Oracle directory was added, plus /usr/sbin and $HOME/bin. PATH is always rebuilt from it, so switching homes replaces the Oracle bin directory and does not pile up entries
alias sqlsqlplus / as sysdba, operating system authentication through the group dba
alias grid_env, alias db_envSource the two environment files into the current shell

Checked against Oracle AI Database 26ai

As builtToday
umask 022 in the profile of the software ownerStill required, in the same words in the 11.2 and the 26ai installation guides
ulimit block in the profileNot in the 11.2.0.4-era or the current guides. Limits are set in limits.conf only and checked with ulimit -Sn, -Hn, -Su, -Hu
ORACLE_UNQNAME exported for the databaseDBCA no longer needs ORACLE_UNQNAME set in the environment

The block that does not work is also the block that is not needed.

← solutionz