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.