Oracle

ORA-12504: TNS: 未給出監聽器

  • March 8, 2017

我用可插拔數據庫創建了容器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(空格而不是下劃線)。修復它,然後重試。

引用自:https://dba.stackexchange.com/questions/166538