情况如下:
我有一台电脑(我们称之为服务器电脑,其 IP 为192.168.1.100
),其中安装了 ORACLE。我可以使用 Python 访问此 oracle 中的数据服务器电脑(这意味着监听器正在运行服务器电脑)。 这里是监听器在此服务器电脑:
# listener.ora Network Configuration File: C:\app\413022472\product\12.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
#(SID_NAME = CLRExtProc)
(SID_NAME = orcl)
(ORACLE_HOME = C:\app\413022472\product\12.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\413022472\product\12.2.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
#(HOST = DESKTOP-2RE9AJU)
并且 tnsnames.ora 上服务器电脑:
# tnsnames.ora Network Configuration File: C:\app\413022472\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
#(HOST = DESKTOP-2RE9AJU)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
#(SID = CLRExtProc)
(SID = ORCL)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
#(HOST = DESKTOP-2RE9AJU)
现在我想使用另一台电脑(我们称之为客户端电脑)连接服务器 PC 上的数据库Oracle
。客户端电脑但是PL/SQL Developer
和已经安装好了,我打开PL/SQL,在-中instantclient
添加和的路径instantclient
,然后在-中添加,然后在文件夹中添加一个文件,如下图所示:oci.dll
tools
preference
username/key@//192.168.1.100:1521/orcl
history log
fixed user
tnsnames.ora
instantclient
# tnsnames.ora Network Configuration File: C:\app\413022472\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
#(SID = CLRExtProc)
(SID = ORCL)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
两台 PC 的防火墙都已关闭。它们可以成功 ping 通对方。我cmd
也在客户端电脑:telnet 192.168.1.100 1521
,也已成功连接。
但当我尝试连接数据库时它就失败了服务器电脑使用客户端电脑使用 PL/SQL Developer。它给我:ORA-12541: TNS:no listener
。有人能给我一些建议吗?感谢您的关注。