我们知道实例启动的时候必须制定pfile/spfile:
pfile:init.ora
spfile:spfile.ora
当我们启动一个实例的时候,会执行export ORACLE_SID=XXX,这时候oracle根据ORACLE_SID就可以在默认路径下找到对应的参数文件进行读取,根据参数文件的内容就可以分配内存启动后台进程,实例成功启动。
所以,ORACLE_SID是一个操作系统环境变量,用于和操作系统交互,可以看做是orale和操作系统沟通的一个窗口。
INSTANCE_NAME:
这是一个实实在在存在的参数,用于识别数据库的实例名。在oracle10g之前,这个参数还存在参数文件当中,10g之后就从参数文件中消失了。
来看看官方文档是如何描述这一参数的:
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 and the underscore (_) character |
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.
可以看到,在RAC环境中,不同的实例用于连接不同的数据库服务,INSTANCE_NAME标志了一个唯一的实例名。而在单实例环境中,实例名通常和数据库的名字相同。
数据库名和实例名通常都是一对一的关系,有一个数据库名那么对应的就有一个实例名,如果有两个数据库,那么必然存在两个实例名。
DB_NAME:
就是数据库的名称,通过DB_NAME,我们可以找到数据库对应的控制文件,日志文件和数据文件的位置。
看看官方文档对于这一参数的描述:
Property | Description |
---|---|
Parameter type | String |
Syntax | DB_NAME = database_name |
Default value | There is no default value. |
Modifiable | No |
Basic | Yes |
Oracle RAC | 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这个参数,就可以找到对应的数据库数据文件日志文件等而不会造成混淆。DB_NAME是在创建数据库的时候就被指定的,一旦确定了就不能修改,因为DB_NAME会同时存储在pfile/spfile,控制文件,数据文件,日志文件中。
我们只能手动修改pfile/spfile中DB_NAME的值,却不能修改控制文件,数据文件和日志文件中的值,所以一旦修改了之后就会引起与其他文件中的值不匹配的问题,
从而导致数据库无法正常启动。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29800581/viewspace-1307517/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29800581/viewspace-1307517/