web服务器开发遇到的坑

1. ## 解决‘ORA-12505, TNS:listener does not currently know of SID given in connect descriptor’ ##

**解决方法:**

打开Oracle的 listener.ora 文件:

(oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora)
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /app/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    //添加此段代码
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL) 
      (ORACLE_HOME = /app/oracle/oracle/product/10.2.0/db_1)
      (SID_NAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = suse10.site)(PORT = 1521))
    )
  )

重新启动 OracleServiceORCL 和 OracleOraDb11g_home1TNSListener 服务。最后试一试,连接成功!

PL/SQL DEVELOPER 和 SQLPLUS 采用 service_name 进行连接

而应用程序是按照 sid_name 进行连接,所以出现 PL/SQL DEVELOPER和SQLPLUS 能够连接而应用程序却无法连接的问题。

使用 SELECT INSTANCE_NAME FROM V$INSTANCE 语句,就可以查看当前数据库实例的sid_name了。

你可能感兴趣的:(Web服务器开发)