我尝试使用SQL Developer远程连接到Oracle 12c数据库。为了从另一台计算机远程连接,在运行Oracle的计算机上,我在Windows 7防火墙中打开了一个端口。那部分有效,但现在听众因为这个错误ORA-12505而没让我进入。它说当我尝试连接远程计算机中的SQL Developer时,它无法识别我提供的SID。我甚至尝试将服务名称设置为"编辑器",但仍然没有。
以下是远程计算机上SQL Developer的设置:
在服务器端,这是listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Owner\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Owner\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(SERVICE_NAME = editor)
)
)
REMOTE_LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.19)(PORT = 1531))
(SERVICE_NAME = editor)
)
)
和tnsnames.ora:
EDITOR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.19)(PORT = 1531))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = editor)
)
)
LISTENER_EDITOR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = editor)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
您会注意到默认侦听器在端口1521上设置为localhost。只要保持这样,我就可以使用SQL Developer在服务器上连接。因此,为了远程连接,我为端口1531设置了第二个侦听器集,并输入了服务器的IP地址。防火墙也已设置为允许通过端口1531进行连接。正如您所看到的,我确实编辑了tnsnames.ora文件以允许连接到编辑器数据库,但我的编辑似乎没有解决任何东西。我仍然无法在客户端与SQL Developer连接。在服务器上,我尝试使用Oracle Net Configuration Assistant测试编辑器条目,并收到错误消息:
ORA-12514监听器当前不知道连接描述符中请求的服务。
2014年9月9日更新:
我被要求从命令提示符运行lsnrctl status。以下是该命令的输出:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))(SERVICE_NAM
E=editor))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.1.0 - Produ
ction
Start Date 09-SEP-2014 14:33:06
Uptime 0 days 4 hr. 14 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Owner\product\12.1.0\dbhome_1\network\admin\lis
tener.ora
Listener Log File C:\app\Owner\diag\tnslsnr\Shiers-PC\listener\alert\log
.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc))(SERVIC
E_NAME=editor))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=
editor))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=Shiers-PC)(PORT=5500))(Security=(my
_wallet_directory=C:\APP\OWNER\admin\editor\xdb_wallet))(Presentation=HTTP)(Sess
ion=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "editor" has 1 instance(s).
Instance "editor", status READY, has 1 handler(s) for this service...
Service "editorXDB" has 1 instance(s).
Instance "editor", status READY, has 1 handler(s) for this service...
Service "pdborcl" has 1 instance(s).
Instance "editor", status READY, has 1 handler(s) for this service...
The command completed successfully
好的......所以我该怎么办?
答案 0 :(得分:4)
不要使用SID,使用SERVICE - 根据您的示例显示的'编辑'。
在12c上,如果您要连接到可插拔,那么您将始终需要使用服务。 SID将解析为容器数据库(CDB)。
Ton确认是正确的,在您的服务器上运行'lsnrctl status'命令,并检查侦听器正在侦听的实际服务。
答案 1 :(得分:1)
如果我不能正确理解这个问题,请原谅我。是否涉及3台机器。客户端,监听器和数据库?如果您只是尝试在端口1531上公布数据库,则修改listener.ora文件中的LISTENER部分以包含其他端口
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1531))
(SERVICE_NAME = editor)
)
)
答案 2 :(得分:1)
我在远程计算机上使用SQL Developer。上面的图片是 我试图连接的对话框。我去寻找一个档案 在名为tnsnames.ora的远程计算机上,并没有找到任何。 - 艾伦 9月7日13:58
您需要远程客户端计算机上的Oracle客户端,其中包含与服务器上相同的tnsnames.ora文件。