web伺服器開發遇到的坑
阿新 • • 發佈:2018-12-30
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了。