Pages

Friday 20 January 2012

ORA-12505: TNS:listener does not currently know of SID given in connect descriptor


ORA-12505: TNS:listener does not currently know of SID given in connect descriptor


 When user was connecting to the database though an application, user got the error as below.

Error: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)



Cause: User was unable to connect to database through connect descriptor that we use to connect to database from remote server or from application.

Solution: Since listener is running,try to connect the database manually through connect descriptor that is usually stored in tnsnames.ora file.  Always make sure that connect descriptor has correct db name, hostname and port name.
Eg:

sqlplus user1/pwd@TESTDB

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 20 04:39:03 2012

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

ERROR:
ORA-12505: TNS:listener does not currently know of SID given in connect
Descriptor

Then check your database name in connect descriptor available at tnsnames.ora file.
If that is correct then check your services in listener to find whether requested db is being listened by the listener. You can use below command to check the same.

lsnrctl services listener_name

If db is found, then wait for few seconds and check the connection. If db is not found in the services, then manually register your database to the listener by using below command.

SYS@TEST>alter system register;

Check after few seconds, you will be able to connect to the database using connect descriptor.



2 comments:

  1. 1) Open Oracle Net Manager. In Oracle Net Configuration, open Local, and then, open Listeners.
    2) Select your Listener.
    3) In the upper right ComboBox, select Database Services.
    4) Clic Add Database.
    5) Fill the 3 fields: Global Database Name (i.e. ORCL.NET. In SQL Plus type SELECT * FROM GLOBAL_NAME), Oracle Home Directory (i.e. C:\app\User\product\11.2.0\dbhome_1) and SID (i.e. orcl)
    6) File > Save Network Configuration.
    7) Restart the OracleOraDb11g_home1TNSListener service.

    ReplyDelete