Thursday, November 12, 2009

Create db link and global_name parameter


When you create a database link with a name for example "TEST" then you might notice that oracle adds an extra ".WORLD" or something else.


This extra addition comes from the GLOBAL_NAME of the database.
To see what is the GLOBAL_NAME of your database, execute: 

SELECT * FROM GLOBAL_NAME;

To change the global_name of you database execute: 

ALTER DATABASE RENAME GLOBAL_NAME TO NEW_NAME;

Then if you create a new database link with name XXX, then oracle will add the extra "NEW_NAME", so it will be XXX.NEW_NAME


Be careful, there is the also a parameter called "global_names":

SELECT * FROM V$PARAMETER WHERE NAME = 'global_names';

Usually takes a value of FALSE.


Tip: When GLOBAL_NAMES=TRUE then the db link name MUST be identical to the global_name of the db to which it connects.

2 comments:

  1. Is it possible to point link at the same SID when GLOBAL_NAMES=TRUE?

    ReplyDelete
    Replies
    1. Note: EFFECT OF GLOBAL_NAME, GLOBAL_NAMES ON DB LINKS (Doc ID 1024124.6) explains all this thoroughly.
      An example: We have a database with global_name A.DOMAIN with GLOBAL_NAMES=TRUE and another database with global_name B.DOMAIN.
      B.DOMAIN's GLOBAL_NAMES value is irrelevant.
      If you want to create a db link in A.DOMAIN that connects to B.DOMAIN, its name must be B.DOMAIN.

      Delete