对于Oracle数据库来说,db_name和instance_name可以不同。我们来看一下Oracle文档中对于db_name的定义:DB_NAME必须是一个不超过8个字符的文本串。在数据库创建过程中,db_name被记录在数据文件,日志文件和控制文件中。
如果数据库实例启动过程中参数文件中的db_name和控制文件中的数据库名称不一致,则数据库不能启动。一个实例可以mount并打开任何数据库,但是同一时间一个实例只能打开一个数据库。一个数据库可以被一个或多个实例所mount并打开(在OPS/RAC环境下,一个数据库可以被多个实例所打开)。
我们看一下我的数据库:[oracle@jumper dbs]$ grep name initeygle。ora *。db_name='eygle'*。instance_name='eygle'当前参数设置下的数据库:SQL> select name from v$datafile;NAME-----------------------------------------------------/opt/oracle/oradata/eygle/system01。
dbf/opt/oracle/oradata/eygle/undotbs01。dbf/opt/oracle/oradata/eygle/users01。dbf/opt/oracle/oradata/eygle/eygle01。dbfSQL> show parameter db_nameNAME TYPE VALUE------------------------------------ ----------- -----------db_name string eygleSQL> show parameter instance_nameNAME TYPE VALUE------------------------------------ ----------- -----------instance_name string eygleSQL> create pfile from spfile;File created。
SQL> exitDisconnected from Oracle9i Enterprise Edition Release 9。2。0。4。0 - ProductionWith the Partitioning optionJServer Release 9。
2。0。4。0 - Production我们创建一个新的pfile为julia这个新的实例使用:[oracle@jumper oracle]$ cd $ORACLE_HOME/dbs[oracle@jumper dbs]$ cp initeygle。
ora initjulia。ora[oracle@jumper dbs]$ ll init*-rw-r--r-- 1 oracle dba 982 Jul 25 14:03 initeygle。ora-rw-r--r-- 1 oracle dba 982 Jul 25 14:04 initjulia。
ora-rw-r--r-- 1 oracle dba 8385 Mar 9 2002 init。ora修改这个文件更改:instance_name = julia修改后的参数设置:[oracle@jumper dbs]$ grep name initjulia。
ora *。db_name='eygle'*。instance_name='julia'然后我们启动实例名称为julia的instance:[oracle@jumper dbs]$ export ORACLE_SID=julia[oracle@jumper dbs]$ sqlplus "/ as sysdba"SQL*Plus: Release 9。
2。0。4。0 - Production on Tue Jul 25 14:04:15 2006Copyright (c) 1982, 2002, Oracle Corporation。 All rights reserved。Connected to an idle instance。
SQL> startup mount;ORACLE instance started。Total System Global Area 139531744 bytesFixed Size 452064 bytesVariable Size 121634816 bytesDatabase Buffers 16777216 bytesRedo Buffers 667648 bytesORA-01102: cannot mount database in EXCLUSIVE modeSQL> exitDisconnected from Oracle9i Enterprise Edition Release 9。
2。0。4。0 - ProductionWith the Partitioning optionJServer Release 9。2。0。4。0 - Production
以上是我对于这个问题的解答,希望能够帮到大家。
全部