oracle - 使用没有钱包的 sqlplus 连接到 Oracle 自治数据库

标签 oracle sqlplus

我正在尝试使用 EZ CONNECT 字符串连接到 Oracle 自治数据库:user/password@host:port/service_name

我已经配置了从我需要连接的 IP 地址的访问,并将 mTLS 设置为不需要:

Oracle Autonomous Database Network Settings

因此,我使用从控制台下载的钱包时,可以成功连接到数据库。

但是如果我尝试使用 EZ CONNECT 字符串连接到数据库,我会收到以下错误:

sqlplus -l user/password@tcp://adb.us-sanjose-1.oraclecloud.com:1521/service_name_high.adb.oraclecloud.com

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 25 00:19:38 2022
Version 19.8.0.0.0

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

ERROR:
ORA-12547: TNS:lost contact


SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

是否可以使用 EZ CONNECT 字符串连接到自治数据库?如果是,那我做错了什么?

更新 1:

我还尝试使用完整的连接字符串

sqlplus -l user/pass@'(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-sanjose-1.oraclecloud.com))(connect_data=(service_name=xxxxxxx_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)(ssl_server_cert_dn="CN=adb.us-sanjose-1.oraclecloud.com, OU=Oracle ADB SANJOSE, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))'

但随后连接失败并出现以下错误 ORA-28759: failure to open file.

我怀疑这是一些安全设置,但我可以清楚地看到我的 IP 已启用,并且由于使用相同的安全设置我可以连接双向 TLS 和钱包,我不明白问题出在哪里。

最佳答案

您可以配置 Autonomous 以允许在没有钱包的情况下进行连接:

https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/support-tls-mtls-authentication.html

(看起来像你那样做)

但是您仍然需要 TCPS 而不是 TCP: https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/connect-jdbc-thin-tls.html - 你需要通过安全部分,今天不能以短格式通过安全部分(请参阅无钱包连接)。

PS:自治专用 (ADB-D) 允许使用纯 TCP 连接。

关于oracle - 使用没有钱包的 sqlplus 连接到 Oracle 自治数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72369746/

相关文章:

sql - 在触发器的 WHEN 中错误使用绑定(bind)变量

sql - Oracle SQL 在同一个表的多个上选择 null

sql - SQL 字符串中的转义 & 字符

linux - 有什么方法可以控制 Bash here 文档中的参数扩展吗?

oracle - 无法连接到 Azure 中的 Oracle 服务器 - ORA-12514 : TNS:listener does not currently know of service requested in connect descriptor

sql - 如何在sql*plus中执行动态sql语句

oracle - 无需DBA权限即可更改不同数据库下多个模式的密码?

sql - 选择查询输出不符合预期

java - Oracle 看到的字符串的真实长度

oracle - Jpa - Hibernate ManyToMany 在连接表中进行多次插入