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

1.Oracle客户端的安装:

Oracle的安装这里不再细说,网上的安装图解也很详细,Oracle安装完之后,就安装Oracle的客户端,首选从Oracle的官方网站上下载客户端,大小差不多700M的样子,这里使用的是Oracle11g版本,解压之后的目录结构如下:

点击“setup.exe”文件,启动安装程序,具体的安装配置详图参考:

http://www.cnblogs.com/jiguixin/archive/2011/09/09/2172672.html

2.启动客户端工具,SqlDeveloper

在“Connect”的时候出现了“ORA-12505,TNS:listener does not currently know of SID given in connect descriptor”的错误信息。

此时的“tnsnames.ora”文件内容如下:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLR_CONNECTION_DATA = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
    (CONNECT_DATA = 
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    ) 
  ) 
“listener.ora”的内容如下:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

3.解决方案:

在网上找了很多,也尝试了很多,最终找到了相应的解决方案:

修改“listener.ora”文件的内容:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
     (SID_DESC =
      (SID_NAME = XE)
      (ORACLE_HOME =C:\oraclexe\app\oracle\product\11.2.0\server)
      (GLOBAL_DBNAME = XE)
    )

  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)


其中红色部分是新添加的内容,这样重新启动Oracle的服务之后,SqlDeveloper就能够成功的连接到数据库的实例了。


参考资料:

http://samfeng.blog.51cto.com/52272/774543

http://www.cnblogs.com/simie/archive/2007/06/03/769312.html


你可能感兴趣的:(数据库)