ORA-02085: database link connects to


oracle@bakuexa1dbadm01:/u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin$ sqlplus "/ as sysdba";

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 12 16:26:23 2016

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select name from v$database;

NAME
---------
MISUAT

SQL> 
SQL> 
SQL> CREATE DATABASE LINK MT_VIEW
 2 CONNECT TO KOCAZER
 3 IDENTIFIED BY KOCAZER
 4 USING 'AZTEST';

Database link created.

SQL> select sysdate from dual@MT_VIEW;
select sysdate from dual@MT_VIEW
 *
ERROR at line 1:
ORA-02085: database link MT_VIEW connects to AZTEST


After researching I found:

ORA-02085:
database link string connects to string
Cause:
A database link connected to a database with a different name. The connection is rejected.
Action:
create a database link with the same name as the database the database it connects to, or set global_names=false.

Global_names parameter indeed true on my database, lets change it.

SQL> show parameter global_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
global_names boolean TRUE


SQL> alter system set global_names=FALSE scope=both;

System altered.


SQL> show parameter global_name

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

Now, I test again:

oracle@bakuexa1dbadm01:/u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin$ sqlplus "/ as sysdba";

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 12 16:26:23 2016

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select name from v$database;

NAME
---------
MISUAT


SQL> select sysdate from dual@MT_VIEW;

SYSDATE
---------
12-MAY-16

It's working fine.!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: