While connecting the database as sysdba, we are getting below error:
sqlplus /as sysdba SQL*Plus: Release 126.96.36.199.0 Production on Wed May 10 00:40:31 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. ERROR: ORA-12547: TNS:lost contact
The version of Oracle database used here is 188.8.131.52.0.
The solution is quite simple here. The OS variable ORACLE_BASE was not set specifically here. Just set this variable into the bash profile of oracle user in Linux and you are good to go.
Add ORACLE_BASE variable permanently
To add the ORACLE_BASE environment varibale permanently, edit the bash_profile for oracle user and export the variable in that file.
$ vi ~/.bash_profile export ORACLE_BASE=[your oracle base here]
You can either logout or login again for the changes to take effect or run the bash profile in the same session.
$ . ~/.bash_profile
Add ORACLE_BASE variable temporarily on command line
To add the ORACLE_BASE varibale teporarily on command line, use the below command:
$ export ORACLE_BASE=[your oracle base here]
The above settings are temporary and will go away when you log out and log in back.
To verify if you have set the environment varibale correct, use the Linux command env:
$ env | grep ORACLE_BASE
Or you can simple echo the variable on command line:
$ echo $ORACLE_BASE