Problem
Trying to connect to Oracle database instance directly from server command line. Once you have access to file system, you can connect to an instance without providing sys DB user credentials:
sqlplus / as sysdba
After a try get this error message:
ORA-12162: TNS:net service name is incorrectly specified
Solution
This may hapen because of not complete database server enviroment setup. In more particular – ORACLE_SID enviroment variable might be missing. If your DB SID is i.e. “mydb”, then you should assign it to ORACLE_SID. In linux it would look like this:
export ORACLE_SID=mydb
There is also necessary ORACLE_HOME enviroment variable to be set to run this command. But once you are able to run sqlplus, it menas ORACLE_HOME variale is OK. Otherwise you’d get another error message:
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
Shortly saying, if ORACLE_HOME and ORACLE_SID enviroment variables are in place, you should not experience issues.
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0