KASHIFAMAN
KASHIFAMAN

Reputation: 1

How to connect to two databases of Oracle using dblink

I am tring to use db link for that I have first change the name of both databases to sol1(remote) and sol3(local) then I create a db link

On sol3

CREATE DATABASE LINK SOL1.SWORLD
CONNECT TO TEST IDENTIFIED BY TEST USING SOL1;

LINK CREATED
ON SQL /> SELECT *  FROM [email protected]

Message:

SQL COULD NOT RESOLVE THE SERVICE NAME

Then I dropped the database link and create a link from Oracle enterprise schema manager I create a public link of fixed user. After login and password, I add the name in service tab as sol1

When I test the connection massage appears

Link is not active

Upvotes: 0

Views: 6999

Answers (2)

ati
ati

Reputation: 1

Make sure you have the entries in your tnsnames file.

NAME (DESCRIPTION (ADDRESS_LIST (ADDRESS = (PROTOCOL = TCP 
)(HOST = host)(PORT = 1521)) 
) 
(CONNECT_DATA (SERVICE_NAME = NAME) 
) 
) 

You can now create your link in either direction.

create public database link "link name" 
connect to schemaname 
identified by " " 
using 'servicename(from tnsnames entry) 
; 

Your link could be private also.

Upvotes: 0

wadesworld
wadesworld

Reputation: 13733

I believe this is the source of your problem:

SQL COULD NOT RESOLVE THE SERVICE NAME

This indicates that SOL1 is not in tnsnames.ora, the entry is invalid or some network connectively issue is preventing Oracle from turning the service name into an address.

Upvotes: 2

Related Questions