Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Differences between database name, instance name, database domain name, global database name, service name

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

= =

The Oracle database first has a database name, and you can also set a domain name. The global database name is actually the database name + domain name. For example, the database is called orcl and the domain name is called abc.com, then the global database name is called orcl.abc.com.SID, which is the system identifier of the database, which is usually used by setting environment variables, usually the name of the database. But the database name is the internal variable of the Oracle database, and SID is the variable of.

= =

Database name, instance name, database domain name, global database name, service name

These are several concepts that confuse many beginners. I believe that many beginners are as confused as I am by these concepts in the title. Let's figure them out now.

I. name of the database

What is the database name?

The database name is the identity of a database, just like the human × × number. He uses the parameter DB_NAME to indicate that if multiple databases are installed on a machine, then each database has a database name. After the database is installed or created, the parameter DB_NAME is written to the parameter file. The format is as follows:

DB_NAME=myorcl

...

When creating a database, you should consider the database name, and after creating the database, the database name should not be modified, even if you want to change it will be very troublesome. Because the database name is also written to the control file, the control file is stored in binary format, and the user cannot modify the contents of the control file. Suppose the user modifies the database name in the parameter file, that is, the value of DB_NAME. However, when Oracle starts, the database startup fails because the DB_NAME in the parameter file is inconsistent with the database name in the control file, and an ORA-01103 error will be returned.

The role of database name

Database names are used when installing databases, creating new databases, creating database control files, modifying data structures, backing up and restoring databases.

There are many Oracle installation file directories that are related to database names, such as:

Winnt: d:\ oracle\ product\ 10.1.0\ oradata\ DB_NAME\.

Unix: / home/app/oracle/product/10.1.0/oradata/DB_NAME/...

Pfile:

Winnt: d:\ oracle\ product\ 10.1.0\ admin\ DB_NAME\ pfile\ ini.ora

Unix: / home/app/oracle/product/10.1.0/admin/DB_NAME/pfile/init$ORACLE_SID.ora

Track the file directory:

Winnt: / home/app/oracle/product/10.1.0/admin/DB_NAME/bdump/...

In addition, when creating data, the database name in the careate database command should also be the same as the value of the DB_NAME parameter in the parameter file, otherwise an error will occur.

Similarly, the statement alter database that modifies the database structure, of course, indicates the name of the database to be modified.

If the control file is corrupted or missing, the database cannot be loaded, so recreate the control file by starting the instance in nomount mode, and then create the control file with the create controlfile command, which also refers to DB _ NAME.

And you need to use the database name when backing up or restoring the database.

In short, the database name is very important, to accurately understand its role.

Query the current data name

Method 1: select name from v$database

Method 2: show parameter db

Method 3: check the parameter file.

Modify the database name

The previous suggestion: you should determine the database name when you create the database, and the database name should not be modified, because changing the database name is a complicated thing. So now let's explain how to change the database name after the data has been created. The steps are as follows:

1. Shut down the database.

two。 Change the value of the DB_NAME parameter in the database parameter file to the new database name.

3. Start the instance in NOMOUNT and build the control file (refer to the oracle documentation for the command syntax for creating the control file)

Database instance name

What is the database instance name?

The database instance name is the identity used to contact the operating system, which means that the interaction between the database and the operating system uses the database instance name. The instance name is also written to the parameter file, which is instance_name, and on the winnt platform, the instance name is also written to the registry.

The database name and instance name can be the same or different.

In general, the database name and instance name are one-to-one, but in the oracle parallel server architecture (that is, oracle real-time application cluster), the database name and instance name are one-to-many. This point is illustrated by a legend in the first article.

Query the current database instance name

Method 1: select instance_name from v$instance

Method 2: show parameter instance

Method 3: query in the parameter file.

Database instance name and ORACLE_SID

Although both tables are oracle instances, there is a difference. Instance_name is the oracle database parameter. ORACLE_SID is the environment variable of the operating system. ORACLD_SID is used to interact with the operating system, that is, the instance name must be accessed through ORACLE_SID from the operating system's point of view. On winnt, ORACLE_SID also needs to exist in the registry.

And ORACLE_SID must be consistent with the value of instance_name, otherwise, you will receive an error, on unix platform, it is "ORACLE not available", on winnt platform, it is "TNS: protocol adapter error".

Database instance name and network connection

In addition to interacting with the operating system, the database instance name is also used to identify the oracle server of the network connection. When you configure the oracle host connection string, you need to specify the instance name. Of course, network components later than 8i require the service name SERVICE_NAME. This concept is explained next.

III. Database domain name

What is a database domain name?

In the distributor database system, between different versions of the database server, no matter the operating system is unix or windows, each server can replicate remotely through the database link. The database domain name is mainly used for replication in the oracle distributed environment. Examples such as:

The distributed database of the national transportation administration system, among which:

Fujian Node: fj.jtyz

Fujian Xiamen Node: xm.fj.jtyz

Jiangxi: jx.jtyz

Jiangxi Shangrao: sr.jx.jtyz

This is the database domain name.

The database domain name exists in the parameter file, and its parameter is db_domain.

Query database domain name

Method 1: select value from v$parameter where name = 'db_domain'

Method 2: show parameter domain

Method 3: query in the parameter file.

Global database name

Global database name = database name + database domain name. As mentioned above, the global database name of Fujian node is: oradb.fj.jtyz

4. Database service name

What is the database service name?

Starting with the oracle9i version, a new parameter, the database service name, has been introduced. The parameter name is SERVICE_NAME.

If the database has a domain name, the database service name is the global database name; otherwise, the database service name is the same as the database name.

Query database service name

Method 1: select value from v$parameter where name = 'service_name'

Method 2: show parameter service_name

Method 3: query in the parameter file.

Database service name and network connection

From the oracle network component of oracle8i, the host string of the connection between the database and the client uses the database service name. I used to use ORACLE_SID, that is, the database instance name

Create an Oracle database (take Oracle10g as an example)

There are two ways to create a database, one is a command-line script, that is, manually, and the other is to use the database configuration wizard provided by Oracle. This article mainly introduces the creation of Oracle database by command line script under Unix and Windows.

A complete database system should include a physical structure, a logical structure, a memory structure and a process structure. If you want to create a new database, these structures must be fully established.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report