Database name (db_name), instance name (instance_name), and operating system environment variables (ORACLE_SID)

Source: Internet
Author: User

Database name (db_name), instance name (instance_name), and operating system environment variables (ORACLE_SID)
Only the database name (db_name) and the database instance name (instance_name) are in the ORACLE7, 8 database. A new parameter, the database domain name (db_domain), the service name (SERVICE_NAME), and the operating system environment variable (ORACLE_SID), appears in Oracle8i, 9i. These are identified in the same database and are used to differentiate the parameters of different databases.
First, what is the database name (db_name)?
The database name is the internal identity used to differentiate the data, the parameter stored in the database control file in binary mode, and cannot be modified after the data is installed or created. After the database installation is complete, this parameter is written to the database parameter file Pfile, in the following format:
[code:1:1aaf156970]
.........
Db_name= "ORCL" # (no Modification allowed)
Db_domain=dbcenter.toys.com
Instance_name=orcl
Service_names=orcl.dbcenter.toys.com
The control_file= (...) is a very.
.........
[/code:1:1aaf156970]
There is a database name (db_name) in each running Oracle8i database, and two database names if two databases are created in a server program. Its control parameters are divided into different pfile to control the relevant database.
Second, what is the database instance name (instance_name)
The database instance name is used in connection with the operating system for use with external connections. In the operating system to obtain interaction with the database, the database instance name must be used. For example, to connect to a database server, you must know its database instance name, only the database name is useless, and unlike the database name, the instance name can be modified after the data is installed or the database is created. After the database installation is complete, the instance name is written to the database parameter file Pfile, in the following format:
[code:1:1aaf156970]
Db_name= "ORCL" # (no Modification allowed)
Db_domain=dbcenter.toys.com
INSTANCE_NAME=ORCL # (can be modified, can be the same as db_name or different)
Service_names=orcl.dbcenter.toys.com
The control_file= (...) is a very.
.........
[/code:1:1aaf156970]
The relationship between the database name and the instance name.
The relationship between the database name and the instance name is typically one by one correspondence, there is a database name has an instance name, if you create two databases in a server, there are two database names, two DB instance names, with two identities to determine a database, the user and the instance are connected.
However, in 8i, 9i parallel server structure, there is no one by one correspondence between the database and the instance, but a one-to-many relationship, (a database corresponding to multiple instances, the same time the user only one instance of the connection, when an instance fails, other instances of automatic service, to ensure that the database safe operation. )
Third, operating system environment variables (ORACLE_SID)
In practice, the instance name (instance_name) parameter is sometimes used for the description of the database instance name, sometimes using the Oracle_sid parameter. These are both database instance names, what's the difference? (often confused)
[code:1:1aaf156970]
(ORACLE_SID)
os<----------------> ORACLE Database <--------(instance_name (instance name))
[/code:1:1aaf156970]
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, but the instance_name parameter is an ORACLE database parameter that can be queried in the parameter file. The ORACLE_SID parameter is the operating system environment variable.
The operating system environment variable ORACLE_SID is used to interact with the operating system. In other words, to get the instance name in the operating system, you must use ORACLE_SID. This parameter is the same as Oracle_base, Oracle_home, and so on. After the database is installed, ORACLE_SID is used to define the name of the database parameter file. Such as:
$ORACLE _base/admin/db_name/pfile/init$oracle_sid.ora.
Define the method:
[code:1:1aaf156970]
Export ORACLE_SID=ORCL
[/code:1:1aaf156970]
If multiple databases are created on the same server, there must be multiple DB instances at the same time, you can repeat the above definition process to select different instances.
can also be used
[code:1:1aaf156970]
[Email protected]]$. Oraenv
[/code:1:1aaf156970]
To switch between different oracle_sid to launch different instances via the operating system (instance)

Database name (db_name), instance name (instance_name), and operating system environment variables (ORACLE_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.