Sunday, May 25, 2008

Global_names and global_name in Oracle.

There may be at first confusing to you between the two terms global_names and GLOBAL_NAME. I will try to make you understand the difference between these two in my topic. However the detail relation between these two inshallah will be discussed in future topic. In my ORA-2085 a related problem is discussed though.

Before starting you have to be clear that global_names is a PARAMETER and GLOBAL_NAME is a VIEW or SYNONYM.
SQL> SELECT OBJECT_NAME, OBJECT_TYPE FROM DBA_OBJECTS WHERE OBJECT_NAME LIKE 'GLOBAL_NAME%';
OBJECT_NAME OBJECT_TYPE
-------------------- -------------------
GLOBAL_NAME VIEW
GLOBAL_NAME SYNONYM

SQL> DESC GLOBAL_NAME;
Name Null? Type
----------------------------------------- -------- ----------------------------
GLOBAL_NAME VARCHAR2(4000)


SQL> SELECT NAME FROM V$PARAMETER WHERE NAME LIKE 'global_name%';
NAME
--------------------------------------------------------------------------------
global_names

In order to see your database global_names parameter value just issue,
SQL> show parameter global_names

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
global_names boolean FALSE

Or,
SQL> SELECT VALUE FROM V$PARAMETER WHERE NAME='global_names';
VALUE
--------------------------------------------------------------------------------
FALSE

GLOBAL_NAME value:
------------------------------------------------------

The default value of GLOBAL_NAME=DB_NAME+DB_DOMAIN
You can change the default value if you wish.
To know your database global_name issue,
SQL> select * from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
DBASE.REGRESS.RDBMS.DEV.US.ORACLE.COM

In order to rename your global_name issue,

SQL> ALTER DATABASE RENAME GLOBAL_NAME TO DBASE.BANGLADESH.INDIA;

Database altered.

SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
DBASE.BANGLADESH.INDIA

global_names Parameter:
-------------------------------------------------------


•global_names is a boolean type parameter. It can have value either true or false. The default value is false.

In order to set global_names parameter to true for the current session issue,

SQL> ALTER SESSION SET global_names=TRUE;
Session altered.

To set global_names parameter to TRUE permanently use,

SQL> ALTER SYSTEM SET global_names=TRUE;(If your database start with spfile)
Session altered.


•Setting GLOBAL_NAMES to TRUE specifies database link is required to have the same name as the database to which it connects.

•If the value of GLOBAL_NAMES is false, then no check is performed.

No comments:

Post a Comment