SID 与 Oracle tnsnames.ora 中的服务名称有何不同

发布于 2024-07-04 22:26:26 字数 36 浏览 5 评论 0原文

为什么我需要其中两个? 当我必须使用其中一种或另一种时?

Why do I need two of them? When I have to use one or another?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

叫思念不要吵 2024-07-11 22:26:26

根据 Oracle 术语表:

SID 是 Oracle 数据库实例的唯一名称。 ---> 换成
在 Oracle 数据库之间,用户必须指定所需的 SID <---。 这
SID 包含在连接描述符的 CONNECT DATA 部分中
在 TNSNAMES.ORA 文件中以及网络侦听器的定义中
在 LISTENER.ORA 文件中。 也称为系统 ID。 Oracle 服务名称
可以是任何描述性的内容,例如“MyOracleServiceORCL”。 在 Windows 中,
您可以将您的服务名称作为 Windows 服务下的服务运行。

您应该在 TNSNAMES.ORA 中使用 SID 作为更好的方法。

As per Oracle Glossary :

SID is a unique name for an Oracle database instance. ---> To switch
between Oracle databases, users must specify the desired SID <---. The
SID is included in the CONNECT DATA parts of the connect descriptors
in a TNSNAMES.ORA file, and in the definition of the network listener
in the LISTENER.ORA file. Also known as System ID. Oracle Service Name
may be anything descriptive like "MyOracleServiceORCL". In Windows,
You can your Service Name running as a service under Windows Services.

You should use SID in TNSNAMES.ORA as a better approach.

泪眸﹌ 2024-07-11 22:26:26

什么是 SID 和服务名称

请查看 Oracle 文档 https ://docs.oracle.com/cd/B19306_01/network.102/b14212/concepts.htm

如果将来无法访问上述链接,在撰写此答案时,上述链接将引导您前往“数据库网络服务管理员指南”的“连接概念”一章中的“数据库服务和数据库实例标识”主题。 本指南由 oracle 作为“Oracle 数据库在线文档,10g 第 2 版 (10.2)”的一部分发布

什么时候我必须使用其中一个? 为什么我需要两个?

考虑以下 RAC 环境中的映射,

SID    SERVICE_NAME
鲍勃1   鲍勃
鲍勃2   鲍勃
鲍勃3   鲍勃
鲍勃4   bob

如果配置了负载平衡,侦听器将在所有四个 SID 之间“平衡”工作负载。 即使配置了负载平衡,如果您愿意,也可以使用 SID 而不是 SERVICE_NAME 始终连接到 bob1。

请参考,https://community.oracle.com/thread/4049517

what is a SID and Service name

please look into oracle's documentation at https://docs.oracle.com/cd/B19306_01/network.102/b14212/concepts.htm

In case if the above link is not accessable in future, At the time time of writing this answer, the above link will direct you to, "Database Service and Database Instance Identification" topic in Connectivity Concepts chapter of "Database Net Services Administrator's Guide". This guide is published by oracle as part of "Oracle Database Online Documentation, 10g Release 2 (10.2)"

When I have to use one or another? Why do I need two of them?

Consider below mapping in a RAC Environment,

SID      SERVICE_NAME
bob1    bob
bob2    bob
bob3    bob
bob4    bob

if load balancing is configured, the listener will 'balance' the workload across all four SIDs. Even if load balancing is configured, you can connect to bob1 all the time if you want to by using the SID instead of SERVICE_NAME.

Please refer, https://community.oracle.com/thread/4049517

梦境 2024-07-11 22:26:26

@DAC 引用

简而言之:SID = 的唯一名称
您的数据库,ServiceName = 使用的别名
连接时

不完全正确。 SID = INSTANCE 的唯一名称(例如机器上运行的 oracle 进程)。 Oracle 将“数据库”视为文件。

服务名称 = 一个实例(或多个实例)的别名。 这样做的主要目的是,如果您正在运行集群,客户端可以说“将我连接到 SALES.acme.com”,DBA 可以即时更改可用的实例数量SALES.acme.com 请求,甚至将 SALES.acme.com 移动到完全不同的数据库,而客户端无需更改任何设置。

Quote by @DAC

In short: SID = the unique name of
your DB, ServiceName = the alias used
when connecting

Not strictly true. SID = unique name of the INSTANCE (eg the oracle process running on the machine). Oracle considers the "Database" to be the files.

Service Name = alias to an INSTANCE (or many instances). The main purpose of this is if you are running a cluster, the client can say "connect me to SALES.acme.com", the DBA can on the fly change the number of instances which are available to SALES.acme.com requests, or even move SALES.acme.com to a completely different database without the client needing to change any settings.

攒眉千度 2024-07-11 22:26:26

我知道这很古老,但是在处理挑剔的工具、用途、用户或症状时:sid & 服务命名可以在您的 tnsnames 条目中添加一点灵活性,如下所示:

mySID, mySID.whereever.com =
(DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = myHostname)(PORT = 1521))
  )
  (CONNECT_DATA =
    (SERVICE_NAME = mySID.whereever.com)
    (SID = mySID)
    (SERVER = DEDICATED)
  )
)

我只是想我将其留在这里,因为它与问题稍微相关,并且在尝试绕过一些不太清晰的内容时可能会有所帮助预言机网络的特性。

I know this is ancient however when dealing with finicky tools, uses, users or symptoms re: sid & service naming one can add a little flex to your tnsnames entries as like:

mySID, mySID.whereever.com =
(DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = myHostname)(PORT = 1521))
  )
  (CONNECT_DATA =
    (SERVICE_NAME = mySID.whereever.com)
    (SID = mySID)
    (SERVER = DEDICATED)
  )
)

I just thought I'd leave this here as it's mildly relevant to the question and can be helpful when attempting to weave around some less than clear idiosyncrasies of oracle networking.

墨离汐 2024-07-11 22:26:26

请参阅:http://www.sap-img.com/oracle-database/finding-oracle-sid-of-a-database.htm" rel="noreferrer"> sap-img.com/oracle-database/finding-oracle-sid-of-a-database.htm

Oracle和Oracle有什么区别
SID 和 Oracle 服务名称。 一
配置工具查找服务名称和
然后下一步寻找 SID! 什么是
正在进行吗?!

Oracle SID 是唯一的名称
唯一标识您的
实例/数据库作为服务
name 是您提供的 TNS 别名
当您远程连接到您的
数据库,该服务名称是
记录在您的 Tnsnames.ora 文件中
client,可以与SID相同
你也可以给它任何其他
你想要的名字。

SERVICE_NAME 是来自
oracle 8i以上的数据库
可以向侦听器注册自身。 如果
数据库已注册到侦听器
这样你就可以使用
tnsnames.ora 中的 SERVICE_NAME 参数
否则 - 在 tnsnames.ora 中使用 SID。

此外,如果您有 OPS (RAC),您将
每个都有不同的 SERVICE_NAME
实例。

SERVICE_NAMES 指定一个或多个
数据库服务的名称
该实例连接的。 你可以
指定多个服务名称
为了区分不同的
使用相同的数据库。 为了
示例:

SERVICE_NAMES = sales.acme.com,
widgetsales.acme.com

您还可以使用服务名称
识别单个服务
可从两个不同的数据库获取
通过使用复制。

在 Oracle 并行服务器中
环境,你必须设置这个
每个实例的参数。

简而言之:SID = 您的数据库实例的唯一名称,ServiceName = 连接时使用的别名

Please see: http://www.sap-img.com/oracle-database/finding-oracle-sid-of-a-database.htm

What is the difference between Oracle
SIDs and Oracle SERVICE NAMES. One
config tool looks for SERVICE NAME and
then the next looks for SIDs! What's
going on?!

Oracle SID is the unique name that
uniquely identifies your
instance/database where as Service
name is the TNS alias that you give
when you remotely connect to your
database and this Service name is
recorded in Tnsnames.ora file on your
clients and it can be the same as SID
and you can also give it any other
name you want.

SERVICE_NAME is the new feature from
oracle 8i onwards in which database
can register itself with listener. If
database is registered with listener
in this way then you can use
SERVICE_NAME parameter in tnsnames.ora
otherwise - use SID in tnsnames.ora.

Also if you have OPS (RAC) you will
have different SERVICE_NAME for each
instance.

SERVICE_NAMES specifies one or more
names for the database service to
which this instance connects. You can
specify multiple services names in
order to distinguish among different
uses of the same database. For
example:

SERVICE_NAMES = sales.acme.com,
widgetsales.acme.com

You can also use service names to
identify a single service that is
available from two different databases
through the use of replication.

In an Oracle Parallel Server
environment, you must set this
parameter for every instance.

In short: SID = the unique name of your DB instance, ServiceName = the alias used when connecting

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文