Monday, January 7, 2013

Global Database Name in Oracle Database 11g

When you install a new Oracle Database (see [1]), you are asked to provide the Global database name as shown below:


In a distributed database system, each database should have a unique global database name. Global database names uniquely identify a database in the system. For example, if global naming is enforced by the remote database, you must use the remote database global database name as the name of the database link that you are creating.

In this article, we will examine the following topics:
  • How to check if global naming is enforced?
  • How to view different names?
  • How to change the domain name in a global database name?

How to check if global naming is enforced?


To determine whether global naming on a database is enforced on a database, you can either examine the database initialization parameter file or query the V$PARAMETER view. For example, to see whether global naming is enforced on the remote database, you could start a session on the remote database and then create and execute the following globalnames.sql script (sample output included):

COL NAME FORMAT A12
COL VALUE FORMAT A6
SELECT NAME, VALUE FROM V$PARAMETER
   WHERE NAME = 'global_names'
/

SQL> @globalnames

NAME         VALUE
------------ ------
global_names FALSE


Note that global naming is not enabled by default when you install a new Oracle database.  In other words, you won't find the parameter global_names in the new initialization parameter file.

Global Database Name


In our installation, we have used "orcl.us.oracle.com" as the global  database name, which is composed of two components:
  • DB_NAME
    • "orcl"
  • DB_DOMAIN
    • "us.oracle.com"  (must follow standard Internet conventions)
You can find this piece of information in your initialization parameter file:

*.db_domain='us.oracle.com'
*.db_name='orcl'

How to query different names?


If a database instance is created, you should be able to find out all different names from the data dictionary:
  • DB_NAME
    • SQL> select name from v$database;

      NAME
      ---------
      ORCL

  • DB_DOMAIN
    • SQL> SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'db_domain';

      NAME      VALUE
      --------- -----------
      db_domain us.oracle.com
  • GLOBAL_NAME
    • SQL>SELECT * FROM GLOBAL_NAME;

      GLOBAL_NAME
      -------------------
      ORCL.US.ORACLE.COM

How to change domain name?


The db_domain initialization parameter is only important at database creation time when it is used, together with the db_name parameter, to form the database global name. At this point, the database global name is stored in the data dictionary. You must change the global name using an ALTER DATABASE statement, not by altering the db_domain parameter in the initialization parameter file. It is good practice, however, to change the db_domain  arameter to reflect the change in the domain name before the next database startup.

For more details on how to change the domain in a global database name, you can read [2].

References

  1. Installing Oracle Database 11g Release 2
  2. Managing Global Names in a Distributed System
  3. How to Change DB_NAME & ORACLE_SID
  4. Using Database Configuration Assistant to Create Additional Databases
  5. Using Net Configuration Assistant to Configure a Listener

No comments:

Post a Comment