0

I am trying to connect oracle db to oracle db I tried to create database link on toad like this.

CREATE DATABASE LINK boston
  CONNECT TO admin IDENTIFIED BY 'mypassword' 
  USING 'host=192.168.1.65 dbname=sales';

It is created with no error but not working properly.

I need working "create database link" format with using ip address and service name.

Oracle Host to connect ip: 192.168.1.65 
oracle version: 10g 
Service name: xe 
Table name: sales

1 Answer 1

1

You need to provide the proper connection string as follows:

CREATE DATABASE LINK boston
    CONNECT TO admin IDENTIFIED BY mypassword
    USING '(DESCRIPTION=
                (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.65)(PORT=1521))
                (CONNECT_DATA=(SERVICE_NAME=sales))
            )';

The best practice is to add the connection string in the tnsnames.ora

SALES =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.65)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sales)
    )
)

then use this tns alias in the DB link as following:

CREATE DATABASE LINK boston
    CONNECT TO admin IDENTIFIED BY mypassword
    USING 'SALES';

Cheers!!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.