I want to set the environmental variables for OracleDB and SqlPlus properly. However, they are overriding each other. I'm doing something wrong, and I would like to get a hand finding where I went wrong.
Setup:
Oracle Linux 7
OracleDb 12.1.0.2.0 (12c)
Sqlplus 12.2.0.1.0
Here is my scenario.
Step 1: First, I set the environmental variables for OracleDB in "One" terminal window, as follows
[myuser]$ export ORACLE_HOME=/u02/app/oracle/product/12.1.0.1/dbhome_1
[myuser]$ export ORACLE_SID=o12c
[myuser]$ export LD_LIBRARY_PATH=/usr/lib:$ORACLE_HOME/lib
[myuser]$ export PATH=$ORACLE_HOME/bin:$PATH
Step 2: Second, I set the Environmental Variables for SQLPLUS in the "One" terminal window used in step 1, as follows:
[myuser]$ ORACLE_HOME=/usr/lib/oracle/12.2/client64
[myuser]$ PATH=$ORACLE_HOME/bin:$PATH
[myuser]$ LD_LIBRARY_PATH=$ORACLE_HOME/lib
[myuser]$ export ORACLE_HOME
[myuser]$ export LD_LIBRARY_PATH
[myuser]$ export PATH
Then, I perform the following command.
[myuser]$ sqplus / as sqldba
Which comes back with the following error.
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jun 27 18:57:44 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Enter user-name:
If I enter any user name (currently logged on user included), I get the following error:
Enter user-name: sysdba
Enter password:
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Lastly, if I try to execute the "nolog" command, I get the following.
[oracle@localhost Desktop]$ sqlplus /nolog
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jun 27 19:01:10 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
And, I tried to enter the conn / as sysdba command, and I get the following:
SQL> conn / as sysdba
ERROR:
ORA-12545: Connect failed because target host or object does not exist
If I run the command, "env" I get the last Oracle_home variable set. In the scenario described above. It's SQLPlus Oracle_Home.