oracledba.help
SpecialTopics

Database Names

Overview

Oracle has myriad associated database names. Which are needed? Which can be ignored?

The goal of this page is to help you set required names in a manner that will not come back and bite you. Changing some later may require bouncing the database. While others may require rebuilding the entire database. Good to get this right from the beginning!

Recommended Naming Convention

Database Name (DB_NAME): <product><role: production, testing, training...>
Primary DB_UNIQUE_NAME:  <DB_NAME>                      (Used in Data Guard)
Standby DB_UNIQUE_NAME:  <DB_NAME>_<GeographicLocation> (Used in Data Guard)
SID (non-RAC):           <DB_NAME>
SID (RAC):               <DB_NAME><node_number>
----
RAC Cluster:             cluster-<product><role: production, testing, training...>
RAC SCAN:                scan-<product><role: production, testing, training...>

Dont make your database name the same as the hostname.

Examples

 DB_NAME: abcprod
 Primary DB_UNIQUE_NAME: abcprod
 Standby DB_UNIQUE_NAME: abcprod_ny
 SID: abcprod
 SIDs in RAC: abcprod1, abcprod2, abcprod3, abcprod4
 RAC Cluster: cluster-abcprod
 RAC SCAN: scan-abcprod
  • Though the SCAN is used access the database in RAC, each instance needs a unique name.
  • For RAC, the default in the configuration is that each instance will get the number of the node.
  • Setting them using lower case can help avoid issues with Data Guard.

Name Fun Facts

Reality Check

  • Company names can change.
  • Business Unit names can change.
  • Product names change.
  • Locations can change.

🠊Changing the names of database environments (RAC, Data Guard) is not a trivial matter! 🠈

Suggestion

Because of the above some may choose to use a naming convention not likely to ever change.

Examples:

  • alfaprod, alfatest, alfatrain
  • cygnusprod, cygnustest, cygnustrain
  • cluster-alfa, scan-alfa

DB_DOMAIN and GLOBAL_NAME are generally not used in most Oracle enterprise environments. Do not configure them unless you have an actual Oracle product or policy that mandates it. When creating a database using dbca you will be asked for a Global Database Name. Use the same name as the Database Name (DB_NAME).


DBID

DBID is an internal, uniquely generated number that differentiates databases. Oracle creates this number automatically when you create the database. It's used to identify the database a file belongs to, and It's used in recovery operations to determine that a certain redo log/archived redo log actually belong to the database being recovered; Hence changing DBID requires opening the database with "resetlogs" option, and invalidates all previous archived logs.

DB_DOMAIN

DB_DOMAIN is an optional parameter. In a distributed database system, DB_DOMAIN specifies the logical location of the database within the network structure. You should set this parameter if this database is or ever will be part of a distributed system. The value consists of the extension components of a global database name, consisting of valid identifiers (any alphanumeric ASCII characters), separated by periods. Oracle recommends that you specify DB_DOMAIN as a unique string for all databases in a domain.

This parameter allows one department to create a database without worrying that it might have the same name as a database created by another department. If one sales department's DB_DOMAIN is SPAIN.ACME.COM, then their SALES database (SALES.SPAIN.ACME.COM) is uniquely distinguished from another database with DB_NAME = SALES but with DB_DOMAIN = US.ACME.COM.

Also if you omit the domains from the name of a database link, Oracle expands the name by qualifying the database with the domain of your local database as it currently exists in the data dictionary, and then stores the link name in the data dictionary. The characters valid in a database domain name are: alphanumeric characters, underscore (_), and number sign (#).

DB_NAME

DB_NAME is a name that uniquely identified a database on a server. It is defined at the time of database creation and written into control files. One cannot have two databases with the same DB name on the same server even in two different homes.

DB_UNIQUE_NAME

DB_UNIQUE_NAME specifies a globally unique name for the database. Databases with the same DB_NAME within the same DB_DOMAIN (for example, copies of a database created for reporting or a physical standby) must have a unique DB_UNIQUE_NAME. Every database's DB_UNIQUE_NAME must be unique within the enterprise.

GLOBAL_NAME

The Global Database Name (GLOBAL_NAME) is the unique name of the database. In a distributed database system (a set of databases stored on multiple computers that typically appears to applications as a single database) the global database name ensures that each database is distinct from all other databases in the system. Oracle forms a database's global database name by prefixing the database's network domain with the individual database's name.

Examples:

 sales.us.oracle.com 
 sales.uk.oracle.com.

The global database name defaults to DB_NAME.DB_DOMAIN and this value is marked at database creation time. If you change the DB_NAME or DB_DOMAIN after the database has been created, the value for the global database name (GLOBAL_NAME) will not change.

GLOBAL_NAME is only functionally active when GLOBAL_NAMES is set to "true". It only impacts database links. A database link name must be the same as GLOBAL_NAME for the remote database.

SID

The System Identifier (SID) identifies a specific database instance. The SID uniquely distinguishes the instance from any other instance on the same computer. Each database instance requires a unique SID and database name. In most cases the SID should be the same as the database name (DB_NAME).

Display

--SID (or instance name)

 SELECT sys_context('userenv','instance_name') FROM dual;

--DB_UNIQUE_NAME

 show parameter uniq

--Global Database Name

 SELECT * FROM props$ WHERE name='GLOBAL_DB_NAME';

--Server\Host

 SELECT sys_context('userenv', 'server_host') FROM dual;

Considerations

  • When creating a database using dbca you will be asked for a Global Database Name. Use the same name as the Database Name (DB_NAME).
  • Dont end a DB_NAME with a number. If RAC ever used, every node has a number at the end.
  • In Data Guard the Standby's DB_UNIQUE_NAME must be different than the Primary's.
  • When creating a database for RAC you will be asked for a SID Prefix. Use the same name as the Database Name (DB_NAME).
  • EM Express does not work on the new primary database after Data Guard Broker switchover. Switching roles between the two servers always leaves the new primary server with no EM Database Express access, whereas the new standby server has successful access. After restarting that new primary database, access should be OK. - See 2233529.1

References