Differences between Oracle database name, instance name, and service name
DB_NAME:
① is the name of the database and cannot exceed 8 characters in length. It is recorded in datafile, redolog and control file.
② has the same DB_NAME but different DB_UNIQUE_NAME in DataGuard environment
③ in a RAC environment, the DB_NAME of each node is the same, but the INSTANCE_NAME is different
④ DB_NAME also plays a role in dynamic registration listening, using DB_NAME dynamic registration listening regardless of whether the SERVICE_NAME,PMON process is defined or not
DBID:
① DBID can be seen as the internal representation of DB_NAME in the database, which is calculated by combining DB_NAME with algorithm when the database is created.
② exists in datafile and control file and is used to indicate the attribution of data files, so DBID is unique. For different databases, DB_NAME can be the same, but DBID must be unique. For example, in DataGuard, the DB_NAME of the primary and secondary libraries is the same, but the DBID must be different. (I have seen a very vivid example that you can have someone with the same name, but the × × number must be different)
DB_UNIQUE_NAME:
① in DataGuard, the master and slave libraries have the same DB_NAME. In order to distinguish, there must be different DB_UNIQUE_NAME.
② DB_UNIQUE_NAME will affect the SERVICE_NAME of dynamic registration in DG, that is, if dynamic registration is used, the registered SERVICE_NAME is DB_UNIQUE_NAME, but the instance is still INSTANCE_NAME, that is, SID
INSTANCE_NAME:
The name of the ① database instance. The default value of INSTANCE_NAME is SID, which is generally the same as the database name (DB_NAME), but can also be different.
② initSID.ora and orapwSID files should be consistent with INSTANCE_NAME
③ INSTANCE_NAME affects the name of the process
SID:
① is an environment variable in the operating system and is used the same as ORACLE_HOME,ORACLE_BASE
② must use ORACLE_SID if it wants to get an instance name in the operating system. And the value of ORACLE_SID must be consistent with that of INSTANCE_NAME
SERVICE_NAME:
The name of the service used to connect the ① database to the client
② in DataGuard, if dynamic registration is used, it is recommended to use the same service_names in the master / slave database.
If ③ is registered statically in DataGuard, it is recommended to enter the same service name (service_name) in the listener on the master / slave database.
④ if static registration is used for listening, then SERVICE_NAME is equal to the value of GLOBAL_DATABASE_NAME in the Listener.ora file
GLOBAL_DATABASE_NAME:
① GLOBAL_DATABASE_NAME is the name of the external network connection configured by listener, which can be any value
It is OK for ② to keep the service_name in the tnsnames.ora file monitored by the client configuration consistent with this GLOBAL_DBNAME.
When ③ configure static snooping registration, you need to enter SID and GLOBAL_NAME