Difference between service name and Sid

Source: Internet
Author: User
Database Name (db_name), Instance name (instance_name), and operating system environment variable (oracle_sid) only have Database Name (db_name) and database instance name (instance_name) in oracle7 and 8 databases ). A new parameter is displayed in Oracle8i and 9i, that is, the database domain name (db_domain), service name (SERVICE_NAME), and operating system environment variable (oracle_sid ). These IDS exist in the same database and are used to differentiate parameters of different databases. 1. What is the database name (db_name )? The database name is an internal identifier used to differentiate data. It is a parameter stored in the database control file in binary mode. It cannot be modified after the data is installed or created. After the database is installed, this parameter is written to the pfile file of the database parameter file in the following format :......... db_name = "orcl" # (cannot be modified) db_domain = dbcenter.toys.com instance_name = orcl service_names = orcl.dbcenter.toys.com control_file = (........................ each running Oracle8i Database has a database name (db_name). If two databases are created in a server program, there are two database names. Its Control Parameter Data belongs to different pfiles that control related databases. 2. What is the database instance name (instance_name) The database instance name is used for connecting with the operating system and for external connection. To obtain interaction with databases in the operating system, you must use the database instance name. For example, to connect to a database server, you must know its database instance name. It is useless to know only the database name. Unlike the database name, after the data is installed or the database is created, the instance name can be modified. After the database is installed, the Instance name is written to the pfile of the database parameter file in the following format: db_name = "orcl" # (cannot be modified) db_domain = dbcenter.toys.com instance_name = orcl # (it can be modified. It can be the same or different from db_name) service_names = orcl.dbcenter.toys.com control_file = (........................ the relationship between the database name and Instance name is generally a one-to-one correspondence between the database name and Instance name. One database name has one instance name. If you create two databases on one server, there are two database names and two database instance names. Use these two Identifiers (Database Name and Instance name) to determine a database. The user and instance are connected. However, in the 8i and 9i Parallel Server structures, there is no one-to-one correspondence between the database and the instance, but a one-to-many relationship (one database corresponds to multiple instances, within the same time, the user is associated with only one instance. When an instance fails, other instances are automatically served to ensure the safe operation of the database .) Iii. Operating System Environment Variable (oracle_sid) In practice, the description of the database instance name sometimes uses the Instance name (instance_name) parameter, and sometimes uses the oracle_sid parameter. The two are database instance names. What are their differences? (Often confused) (oracle_sid) OS <----------------> Oracle database <-------- (instance_name (Instance name) represents the relationship between the Instance name instance_name, oracle_sid, and the database and operating system, although the two parameters listed here are database instance names, the instance_name parameter is an Oracle database parameter, which can be queried in the parameter file, while the oracle_sid parameter is an operating system environment variable. The operating system environment variable oracle_sid is used to interact with the operating system. That is to say, to get the Instance name in the operating system, you must use oracle_sid. This parameter is used in the same way as oracle_base and ORACLE_HOME. After the database is installed, oracle_sid is used to define the name of the database parameter file. For example, $ oracle_base/admin/db_name/pfile/init $ oracle_sid.ora. Definition method: Export oracle_sid = orcl if multiple databases are created on the same server, multiple database instances must exist at the same time. In this case, you can repeat the above definition process to select different instances. You can also use [[email protected] $. oraenv to switch different oracle_sid to start different instances through the Operating System) ========================================================== ========================================================== === Database Name: db_name database instance name: instance_name operating system environment variable: oracle_sid Database Service name: service_names database Domain Name: db_domain Global Database Name: global_db_name only contains the Database Name and Instance name in oracle7 and oracle8 databases, the database domain name, service name, and global database name appear in Oracle8i and Oracle9i. Database Name (db_name): used to distinguish the internal identifier of a data. It is an internal identifier of Oracle and is a parameter stored in the database control file in binary mode. Database Name: the database name is the internal management mark of the database, data names are required when you install databases, create new databases, Create Database Control Files, modify database structures, and use database backup and recovery tools to back up databases. After the database is installed, the database name is stored in the parameter file (pfile, spfile) and stored in the control file in binary format. The two must match. If they do not match, the database prompts a ORA-01103 number error at startup. ■ Data name query: 1. query the value of the parameter file db_name 2. Select name from V $ database 3. SQL> show parameter db_name ■ modify the Database Name (complex modification, do not modify) 1. Modify the Database Name of the parameter file. 2. Recreate the control file of the database. Database instance name (instance_name): used to connect to the operating system. The database instance name must be used for interaction between the operating system and the database. After the database is installed, the database instance name is stored in the parameter file and in the registry. The Database Name and Instance name are generally in a one-to-one relationship, that is, there is a database name with an instance name, and there is a one-to-many relationship in the parallel server structure of Oracle9i, that is: one database corresponds to multiple instances. ■ Data name query: 1. query the value of the parameter file instance_name 2. Select instance_name from V $ instance 3. SQL> show parameter instance_name operating system environment variable (oracle_sid ): corresponds to the database instance name. Instance_name is the Oracle database parameter-oracle_sid is the operating system environment variable, that is, to obtain the Instance name in the operating system, you must run the operating system environment variable oracle_sid, and oracle_sid and instance_name must be the same. It is the interface between the database and the operating system. It is used by the operating system and serves as the basis for the operating system to differentiate multiple databases. Oracle_sid is stored in the registry. If the oracle_sid of the database is different from the actual instance_name, all Oracle commands running in the operating system will generate an error. ■ Definition of data instance name: SQL> set oracle_sid = database instance name database domain name (db_domain): Add a domain name after the database name, the database name is unique throughout the network environment and is mainly used for remote data replication in the oralce distributed environment. The database domain name is stored in the parameter file. The following situations should consider using the database Domain Name: 1. In the Oracle distributed environment, the two databases must remotely transmit data through the data link. 2. In the same network environment, the two databases have the same name. ■ Query of database domain names: 1. query the value of the parameter file db_domain 2. Select value from V $ parameter where name = 'db _ Domain '3. SQL> show parameter db_domain ■ modify the database Domain Name: 1. Disable database 2. Modify db_domain and service_names in the database parameter file. Database Service name service_names: database name + database domain name, meaning the same as the global database name. The Database Service name is stored in the parameter file. ■ Query of Database Service names: 1. query the value of the parameter file service_names 2. Select value from V $ parameter where name = 'service _ names' 3. SQL> show parameter service_names Global Database Name global_db_name: database Name + database domain name. Database instance name, service name and network connection ORACLE Server version Client Network Driver oracle7 (Instance name supported) SQL _net (Instance name supported) oracle8 (Instance name supported) net8 (Instance name supported) oracle8i (supporting Instance name and service name) net8i (supporting Instance name and service name) Oracle9i (supporting Instance name and service name) Oracle Net service (supporting Instance name and service name) the instance name and service name of the network connection string must be determined based on the client-driven version and the version of the Oracle server. both support the service name and service name, otherwise, the Instance name is used. ========================================================== ========================================================== ==== 1. the SID is the Instance name, And the Instance name is the name of the database management system used to respond to a database operation. The instance name is determined by the instance_name parameter of the initialization parameter file. If this parameter is not specified (instance_name is not specified as any value), the Instance name is determined by the user's environmental variable oracle_sid (note that this parameter is in upper case. On Windows, the oracle_sid value in the registry is determined. 2. SERVICE_NAME refers to the global database name in listener: this name is determined by the global_dbname parameter in listener. ora. This name indicates the value of the SERVICE_NAME parameter in tnsnames. ora when the client connects to the database. 3. When configuring tnsname. ora in the connection string, you can use Sid or SERVICE_NAME. Note that these two values are not necessarily the same, depending on the configuration in the database server. Connect_str = (description = (address_list = (address = (Protocol = TCP) (host = xx. XX. XX. XX) (Port = 1521) (CONNECT_DATA = (SERVICE_NAME = XXXX) connect_str = (description = (address_list = (address = (Protocol = TCP) (host = xx. XX. XX. XX) (Port = 1521) (CONNECT_DATA = (SID = xxx) (Server = dedicated )))

Difference between service name and Sid

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.