我是 Oracle DB 的新手,需要帮助解决以下问题。
我正在使用sqlplus (SQL*Plus: Version 21.1.0.0.0
) 连接到Oracle DB 19c。
声明:当我将文件中的 IP 更改为“ ”时,我可以从192.168.0.109
主机(如下:192.168.0.108
192.168.0.106
0.0.0.0
localhost
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
面临的问题:当我将文件中的 IP 更改为主机 IP ( )时,无法从 VM ( 192.168.0.108
) 或 LAN ( ) 中的其他系统进行连接。请在下面找到修改:192.168.0.106
192.168.0.109
listener.ora
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.109)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
错误详情: sqlplus工具报错如下:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
现在,让我也分享一下tnsnames.ora
文件的内容(如果需要):
LISTENER_POLA =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
POLA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pola)
)
)
更多细节:
- Oracle DB 所在的主机 (192.168.0.109) 可从包括 VM 在内的所有其他系统访问
telnet 192.168.0.109 1521
所有系统都显示它已连接。- VM 在 Oracle Virtual Box 6.1 上运行并配置为桥接模式。
- Oracle DB 19c 和 VM 在 Windows Server 2016 之上运行。
查询: 当listener.ora文件配置了主机系统的IP地址(192.168.0.109)时,我需要做哪些配置才能使sqlplus可以从同一局域网内的任何系统连接到Oracle DB?
LSNRCTL 状态的输出:
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 16-MAR-2021 23:18:31
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.109)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date 16-MAR-2021 23:16:07
Uptime 0 days 0 hr. 2 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\Polarbear\WINDOWS.X64_193000_db_home\network\admin\listener.ora
Listener Log File C:\Polarbear\diag\tnslsnr\WIN-4SO5O8T8UJ6\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.109)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
命令 sqlplus / as sysdba 的输出:
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 17 00:00:29 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select count(*) from dba_tables;
COUNT(*)
----------
2182
也许在你的 listener.ora 中添加这样的东西:
您可以运行此查询来验证您的全局名称:
SID 应该是
鲍比