Several Basic concepts of Oracle

Source: Internet
Author: User
Space Management your location: itpub personal space» Oracle learning path» logs can happen in the world, that is, nothing will happen.
From: http://space.itpub.net /? Uid-693532-action-viewspace-itemid-716180

I. Database Name

1. db_name

The Database Name (db_name) is the ID of a database, just like the ID card number of a person. If a machine is installed with multiple full databases, 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:

######################################## ###

# Database Identification

######################################## ###

Db_domain = ""

Db_name = orcl

When creating a database, you should consider the database name, and after the database is created, the database name should not be modified, even if you want to modify it will be very troublesome. Because the database name is also written into the control file and the control file is stored in binary format, you cannot modify the control file content. Assume that you have modified the database name in the parameter file, that is, the value of db_name. However, when oracle is started
Db_name in the file is inconsistent with the database name in the control file, resulting in database startup failure, will return a ORA-01103 error.
2. Role of Database Name
The database name must be used to install the database, create a new database, create a database control file, modify the data structure, and back up and restore the database.

Many Oracle installation file directories are related to database names.
3. Modify the Database Name
Suggestion: the database name should be determined when the database is created. The database name should not be modified because it is complicated to modify the database name.

Now let's take a look at how to modify the database name after the data has been created. The procedure is as follows:

(1) shut down the database.

(2) modify the value of db_name in the database parameter file to the new database name.

(3) Start the instance in nomount mode and build the control file (for the command syntax for creating the control file, refer to the Oracle document)
4. query the current database name
Method 1: Select name from V $ database;

Method 2: Show parameter DB

Method 3: view the parameter file

Ii. database instance name
1. Concept of database instance name


The following describes what an instance is. An instance is a part of the computer memory and auxiliary processing background processes required to access the Oracle database. It is a collection of processes and the memory used by these processes (SGA ).

You can start an instance without any data files. The Startup Process of oralce is as follows:

Sqlplus/As sysdba

SQL> startup nomount # started an instance. Now the SGA instance is allocated, the process is running, and everything except the database is started.

SQL> alter database Mount # use the control file (specified in the init. ora file) to locate duplicate files, data files, and temporary files

SQL> alter database open # The database can be accessed by anyone through this instance.

Therefore, we can understand that all users access an instance when accessing Oracle, but this instance can be accessed if it is associated with a database file. If it is not, the instance will be unavailable.

The instance name refers to the name of the database management system used to respond to a database operation. She is also called Sid. The instance name is determined by the instance_name parameter. If this parameter is not specified
(Instance_name is not specified as any value), the Instance name is determined by the user's environment variable oracle_sid (note that the name is in upper case. On Windows, the oracle_sid value in the registry is determined.
2. instances and databases


The differences between instances and databases are as follows:

(1) The instance is temporary and exists only when the related process and memory set exist. The database is permanent and exists as long as the file exists.

(2) A single database can be installed and opened for an instance within its lifetime. A database can be installed and opened by many instances, or installed and opened by one instance, or multiple instances can be installed and enabled simultaneously (RAC)

By the way, RAC is a system that enables multiple instances to open a database file at the same time. It is structured on multiple machines and runs one instance every day, each instance opens the same database (which is implemented by the disk sharing technology) and needs to synchronize high-speed cache between these instances to ensure that multiple instances are completely consistent, they do not conflict with each other or even overwrite each other.
The database instance name (instance_name) is used for external connections. To contact the database 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 and only know the database name. Different from the Database Name
After the database is installed or created, the Instance name can be modified. The Database Name and Instance name can be the same or different. Generally, the database name and Instance name are in a one-to-one relationship. However, in the Oracle Parallel Server Architecture (Oracle Real-time application cluster, the Database Name and Instance name are one-to-multiple relationships (one database corresponds to multiple instances, and the user is associated with only one instance at a time. When an instance fails, other instances will automatically serve, to ensure the safe operation of the database ).


3. query the name of the current database instance

Method 1: Select instance_name from V $ instance;

Method 2: Show parameter instance

Iii. oracle_sid

In reality, what are the differences between database instance identifiers, sometimes using instance names and oracle_sid?

The instance_name parameter is a parameter of the Oracle database, which can be queried in the parameter file. The oracle_sid parameter is an operating system environment variable, which is used in the same way as oracle_base and ORACLE_HOME, used for intercommunication with the operating system. That is to say, to get the Instance name in the operating system, you must use oracle_sid. And oracle_sid must be consistent with instance_name; otherwise,
You will receive an error on the UNIX platform, which is "Oracle not available" and "TNS: protocol adapter error" on the WINNT platform ".

Iv. Database domain name and Global Database Name

1. Concepts and relationships

Using the Database Name (da_name) to uniquely identify a database is sufficient for a single database, but with the popularity of distributed databases composed of multiple databases, this command data library method puts a certain burden on database management, because the names of each database may be the same, resulting in management confusion. To solve this problem, the db_domain parameter is introduced. In this way, the identification of the data base is determined by the two parameters db_name and db_domain, avoiding management confusion caused by database name duplication. This is similar to managing machine names on the Internet. We connect the parameters db_name and db_domain with '.' to indicate a database, and the database name is global_name, that is, it extends
Db_name. The db_name parameter can only contain letters, numbers, '_', '#', and '$', and can contain a maximum of 8 characters.

Database domain name (db_domain): defines the domain where a database is located. The domain name has nothing to do with the 'region' on the Internet, it is determined by the database administrator based on the actual situation to better manage distributed databases. Of course, to facilitate management, it can be equal to the domain of the Internet.

Global Database Name (global_name): uniquely identifies a database (Oracle Database). We recommend that you use this method to identify a database. This value is determined when you create a database. The default value is db_name. db_domain. Any modifications to the parameters of db_name and db_domain In the parameter file will not affect the value of global_name. To modify global_name, you can only use the alter database rename global_name to <db_name.db_domain> command to modify it, modify the parameters.

2. query the 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

3. Example

The distributed database of the National Transportation GIS system, where:

Jilin node: Jl. jtgis

Jilin Changchun node: CC. Jl. jtgis

Hebei node: Hb. jtgis

Hebei Shijiazhuang node: SJZ. HB. jtgis

These are the database domain names. The database domain names exist in the parameter file, and their parameters are db_domain.

Global Database Name = database name + database domain name. For example, the Global Database Name of the preceding Fujian node is orcl. Jl. jtgis.


V. Database Service name


This parameter is newly introduced by Oracle8i. Before 8i, we used Sid to represent an instance of the database. However, in the parallel environment of Oracle, a database corresponds to multiple instances, which requires multiple network service names and is cumbersome to set. The SERVICE_NAME parameter is introduced to facilitate settings in the parallel environment. This parameter corresponds to a database, not an instance, and has many other benefits.

The default value of this parameter is db_name.db_domain, that is, global_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. A database can correspond to multiple service_names for more flexible configuration. This parameter has no direct relationship with Sid, that is, SERVICE_NAME does not have to be the same as Sid.

For Oracle network components starting with Oracle8i, the host string connecting the database to the client uses the Database Service name. The SID is used before, that is, the database instance name.

Query database service names

Method 1: Select value from V $ parameter where name = 'service _ name ';

Method 2: Show parameter SERVICE_NAME

Vi. Network Service name

The Network Service name (net_service_name), also known as the database alias (Database alias ). It is required when the client program accesses the database. It shields the details of how the client connects to the server and achieves the location transparency of the database. The Network Service name is recorded in the tnsnames. ora file.

The Network Service name is from the client perspective. When the client connects to a remote database or other services, you can specify the network service name. Therefore, you need to use one or more naming methods to resolve the net service name to the connection descriptor of the connected database or other services. See the following:

[Local] -- resolve the network service name stored in the tnsnames. ora file of the local client to the connection descriptor.

[Oracle names]-The Oracle name server provides Resolution Methods for each Oracle Net service on the network.

[Host Name] -- connect to the Oracle Database Service through the host alias in the TCP/IP Environment

[Sun NIs]/[DCE CDs] -- for dedicated systems, not applicable in Windows 2000

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.