Saturday 9 October 2010

ORA-12162: TNS:net service name is incorrectly specified

[oracle@Grid-EM ~]$ echo $ORACLE_SID

oraworld

[oracle@Grid-EM ~]$ echo $ORACLE_HOME

/oracle/product/11.2.0/dbhome_1

[oracle@Grid-EM ~]$ echo $TNS_ADMIN

[oracle@Grid-EM ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 9 13:59:01 2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn / as sysdba

ERROR:

ORA-12162: TNS:net service name is incorrectly specified

]$ cat initoraworld.ora

###########################################

# Database Identification

###########################################

db_domain=Grid-Em.co.uk

db_name=oraworld


*************** parameter file is case sensitive it follow ORACLE_SID variable value.

it means if ORACLE_SID=ORAWORLD then parameter file should be initORAWORLD.ora , spfileORAWORLD.ora

and if ORACLE_SID=oraworld then parameter file should be initoraworld.ora ,spfileoraworld.ora ******************************************************

[oracle@Grid-EM ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-OCT-2010 14:06:39

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=Grid-EM.co.uk)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date 09-OCT-2010 13:13:37

Uptime 0 days 0 hr. 53 min. 2 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /oracle/diag/tnslsnr/Grid-EM/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Grid-EM.co.uk)(PORT=1521)))

Services Summary...

Service "Oracle8" has 1 instance(s).

Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...

Service "oraworld" has 1 instance(s).

Instance "oraworld", status UNKNOWN, has 1 handler(s) for this service...

Service "oraworld.Grid-Em.co.uk" has 1 instance(s).

Instance "oraworld", status READY, has 1 handler(s) for this service...

Service "oraworldXDB.Grid-Em.co.uk" has 1 instance(s).

Instance "oraworld", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@Grid-EM ~]$ export ORACLE_SID=oraworld

[oracle@Grid-EM ~]$ export ORACLE_HOME=/oracle/product/11.2.0/db_home1

--- sometimes even though "echo" display value of "ORACLE_SID & ORACLE_HOME" but they are not defined in environment. So it better we "export" it again manually and try it which I did in above steps.

[oracle@Grid-EM ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 9 14:08:20 2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn / as sysdba

Connected to an idle instance.

everything was fine here Listener.ora,TnsNames.ora,Init.ora but Only Environment variable ORACLE_SID was not "export" properly.

******************** **********Some times small mistake create big chaos***************

if you lost your init.ora you may get some where here "/oracle/admin/<ORACLE_SID>/pfile"

No comments: