How SID is different from Service name in Oracle tnsnames.ora

In Oracle, the SID (System Identifier) and the service name are used to identify a specific database instance, but they are used in different contexts.

A SID is a unique identifier for a specific instance of an Oracle database. It is used primarily in the context of the Oracle Network Services (ONS) and the listener.ora file. The listener.ora file is used to configure the listener process, which manages incoming connections to the database. The listener.ora file contains a list of SIDs for which the listener is configured.

On the other hand, a service name is a more user-friendly identifier for a specific database instance. It is used primarily in the context of the tnsnames.ora file. The tnsnames.ora file is used to configure the Oracle Net Services (ONS) and contains a list of service names and their associated connection information. A service name can be used to connect to a specific database instance, whereas a SID can only be used in the listener's context.ora file.

In summary, the SID is a unique identifier for a specific instance of an Oracle database, which is mainly used in the context of the listener.ora file, while the service name is a more user-friendly identifier, mainly used in the context of the tnsnames.ora file, which allows connecting to a specific database instance using a friendly name.