Tuesday, January 29, 2013

ORA-12162 TNS:net service name is incorrectly specified

After creating a new environment and database. I was facing this error. Even trying to logging in sys as sysdba was failing.

[oracle@lab ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 29 15:15:46 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified

Looking into the error doesn't exactly tell what the issue is. This was actually environmental variable related issue. Nothing to do with tns, listener or even with the database.

I'm running oracle on linux. So needs to set ORACLE_HOME and ORACLE_SID variable correctly.

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=labdb; export ORACLE_SID

That's it! Now I'm able to login

[oracle@lab~]$ sqlplus / as sysdba
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production


No comments: