Roles and differences of SERVICE_NAME and Sid in Oracle

Source: Internet
Author: User
In init. ora contains db_name, instance_name, and service_name. in the operating system, you must configure oracle_sid in listener. ora contains SID_NAME, GLOBAL_DBNAME, in tnsname. there are so many SERVICE_NAME and SID in ora that you are confused. First dizzy, and then slowly come. In init. ora, db_name, instance_name, and service_namedb_name are database names. They are already set during db installation and cannot be modified here. They feel the location of the Database Installation File. Instance_name is the Instance name and the name in the database running. In OO, db_name is equivalent to the class and instance_name is oriented to the object. It also represents the memory and process in the database running, at the same time, the names of these processes are affected. For example, if a database named db_name = cus and its instance named instance_name = aking, the process name of the database may be Pmon_aking_1. The instance name must match files such as PWDsid. ora and initSid. ora. Otherwise, an error is reported when the database is started. It can be seen from this that db_name is a class name and cannot be modified after definition. For instance_name, the Instance name is oriented to the object, so we can set our favorite object name. However, after changing instance_name, it is recommended that you do not change the instance_name because the default value is the same as that of db_name. Service_name I think it should be the name of the database network connection, which will be considered in the listener Configuration. This value can also be changed at will, and there can be multiple values. Alter system set service_name = serv1, serv2 scope = both; In listener. in ora, there is SID_NAME and GLOBAL_DBNAME. SID_NAME indicates the name of the instance running the database. It should be consistent with instance_name. For GLOBAL_DBNAME, It is the name of the external network connection configured by listener. We are configuring tnsname. this parameter is taken into account when ora is used. This parameter can be set at will. In addition, you need to note that the listener Configuration of the database instance is manually configured in listener. ora. However, oracle supports automatic registration through the pmon process. The name of the automatically registered external network connection will use init. service_name in the ora file. If there are multiple values, multiple registrars will be registered. For the above example, the listener services serv1 and serv2 will be registered here. If you manually configure a listening service with GLOBAL_DBNAME = serv3, there will be three listening services for instance instance_name = aking. In tnsname. there is SERVICE_NAME in ora, and tnsname of the client is configured under SID. ora provides the IP address of the database to be connected and the connected instance or service. In the Listener Configuration, we mentioned the name of the external network connection. If SERVICE_NAME is used here, SERVICE_NAME = (GLOBAL_DBNAME or service_name requires that oracle has automatically registered in the listener). For SID = (instance_name), for example, SERVICE_NAME = serv1, serv2, and serv3, or SID = aking, the last parameter is ORACLE_SID. this parameter is used in the operating system. It describes the database instance to be connected by default, if there are multiple instances on a machine, you need to modify the connection to use conn/as sysdba, because the default Instance name is used here. In short, for example, your name is James, but you have many nicknames. Your parents call you James, but all your friends call your nickname.

Here, your parents are Oracle instances, James is Sid, and service name is your nickname.

Sid is used to differentiate databases, and service name is used for external links. They may be different. Pay attention to the name you get and use it properly. Otherwise, an error may occur when you remotely connect to another database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.