sqlplus: command not found

Hi,
Im trying to connect to an Oracle database running on Red Hat, but I get the following message when trying to start SQL*Plus


$ sqlplus
-bash: sqlplus: command not found


This is the first time Im trying to connect to the database.
Could you help me/suggest a solution/reason why this is happening?
Thank you,
Deepak

 

deepakeeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jinesh KamdarCommented:
Set your ORACLE_HOME env. variable with the right path and export $ORACLE_HOME before connecting to SQLPLUS.
0
johnsoneSenior Oracle DBACommented:
Definitely sounds like your environment is not set correctly.

At a minimum, I would set these:

ORACLE_HOME - directory where Oracle is installed
ORACLE_SID - database you want to connect to
PATH - add $ORACLE_HOME/bin
LD_LIBRARY_PATH - add $ORACLE_HOME/lib
0
schwertnerCommented:
You have to do this as 'oracle' user, i.e. the user who belongs to the group 'oinstall'
or 'dba'.
As said above this user has to have a working PATH variable to the $ORACLE_HOME/bin directory and also the right to read from this directory.

You can also locate   the $ORACLE_HOME/bin  directory and to try to run
% ./sqlplus /nolog
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

deepakeeAuthor Commented:
Thank you for your comments.
How do I set the environment variable in order to be able to run SQL*Plus?
My id belongs to the group dba.
I'm new to shell scripting/Linux.
0
Jinesh KamdarCommented:
ORACLE_HOME is the base installation folder where Oracle is installed. Find this base folder and set an env. variable for it. E.g.

ORACLE_BASE=/svrname/oracle
ORACLE_HOME=$ORACLE_BASE/product/9.2.0
ORACLE_SID=dbname
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sonicefuCommented:
try this

.\sqlplus

----------------
find where is sqlplus

$ find -name sqlplus
-----------------------
set path for example
export ORACLE_HOME=/path/app/oracle/product
0
dalebettsCommented:
find / -name "sqlplus" -print

cd to this directory

export ORACLE_SID=<sid>

then run the sqlplus command
0
anandmahajanCommented:
maybe you can search for oracle installations under cd /var/opt/oracle

there must be a file called oratab  do more on it look for different types of installation

it will look something like this


# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
TEST1:/opt/u01_test/oracle/product/10.2.0:N
TEST2:/opt/oracle/product/10.2.0:N

here TEST1 and TEST2 represent ORACLE_SID and
rest represent PATH for ORACLE HOME

once u identify which instance u want to connect to do as what  jinesh has suggested:

ORACLE_BASE=/svrname/oracle
ORACLE_HOME=$ORACLE_BASE/product/9.2.0
ORACLE_SID=dbname
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH


0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.