Oracle Environment Variables
.profile
Add the following to the bottom of the .profile or .bash_profile as appropriate...
If you are performing this installation as part of an upgrade, you should copy the original .profile or .bash_profile to a file with a different name and update as needed. This gives you the flexibility to switch environments as necessary. The new file can then be copied over the original file once the upgrade is complete.
# Check your default PATH and incorporate into this variable if necessary.
# Common practice would be to prepend $PATH to this variable but we want to be able to
# switch Oracle environments by running individual .profile files
# Using $PATH prepended would result in the PATH growing which can give unexpected results
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$HOME/.local/bin:$HOME/bin:/etc:/usr/ucb:/usr/bin/X11:.
export PATH
# Database Variables
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/122010ORCL1
export ORACLE_SID=ORCL1
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
# Java Variables (Optional)
export PATH=$PATH:$ORACLE_HOME/jdk/bin
export CLASSPATH=$ORACLE_HOME/jdk/lib
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/jdbc/lib/ojdbc8.jar:.
# Swingbench & Related Tools (Optional)
export PATH=$PATH:/u01/dba/swingbench/bin
export PATH=$PATH:/u01/dba/dbtimemonitor/bin
export PATH=$PATH:/u01/dba/MonitorDB/bin
# DBA Automation Variables
export LISTENER_NAME=listener1
export WALLPATH=/home/${USER}/wallet
# DBA Patch Variables
case $(uname) in
AIX) export P_OS=AIX64-5L
export AIXTHREAD_SCOPE=S
;;
Linux) export P_OS=Linux-x86-64
;;
esac
export PATCH_SERVE=mypatchserver # Local Management Server
export PTAR=122010 # This is the number that appears in patch download files
. /u01/dba/patcher/.alias # Set aliases (used to simplify patching)
# APEX Variables (only required if you use APEX on this instance)
export APXHST=$(hostname -s) # Hostname of Source database
export APXPRT=$(lsnrctl stat $LISTENER_NAME | grep PORT | head -1 | awk -F"PORT=" '{sub(/ .*/,"",$2);print $2}' | sed 's/)//g') # Port of Source database
export APXSID=${ORACLE_SID} # ORACLE_SID of Source database
export APXDIR=/u01/img/apex/18.1 # Installation Directory of Current version of APEX
export CLASSPATH=$CLASSPATH:$APXDIR/apex/utilities
# OEM Agent Variables
# - required if OEM Agent deployed for this host
export EMAGENT_HOME=/u01/app/em13/agent_13.3.0.0.0
# Other
# - Include time in date format
# - Show ORACLE_SID in command prompt
# - Show ORACLE_SID in Putty Window Title
export NLS_DATE_FORMAT='YYYY-MON-DD HH24:MI:SS'
export PS1="\${ORACLE_SID} $ "
printf "\033]0;"${ORACLE_SID}"\007"
Execute the .profile to make it take effect...
. .profile
or
. .bash_profile
Aliases
In linux, add these to .bashrc
NOTE: See also: MPatcherORCL1/2/3/4 are used as an example for switching between alternate instances on a single hostmenu is a script for performing various common functions after login# User specific aliases and functions
alias ORCL1='. /home/oracle/.bash_profile.ORCL1'
alias ORCL2='. /home/oracle/.bash_profile.ORCL2'
alias ORCL3='. /home/oracle/.bash_profile.ORCL3'
alias ORCL4='. /home/oracle/.bash_profile.ORCL4'
alias menu='/home/oracle/menu.sh'