如何从WSL2连接到Windows Oracle数据库

发布于 2025-02-12 13:35:17 字数 1162 浏览 0 评论 0原文

我在Windows10中安装了Oracle 19C数据库,并且在同一笔记本电脑中启用了WSL2。 我想从我的WSL2-Ubuntu发行版中访问数据库。是否可以? 我已经在WSL2中安装了InstantClient和SQLPLUS软件包,但是当我尝试使用SQLPlus连接时,它无法连接到Windows数据库。 有人可以帮助我从WSL2连接到该数据库吗?

sqlplus hr/hr@//172.22.100.119/orcl

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:52:02 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

ERROR:
ORA-12170: TNS:Connect timeout occurred


Enter user-name:
sqlplus

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:50:31 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter user-name: spdorcl@orcl
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name:
sqlplus

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:48:54 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: sys
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified

I have a Oracle 19c database installed in windows10 and also I have WSL2 enabled in same laptop.
I would like to access the database from my WSL2- ubuntu distro. is it possible?
I have installed instantclient and sqlplus package in wsl2 but when I try to connect using sqlplus it couldn't able to connect to the windows database.
can someone please help me to connect to that database from WSL2?

sqlplus hr/hr@//172.22.100.119/orcl

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:52:02 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

ERROR:
ORA-12170: TNS:Connect timeout occurred


Enter user-name:
sqlplus

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:50:31 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter user-name: spdorcl@orcl
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name:
sqlplus

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Jul 1 15:48:54 2022
Version 21.6.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: sys
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文