Global database name. What is the relationship between Database Name and Sid?

Source: Internet
Author: User

Database Name (db_name), Instance name (instance_name), oracle_sid
Recently, some people in the Forum asked about this issue and sorted out their understanding and relevant materials as follows. If not all or improperly, I hope to correct and complete it.
Database Name (db_name), Instance name (instance_name), and operating system environment variable (oracle_sid)
In oracle7 and 8 databases, only the Database Name (db_name) and database instance name (instance_name) are available ). 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:

[Code: 1: 1aaf156970]
.........
Db_name = "orcl" # (cannot be modified)
Db_domain = dbcenter.toys.com
Instance_name = orcl
Service_names = orcl.dbcenter.toys.com
Control_file = (...............
.........
[/Code: 1: 1aaf156970]
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.

Ii. What is the database instance name (instance_name)
The database instance name is used for external connection with the operating system. 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 into the pfile of the database parameter file. The format is as follows:

[Code: 1: 1aaf156970]
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 = (...............
.........
[/Code: 1: 1aaf156970]
The relationship between the database name and Instance name.
The relationship between database names and instance names is generally a one-to-one correspondence. A database name has an Instance name. If you create two databases on a server, there are two database names, two database instance names are used to identify 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? (Frequent obfuscation)

[Code: 1: 1aaf156970]
(Oracle_sid)
OS <----------------> Oracle database <-------- (instance_name (Instance name ))
[/Code: 1: 1aaf156970]
The relationship between the Instance name instance_name and oracle_sid and the database and the operating system. Although the two parameters listed here are database instance names, the instance_name parameter is the parameter of the Oracle database, this parameter can be queried in the parameter file, while oracle_sid is the 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:
[Code: 1: 1aaf156970]
Export oracle_sid = orcl
[/Code: 1: 1aaf156970]
If multiple databases are created on the same server, multiple database instances must exist at the same time. You can repeat the preceding definition process to select different instances.
You can also use
[Code: 1: 1aaf156970]
[Oracle @ datacent] $. oraenv
[/Code: 1: 1aaf156970]
Different oracle_sid to start different instances through the Operating System)

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.