Certain Linux machines won’t have ORACLE profile set globally for all users, So if you need to invoke oracle command line commands like tnsping from command line without navigating to ORACLE installation directory then you have to do the following.
- Go to your home directory and update “.bashrc_profile” to add the following
# oracle profile if [ -f $HOME/.oracle ] ; then . $HOME/.oracle fi
- Go to your home directory and add a new file “.oracle” with below contents, The ORACLE_HOME will change based on your oracle installation directory and oracle version.
# oracle home path export ORACLE_HOME=/opt/oracle/client/product/12.1.0/64bit_client export TNS_ADMIN=$ORACLE_HOME/network/admin export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH CLASSPATH=.:$ORACLE_HOME/jdbc/lib/classes12.zip:$ORACLE_HOME/jdbc/lib/nls_charset12.zip export CLASSPATH LD_LIBRARY_PATH=$ORACLE_HOME/lib export LD_LIBRARY_PATH export PATH=$ORACLE_HOME/bin:$PATH