使用 SID 的 Oracle EasyConnect 连接字符串?

标签 oracle ora-12154 ora-12514

我正在尝试使用 EasyConnect 连接字符串通过代码(Ruby/DBI,但这无关紧要)连接到 Oracle 数据库。所有 Oracle 文档都说要将连接字符串指定为//hostname:port/service_name。我没有需要连接的数据库的 service_name,我有一个 SID。有没有办法使用 SID 而不是服务名称来创建 EasyConnect 连接字符串?

我的连接代码如下所示:
DBI.connect("DBI:OCI8://localhost:9000/the_sid", "username here", "password here")
我一直在尝试不同的事情,根据我的尝试,我收到以下两个错误消息之一:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBI::DatabaseError)
ORA-12154: TNS:could not resolve the connect identifier specified (DBI::DatabaseError)

最佳答案

您是否尝试将 SID 作为 SERVICE 名称?您通常可以指定请求服务的 SID。 SERVICE_NAMES 通常默认为 SID。在 SQL 命令提示符下,输入:

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      sid

SQL> 

VALUE 列中的值是数据库注册为的服务名称。

关于使用 SID 的 Oracle EasyConnect 连接字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4650014/

相关文章:

java - 删除行和删除表锁oracle

oracle - 将 OpenSSL 生成的私钥导入 Oracle Wallet

sql - 如果按条件延长时间,Oracle 查询不返回任何结果

oracle - TNS :could not resolve the connect identifier specified

oracle - ORA-12154 : TNS:could not resolve the connect identifier specified

c# - Entity Framework 在左连接时强制内连接 DefaultIfEmpty() 使用的语法

oracle - Delphi XE 5试用-ORA-12154问题

oracle - ORA-12514 TNS :listener does not currently know of service requested in connect descriptor

.net - OracleClient + 与 .NET 的无 TNS 连接