instance_name、db_name、ORACLE_SID、db_name等的區別

hunterjoy發表於2008-04-08

----------from oracle metalink-----------
The global names is used by the oem product and needs to be in the sid_desc for oem to function correctly. 

Service name is used in the tnsnames.ora file and when the connection using service name arrives at the listener, the listener checks it's tables for a registration match so it can hand of the connection to either a dedicated process or a dispatcher. 

service_names in the init.ora file is set to the service_names + the db_domain and these two values should match the service_name parameter in the tnsnames.ora file or a registration error will occur if they do not match. The service_names is the parameter that registers the names listed here with the listener when the instance starts. 

The global_dbname and the service name can be different names as long as the service_name matches the registration name registered with the listener.

DB_NAME is the database identifier of up to eight characters. If specified, it must correspond to the name specified in the CREATE DATABASE statement. Although the use of DB_NAME is optional, it should generally be set before invoking CREATE DATABASE and then referenced in that statement. If not specified, a database name must appear on either the STARTUP OPEN db_name or ALTER DATABASE db_name MOUNT command line. 

INSTANCE_NAME is a string value representing the name of the instance and is used to uniquely identify a specific instance when multiple instances share common services names. 

Prior to Oracle 8i, clients connected to a database by specifying the Oracle SID (system identifier) in the connect descriptor. INSTANCE_NAME should not be confused with the SID, which actually uniquely identifies the instances shared memory on a host. 

From 8i, the concept of a 'service name' has been introduced. Specifically, clients can specify 'service_name' and 'instance_name' in the connect descriptor. The SERVICE_NAMES is used to identify a database service. This parameters defaults to DB_NAME.DB_DOMAIN (the global database name). A database can be identified by more than one service name. Now INSTANCE_NAME identifies an instance of a database. This parameter is analagous to the SID of an instance, that is "SID_NAME" is now "SERVICE_NAME". Again, an instance can have only one "INSTANCE_NAME," but more than one "SERVICE_NAMES" 

E.g.: 

instance_name = v817 
service_names = ( marketing, support, education ) 

One more thing to note here is, the parameter is "SERVICE_NAME" in tnsnames.ora and "SERVICE_NAMES" defined in "init;.ora". 

The following articles which you could obtain using the search, will help you: 
30715.1 Init.ora Parameter "DB_NAME" Reference Note 
68522.1 Init.ora Parameter "INSTANCE_NAME" Reference Note 
77640.1 SERVICE_NAME parameter in Oracle8i 
76531.1 Service Name Usage in Net8i 
69546.1 Oracle8i - Instance Registration to Listeners

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/543979/viewspace-231247/,如需轉載,請註明出處,否則將追究法律責任。

相關文章