for Oracle databases, db_name and instance_name can be different. Let's take a look at the definition of db_name in an Oracle document: DB_NAME must be a text string of no more than 8 characters. During database creation, Db_name is recorded in data files, log files, and control files. The database cannot be started if the database name in the Db_name and control files in the parameter file is inconsistent during the database instance startup process. An instance can mount and open any database, but one instance of the same time can open only one database. A database can be mount and open by one or more instances (in a OPS/RAC environment, a database can be opened by multiple instances). Let's take a look at my database: [oracle@jumper dbs]$ grep name Initeygle.ora *.db_name= ' eygle ' *.instance_name= ' Eygle ' & nbsp Database under current parameter settings: 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.dbf sql> Show parameter db_name name & nbsp; TYPE    &NBsp; VALUE----------------------------------------------------------db_name string eygle sql> Show parameter instance_name name type VALUE---------------------------------------------------------- instance_name string eygle sql> Create Pfile from SPFile File created. sql> exit disconnected from oracle9i Enterprise Edition release 9.2.0.4.0-Production with the partitioning option Jserver release 9.2.0.4.0-production We create a new pfile for Julia this A new instance uses: [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 & nbsp; 14:03 initeygle.ora-rw-r--r-- 1 oracle dba MB 14:04 initjulia.ora-rw-r--r-- 1 oracle dba 8385 Mar 9 2002 Init.ora Modify this file change: instance_name = Julia modified parameter settings: [Oracle@jumper dbs]$ grep nam E initjulia.ora *.db_name= ' eygle ' *.instance_name= ' Julia ' Then we start instance name for 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 June 14:04:15 2006 Copy Right (c) 1982, 2002, Oracle corporation. all rights reserved. Connected to a idle instance. Sql> startup Mount; ORACLE instance started. Total System Global area 139531744 bytes Fixed Size 452064 bytes Variable Size 121634816 bytes Database buffers 16777216 bytes Redo buffers 667648 bytes Ora-01102:cannot mount Database in EXCLUSIVE mode sql> exit D IsConnected from Oracle9i Enterprise Edition release 9.2.0.4.0-production and the partitioning option Jserver release 9 .2.0.4.0-productIon Note that an error occurred while attempting to load the database because the current database is loaded by another instance (instance). Under non-parallel mode (OPS/RAC), a database can only be loaded by one instance at a time. At this point, two database instances have been started, as can be seen from the background process: [oracle@jumper dbs]$ ps-ef|grep ora Oracle 27321 1 0 Jul14? 00:00:00 ora_pmon_eygle Oracle 27323 1 0 Jul14? 00:00:00 ora_dbw0_ Eygle Oracle 27325 1 0 Jul14? 00:00:00 ora_lgwr_eygle Oracle 27327 1 0 Jul14? 00:00:00 ora_ckpt_eygle Oracle 27329 1 0 Jul14? 00:00:32 ora_smon_eygle Oracle 27331 1 0 Jul14? 00:00:00 ora_reco_eygle Oracle 27333 1 0 Jul14? 00:00:00 Ora_ Cjq0_eygle root 15388 656 0 14:02? 00:00:00 sshd:oracle [priv] Oracle 15390 15388 0 14:02? & nbsp 00:00:00 sshd:oracle@pts/2 Oracle 15391 15390 0 14:02 pts/2 00:00:00-bash Oracle &NB sp; 15445 1 0 14:04? 00:00:00 _julia Oracle 15447 1 0 14:04? 00:00:00 Ora_dbw0_julia Oracle 15449 1 0 14:04? 00:00:00 ora_lgwr_julia Oracle 15451 1 0 14:04? 00:00:00 Ora_ckpt_julia oracle 15453 1 0 14:04? 00:00:00 Ora_smon_julia Oracle 15455 1 0 14:04? 00:00:00 ora_reco_julia Oracle 15457 1 0 14:04? 00:00:00 ora_cjq0_julia Oracle 15459 15391 0 14:04 pts/2 & nbsp 00:00:00 ps-ef Oracle 15460 15391 0 14:04 pts/2 00:00:00 grep ora we close E Ygle This database instance: [oracle@jumper dbs]$ export oracle_sid=eygle [oracle@jumper dbs]$ sqlplus "/As SYSDBA" Sql*plus:release 9.2.0.4.0-production on Tue 14:04:39 2006 Copyright (c) 1982, 2002, Oracle Corpor Ation. all rights reserved. Connected to:oracle9i Enterprise Edition release 9.2.0.4.0-production with the partitioning option Jserve R Release 9.2.0.4.0-production sql> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. Sql> exit disconnected from oracle9i Enterprise Edition release 9.2.0.4.0-production with the partitioning option JSE RVer release 9.2.0.4.0-production This is the time to load and open the Db_name=eygle database via an instance of Julia: [ORAC Le@jumper dbs]$ Export Oracle_sid=julia [oracle@jumper dbs]$ sqlplus "/As SYSDBA" Sql*plus:release 9.2.0.4.0-PR Oduction on Tue 14:05:06 2006 Copyright (c) 1982, 2002, Oracle Corporation. all rights. Connected to:oracle9i Enterprise Edition release 9.2.0.4.0-production with the partitioning option Jserve R release 9.2.0.4.0-production sql> ALTER DATABASE mount; ALTER DATABASE Mount * ERROR at line 1:ora-01990:error opening password file '/OPT/ORACLE/PRODUCT/9.2.0/DBS/ORAPW ' ORA-2 7037:unable to obtain file status Linux error:2: No such file or directory additionAl Information:3 sql> ALTER DATABASE open; Database altered. 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.DBF sql>! Ps-ef|grep ora root 15388 656 0 14:02? 00:00:00 sshd:oracle [priv] Oracle 15390 15388 0 14:02? & nbsp 00:00:00 sshd:oracle@pts/2 Oracle 15391 15390 0 14:02 pts/2 00:00:00-bash Oracle &NB sp; 15445 1 0 14:04? 00:00:00 _julia Oracle 15447 1 0 14:04? 00:00:00 Ora_dbw0_julia Oracle 15449 1 0 14:04? 00:00:00 Ora_lgwr_julia Oracle 15451 1 0 14:04? 00:00:00 ora_ckpt_julia Oracle 15453 1 0 14:04? 00:00:00 Ora_smon_julia Oracle 15455 1 0 14:04? 00:00:00 ora_reco_julia Oracle 15457 1 0 14:04? 00:00:00 Ora_cjq0_julia Oracle 15513 15391 0 14:05 pts/2 00:00:00 sqlplus Oracle 15514 15513 3 14:05? 00:00:01 Oraclejulia (description= (Local=yes) (address= (PROTOCOL=BEQ)) Oracle 15515 15513 0 14:05 pts/2 00:00:00/bin/bash-c ps-ef|grep ora Oracle 1 5516 15515 0 14:05 pts/2 00:00:00 ps-ef sql> show parameter instance_name name &N bsp; type value----------------------------------------------------------------------------- instance_name string Julia sql> show parameter db_name NAME Type VALUE------------------------------------------------------------ -----------------db_name string eygle Let's see what happens if the db_name in the parameter file and the db_name in the control file are inconsistent. Modify parameters Db_name: [oracle@jumper dbs]$ grep name Initjulia.ora *.db_name= ' Julia ' *.instance_name= ' Julia ' During the boot process, we see that in the Mount phase, the database compares the parameter file to the control file, and the database fails to start if the db_name of the two records is inconsistent: sql> Startup Nomount; ORACLE instance started. Total System Global area 139531744 bytes Fixed Size 452064 bytes Variable Size 121634816 bytes Database BufFers 16777216 bytes Redo buffers 667648 bytes sql> ALTER DATABASE Mount ALTER DATABASE Mount * ERROR at line 1:ora-01103:database name ' Eygle ' in Controlfile isn't ' JULIA ' &NBSP ; Another difference is that db_name is usually limited to 8 characters; instance_name should support up to 21 characters. Usually we are set db_name and instance_name consistent. Note that if the db_name is set too long, it will be truncated to 8 characters by Oracle, and instance_name will remain within 21 characters, and if your environment variable is set to Instance_name=db_name, the problem will occur when you start. You need to rebuild the pfile/spfile and modify the environment variables to start the instance and load the database. This issue can refer to itpub cases: http://www.itpub.net/showthread.php?threadid=604507 This article through an example to introduce Instance_ The difference between name and db_name, I hope you can have a further understanding of these two parameters as well as instance and database. Personal supplement: for Windows users, creating a new instance for the Eygle database Julia is a reference to the following action. (for Oracle 9i) 1. copy eygle database parameter file Initeygle.ora for Initjulia.ora, and set instancename = Julia, you can also dynamically generate SPFile files, when you start using the SPFile. 2. For instance Julia generates a new password file, can copy Pwdeygle.ora then renamed to Pwdjulia.ora, or use the ORAPWD command: orapwd File=%oracle_ Home%datebase¥pwdjulia.ora Password={password} entries=10 3. for instance Julia generate Windows Service oradim-new-sid julia-intpwd password-startmode a-pfile%oracle_home%d Atabase¥initjulia.ora 4. Add the instance to the configuration files Listener.ora and Tnsnames.ora under the TNS Listener located in%oralce_home%¥network¥admin 5. Reload TNS listener Lsnrctl Reload
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.