The error message ORA-12162 “TNS:net service name is incorrectly specified” is not exactly what it meant.
It suggests that there is a problem with the tnsnames.ora file contents, but in reality the message ORA-12162 “TNS:net service name is incorrectly specified” results from improperly setting your ORACLE_SID value.
To fix this error in Windows, set your $ORACLE_HOME:
c:> set ORACLE_SID=fred
In Linux, these commands sets ORACLE_HOME and $ORACLE_SID as follows:
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
update: instead of asdb you need to specify the DB name you wanna use.