Link to home
Start Free TrialLog in
Avatar of mjaganna
mjaganna

asked on

Database link

I created database link between 2 instances and the message says database link created..but I could not describe or select any tables from the remote database..

here is my commands

drop database link aaa;

create public  database LINK aaa CONNECT TO scott IDENTIFIED BY tiger USING 'mydb' ;

select * from table1@mydb

ORA -12154 TNS could not resolve service name .. but the same db is in tnsnames.ora and it works when  I do sqlplus..
sqlplus scott/tiger@mydb

Can you guys figure out what is wrong here..

Thanks
Avatar of mmoore
mmoore
Flag of United States of America image

This may be that your oracle server looks for the tnsnames.ora file in a different place than sqlPlus. The first thing I would do is a search on tnsnames.ora and if there are multiple files by that name, make sure they all contain the service name descriptor in question. Also I like to set up the TNS_ADMIN variable to point to the location where I keep my tnsnames.ora file. This way I know for sure where all the components are SUPPOSED to find it.
drop database link aaa;

create public  database LINK aaa CONNECT TO scott IDENTIFIED BY tiger USING 'mydb' ;

Error is:

--select * from table1@mydb;


Right is:

select * from table1@aaa;

OK?

The string 'mydb' should in tnsnames.ora file.
ASKER CERTIFIED SOLUTION
Avatar of cdion
cdion
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial