关于ORACLE数据库名以及数据实例名等几个重要概念
在oracle中有关数据库和数据库实例的几个重要概念,有时候如果理解不是很深或者对其疏忽、混淆了,还真容易搞错或弄不清其概念,下面就数据库实例名、数据库名、数据库域名、数据库服务名、全局数据库名几个概念,我们来梳理一下概念,总结归纳一下这些知识,首先,我们来看看官方文档对这几者的概念介绍:
instance_name(数据库实例名)
property | description |
parameter type | string |
syntax | instance_name = instance_id |
default value | the instance's sid note: the sid identifies the instance's shared memory on a host, but may not uniquely distinguish this instance from other instances. |
modifiable | no |
range of values | any alphanumeric characters |
basic | no |
in a real application clusters environment, multiple instances can be associated with a single database service. clients can override oracle's connection load balancing by specifying a particular instance by which to connect to the database. instance_name specifies the unique name of this instance.
in a single-instance database system, the instance name is usually the same as the database name.
oracle instance是指一组后台进程(在windows上是一组线程)和一块共享内存区域。实例名(instance_name)就是用来标识这个instance的一个名称而已。
db_name(数据库名)
property | description |
parameter type | string |
syntax | db_name = database_name |
default value | there is no default value. |
modifiable | no |
basic | yes |
real application clusters | you must set this parameter for every instance. multiple instances must have the same value, or the same value must be specified in the startup open sql*plus command or the alter database mount sql statement. |
db_name specifies a database identifier of up to 8 characters. this parameter must be specified and must correspond to the name specified in the create database statement.
if you have multiple databases, the value of this parameter should match the oracle instance identifier of each one to avoid confusion with other databases running on the system. the value of db_name should be the same in both the standby and production initialization parameter files.
the database name specified in either the startup command or the alter database ... mount statement for each instance of the cluster database must correspond to the db_name initialization parameter setting.
the following characters are valid in a database name: alphanumeric characters, underscore (_), number sign (#), and dollar sign ($). no other characters are valid. oracle removes double quotation marks before processing the database name. therefore you cannot use double quotation marks to embed other characters in the name. the database name is case insensitive.
db_name initialization parameter
db_name must be set to a text string of no more than eight characters. during database creation, the name provided for db_name is recorded in the datafiles, redo log files, and control file of the database. if during database instance startup the value of the db_name parameter (in the parameter file) and the database name in the control file are not the same, the database does not start.
简单来说,数据库名是数据库的名称标识,它是在创建数据库的时候确定的,一旦确定,不能更改。该信息存在于初始化文件,控制文件、redo log文件以及数据文件等地方。
db_domain(数据库域名)
property | description |
parameter type | string |
syntax | db_domain = domain_name |
default value | there is no default value. |
modifiable | no |
range of values | any legal string of name components, separated by periods and up to 128 characters long (including the periods). this value cannot be null. |
basic | yes |
real application clusters | you must set this parameter for every instance, and multiple instances must have the same value. |
in a distributed database system, db_domain specifies the logical location of the database within the network structure. you should set this parameter if this database is or ever will be part of a distributed system. the value consists of the extension components of a global database name, consisting of valid identifiers (any alphanumeric ascii characters), separated by periods. oracle recommends that you specify db_domain as a unique string for all databases in a domain.
this parameter allows one department to create a database without worrying that it might have the same name as a database created by another department. if one sales department's db_domain is japan.acme.com, then their sales database (sales.japan.acme.com) is uniquely distinguished from another database with db_name = sales but with