Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm trying to create a database link between this two DBs.

My local DB is 11.2.0.3.

SQL> select * from global_name;


GLOBAL_NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MYDB.DOMAINNAME


SQL> select name, value from v$parameter where name in ('db_name', 'db_domain', 'global_names');
NAME                 VALUE
-------------------- ----------------------------------------
db_domain
global_names         TRUE
db_name              mydb

The remote DB is 11.2.0.2 configured as follows:

SQL> select * from global_name;


GLOBAL_NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
myremotedb

SQL> select name, value from v$parameter where name in ('db_name', 'db_domain', 'global_names');

NAME                 VALUE
-------------------- ----------
db_domain
global_names         FALSE
db_name              myremotedb

I want to create a DBLINK in the local database to the remote database.

I have my tnsnames (mydb's machine) configured as follows:

REMOTE-DATABASE =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(Host = 192.168.1.2)(Port = 1521))
    )
    (CONNECT_DATA =
      (SID = myremotedb)
    )
  )

Then, when I try to create a database link in my local database, since global_names parameter is set to true, oracle appends the local domain name to the database link name

SQL> create database link myremotedb@myuser connect to myuser identified by mypasswd using 'REMOTE-DATABASE';


Enlace con la base de datos creado.


SQL> select db_link from user_db_links;


DB_LINK
------------------------------
MYREMOTEDB.DOMAINNAME@MYUSER

and if I try to use it, it fails

SQL> select * from dual@MYREMOTEDB@MYUSER;
select * from dual@MYREMOTEDB@MYUSER
                   *
ERROR en línea 1:
ORA-02085: database link MYREMOTEDB.DOMAINNAME@MYUSER connects to MYREMOTEDB




SQL> select * from [email protected]@MYUSER;
select * from [email protected]@MYUSER
                   *
ERROR en línea 1:
ORA-02085: database link MYREMOTEDB.DOMAINNAME@MYUSER connects to MYREMOTEDB

How can I create this database link in this scenario?

The remote db doesn't have a db_domain. How can I force oracle to create a DBLINK with no domain name?

Regards!

share|improve this question
    
I've been through this hell before. Just use the full TNS descriptor (as in the tnsnames.ora file) in the create database link statement –  Phil Mar 5 at 19:05
    
Phill, that didn't work. I've used the full connect string and the error is still showing. :\ –  vegatripy Mar 6 at 10:25
    
Damn. I'll go through my old emails and see if I can dig it out –  Phil Mar 6 at 10:56

2 Answers 2

Can you show us the content of your sqlnet.ora file ?
The domain name should be listed there :

NAMES.DEFAULT_DOMAIN = domain.com.xxx

In case you don't have one , create a new sqlnet.ora file using the netca tool. - after you create that file edit it and add the entry with you domain name!

share|improve this answer
    
I don't have a sqlnet.ora file in local, and don't have that parameter in sqlfile.ora's remote db. –  vegatripy Mar 6 at 17:13
    
I have updated my answer ! –  Up_One Mar 6 at 18:00

Simply at local db set

alter system set global_Names = FALSE;

Then your DB link works.

share|improve this answer
1  
Please don't add your email address to your answer; it helps nobody - and puts you at risk of being spammed/scammed. –  Max Vernon Jul 2 at 19:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.