使用 Oracle SQLDeveloper 时 SID 和服务名称有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25959063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what differences SID and Service Name when use Oracle SQLDeveloper?
提问by Vert
English is not my native please understand
英语不是我的母语请理解
When I try to login like system/password as sysdba to oracle(linux) by sqldeveloper(window)
当我尝试通过 sqldeveloper(window) 以系统/密码作为 sysdba 登录到 oracle(linux) 时
It fail when through Service Name and return ORA-0131 :insufficient privileges
通过服务名称并返回 ORA-0131 时失败:权限不足
but SID? successfully passed
但是SID?顺利通过
what differences? and how to connect with Service Name?
有什么区别?以及如何连接服务名称?
回答by Lalit Kumar B
Thomas Kyte explained the difference beatifully :
Thomas Kyte 漂亮地解释了这种差异:
A service name is more flexible than a SID would be.
A database can dynamically register with a listener using one or more service names. In fact, more than one database can register with a listener using the same service name (think about a clustered environment where you have multiple instances that all are the same database under the covers).
A database on the other hand has a single SID. And a single SID goes to a single database. It is a pure 1:1 relationship.
A service is a many to many relationship.
服务名称比 SID 更灵活。
数据库可以使用一个或多个服务名称向侦听器动态注册。事实上,多个数据库可以使用相同的服务名称向侦听器注册(考虑一个集群环境,其中您有多个实例,这些实例在幕后都是同一个数据库)。
另一方面,数据库只有一个 SID。并且单个 SID 转到单个数据库。这是一种纯粹的 1:1 关系。
服务是多对多的关系。
Service names are used with dynamic registration - the data registers with the listener after it starts up. Once it does that, you can connect.
服务名称与动态注册一起使用 - 数据在启动后向侦听器注册。完成后,您就可以连接了。
With the SID - that is more like telling the listener "I want you to connect to this specific database, I know the 'address', here you go"
使用 SID - 这更像是告诉侦听器“我希望你连接到这个特定的数据库,我知道‘地址’,给你”
With the SERVICE - you are asking the listener to put you in touch with a database that can service your request, a database that registers using that service.
使用 SERVICE - 您要求侦听器让您与可以为您的请求提供服务的数据库保持联系,该数据库使用该服务进行注册。
More information here, https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1508737000346067364
更多信息,https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1508737000346067364
Similar question was asked in Stack Overflow 6 years back, How SID is different from Service name in Oracle tnsnames.ora
6 年前在 Stack Overflow 中提出了类似的问题,SID 与 Oracle tnsnames.ora 中的服务名称有何不同
In your test environment, play around with tnsnames.ora
and listener.ora
. AFAIK, from 12c, Oracle uses only service_name
, since it is flexible and has many to many relationship. I will cross-verify from documention if I find it incorrect.
在您的测试环境中,使用tnsnames.ora
和listener.ora
。AFAIK,从 12c 开始,Oracle 只使用service_name
,因为它很灵活并且具有多对多关系。如果我发现它不正确,我将根据文档进行交叉验证。