出現數據庫的連接問題可在命令行下使用 tnsping 服務名 來檢查出錯原因。
常見錯誤有:
ORA-12535: TNS: 操作超時
首先關閉防火牆,這是最常見的連接出錯原因。
如果仍然不行,檢查 tnsnames.ora 文件配置,主要是主機名稱是否正確
# TNSNAMES.ORA Network Configuration File: E:\Oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL.DBSE.LAMOST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
(SERVER = DEDICATED)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.dbse.lamost)
)
)
ORA-12541: TNS: 沒有監聽器
在命令行下執行 lsnrctl start 啟動監聽器。