Oracle
ORA-12504: TNS: 未給出監聽器
我用可插拔數據庫創建了容器
orcl2
數據庫pdborcl2
。當我嘗試連接時SQL> connect system@pdborcl2
我收到此錯誤:
ORA-12504: TNS:listener 未在 CONNECT_DATA 中指定 SERVICE_NAME
我的
tnsnames.ora
樣子如下:ORCL2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl2.localhost))) PDBORCL2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdborcl2.localhost)))
我通常可以連接到
orcl2
:SQL> connect system@orcl2
你有
CONNECT DATA
而不是CONNECT_DATA
(空格而不是下劃線)。修復它,然後重試。