Oracle实现远程连接
基于本地主机的TNS配置,实现远程连接
修改 \product\11.2.0\dbhome_1\NETWORK\ADMIN 目录下文件
tnsnames.ora
orcl:192.168.2.137 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.137)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
listener.ora
LISTENER192.168.2.137 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.137)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
lsnrctl start/status/stop 监听器状态
tnsping tnsname 测试TNS连接,eg: orcl:192.168.2.137
若以上配置不成功,参考对应错误检查配置如下
ORA-12541
监听器问题
确认服务端服务名和端口号
服务端 Net Configuration Assisant 重新配置一遍
ps: 本地连接除了普通用户登录,其他都不需要开启listener监听器
ORA-12638
身份证明检索失败
客户端 sqlnet.ora 注释掉#SQLNET.AUTHENTICATION_SERVICES= (NTS)
经测试成功的连接工具如下:
Oracle sql developer 18.0.4
Navicat Premium 12
PL/SQL developer 13.0.2