deepakee
asked on
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
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
Set your ORACLE_HOME env. variable with the right path and export $ORACLE_HOME before connecting to SQLPLUS.
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
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
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
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
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this
.\sqlplus
----------------
find where is sqlplus
$ find -name sqlplus
-----------------------
set path for example
export ORACLE_HOME=/path/app/orac le/product
.\sqlplus
----------------
find where is sqlplus
$ find -name sqlplus
-----------------------
set path for example
export ORACLE_HOME=/path/app/orac
find / -name "sqlplus" -print
cd to this directory
export ORACLE_SID=<sid>
then run the sqlplus command
cd to this directory
export ORACLE_SID=<sid>
then run the sqlplus command
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/1 0.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/oracl e
ORACLE_HOME=$ORACLE_BASE/p roduct/9.2 .0
ORACLE_SID=dbname
PATH=$PATH:$ORACLE_HOME/bi n
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
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:<
#
# 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
TEST2:/opt/oracle/product/
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/oracl
ORACLE_HOME=$ORACLE_BASE/p
ORACLE_SID=dbname
PATH=$PATH:$ORACLE_HOME/bi
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH