Sunday 27 November 2016

SQLPLUS: Command not found in linux Solution

Hi DBA-Mates,
SQLPLUS command not found. We hit this issue when we trying to connect as shown below example sqlplus '/as sysdba' or sqlplus apps/password.

This is very generic and common error, hope everyone we have faced this issue.
This very simple.

1. We need to check the sqlplus directory under oracle home.

2. If you don't know the oracle database ORACLE_HOME, there is a simple way to find out it as:

$ps -ef|grep lsnr
It will show us the path of ORACLE_HOME, from where you can find out.

3. Check your ORACLE_HOME is set or not from below command.

$echo $ORACLE_HOME
(If it is not set then kindly export it as shown below).

4. Check your ORACLE_SID is set or not, from below command.

$echo $ORACLE_SID

5. Check your $PATH, and set it as shown below in work around give.

Work-around, if the sqlplus not connecting.

For example:

[oracle@ebs dbhome_1]$ sqlplus '/as sysdba'
-bash: sqlplus: command not found
[oracle@ebs dbhome_1]$
So,
[oracle@ebs dbhome_1]$ pwd
/u01/StageR122/oracle/product/11.2.0/dbhome_1

[oracle@ebs dbhome_1]$ export ORACLE_HOME=/u01/StageR122/oracle/product/11.2.0/dbhome_1/

[oracle@ebs dbhome_1]$ echo $ORACLE_HOME
/u01/StageR122/oracle/product/11.2.0/dbhome_1/

[oracle@ebs dbhome_1]$ export ORACLE_SID=ORCL
 

[oracle@ebs dbhome_1]$ echo $ORACLE_SID
ORCL

[oracle@ebs dbhome_1]$ sqlplus '/as sysdba'
-bash: sqlplus: command not found

[oracle@ebs dbhome_1]$ cd sqlplus
 

[oracle@ebs sqlplus]$ ls
admin  bin  doc  lib  mesg

[oracle@ebs sqlplus]$

[oracle@ebs sqlplus]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin

[oracle@ebs sqlplus]$ pwd
/u01/StageR122/oracle/product/11.2.0/dbhome_1/sqlplus

[oracle@ebs sqlplus]$ export PATH=$PATH:/u01/StageR122/oracle/product/11.2.0/dbhome_1/bin/

[oracle@ebs sqlplus]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 11 12:52:30 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL>
SQL> !date
Fri Jul 15 00:18:59 IST 2016

SQL>

I have some more details and steps, if you have still any issues, kindly write to us and let us know. We will be happy to help you. For any concerns or suggestions please write to us either in comment box or contact us @https://ora-data.blogspot.in/

Some more links may also useful:
ORACLE DATABASE
ORACLE APPS
REALTIME/REAL LIFE EXPERIENCES
Jobs Tips
Interviews Q&A 
Regards,

13 comments:

  1. Very usefull, thanks!

    ReplyDelete
  2. Thanks bro,
    but if I open another session, it will not be updated, I think i have to save it in some file like .bash

    ReplyDelete
    Replies

    1. Hi bro,

      Thanks for your feedback.
      Yes you are right and you can include it in your env file or bash file

      Regards,
      ora-data Team

      Delete
    2. Hi,

      Every time i want to connect with SQLPLUS i have to export PATH ORACLE_SID ORACLE_HOME,, even i have export all the variable in .bash_profile as well

      Any clue how to permanently set those variable...?

      Delete
  3. Hi,

    I have tried sqlplus '/as sysdba' either as root or as oracle user an received every time bash: sqlplus: command not found...

    Any clue as I can solve it, please?

    ReplyDelete
    Replies

    1. Dear User,

      Just try as a oracle user.
      And simply add oracle_home/bin in $PATH like export PATH=$PATH:/u01/StageR122/oracle/product/11.2.0/dbhome_1/bin/
      and try again.

      if still now connecting sqlplus then type
      $which sqlplus and check the path it should be in oracle_home/bin.

      Also, check correct path and spelling while exporting.

      Regards,
      ora-data Team

      Delete
  4. still get this result

    bash: ’rlwrap: command not found...

    ReplyDelete
  5. still get this result

    bash: ’rlwrap: command not found...

    ReplyDelete
    Replies

    1. Hi moosa,

      Please check this if can help:
      export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" including $ORACLE_HOME/bin

      Regards,
      ora-data Team

      Delete
  6. Corrigir o meu problema, revisando .bash_profile. Que estava com path errado.

    ReplyDelete
  7. Thank you for the post. It helped to get the work done.

    ReplyDelete

Thank you for your comments and suggestions. It's good to talk you.