Oracle Database 12c on Oracle Linux 6 – Step 21: Edit the oracle User’s .bash_profile and .bashrc

Part of this series of posts: Oracle Database 12c on Oracle Linux 6

21-01

Right-click the desktop and select Open in Terminal.

21-02

Type the following commands, pressing Enter after each command.

cd
gedit .bash_profile

21-03

The previous command will open the oracle user’s existing .bash_profile script.

21-04

Add the lines below to the .bash_profile file.

#Oracle install specific environment settings
umask 022
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH
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

Click Save and select File -> Quit to close gedit.

Note:

What about the old code block that we’ve seen for years in the .bash_profile that looked like this:

if [ $USER = “oracle” ]; then
 if [ $SHELL = “/bin/ksh” ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
fi

Our preinstall script actually sets the correct settings for the oracle user (it puts a file into /etc/security/limits.d/) and not only that, the ‘use this setting when you use ksh as your shell’ is actually wrong. The -p flag is a read only flag, you can’t actually set this.

21-05

Type the following command and press Enter.

gedit .bashrc

21-06

Enter the following lines in the .bashrc file.

alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
alias impdp='rlwrap impdp'
alias expdp='rlwrap expdp'

Click Save and select File -> Quit. If you get a pop-up stating that the backup file couldn’t be created, just click Save Anyway.

Note:

rlwrap allows the up arrow key to return the previously entered command. By default the up arrow doesn’t work in Linux (and other Unix’s) which is very annoying. rlwrap removes that annoyance.

21-07

Type the following commands, pressing Enter after each one.

source .bash_profile
source .bashrc

Note:

Sourcing the files will read their values into your current environment.

Oracle Database 12c on Oracle Linux 6 – Step 20: Download and Extract Oracle Database 12c Grid Infrastructure < Previous Post – Next Post > Oracle Database 12c on Oracle Linux 6 – Step 22: Install Oracle Grid Infrastructure, Oracle Restart and ASM

 


5 responses to “Oracle Database 12c on Oracle Linux 6 – Step 21: Edit the oracle User’s .bash_profile and .bashrc

Leave a comment