The Third Encounter ....... How to Solve:-> sqlplus: command not found error
The Problem
After I had solved ORA-01034 I created a table then took a break. Coming back to my laptop, I decided to close some apps I had running but they weren't responding.
My VM wasn’t responding so I decided to just close it without shutting it down properly. I got impatient so I tried to end the process using Task Manager. Even after I did this, which is always my go-to solution to close stubborn apps, it didn’t work.
So I decided to hot shutdown my laptop. By the time I started my laptop and logged on to my oracle database I got this error:
bash: sqlplus: command not found.
Not this again, I lamented.
The Solution
So I cracked my knuckles like they do in movies. And I went online to research the best way to solve this. I got my solution here: dba-oracle.com/t_sqlplus_command_not_found...
So I ran the commands below :
ORACLE_SID=orcl export ORACLE_SID ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin export PATH
[oracle@Iamgo0ke Desktop]$ sqlplus
Enter user-name: system
Enter password:
Last Successful login time: Wed Aug 25 2021 16:57:09 -04:00
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options IT WORKS!!!!!!!!!!!!
So to save my settings permanently, because all I have done is to effect this setting in the current session, is to enter this command:
-> vim ~/.bashrc
Type -> i
To insert then paste the settings above in BOLD under “user specific alias and functions”. It should look like this:
#.bashrc
#Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
#User specific aliases and functions
ORACLE_SID=orcl
export ORACLE_SID
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
~
~
~
~
~
~
~
~
~
"~/.bashrc" 14L, 269C
Enter-> Esc on the keyboard
and
Type -> :wq
then press ENTER.
So now our setting is permanent.