user9892866
user9892866

Reputation:

Accessing data of one DBCS to another DBCS

I have two DBCS instance. DB1 and DB2. I want to access data of DB2 instance in DB1. I dont want to copy the data , I just want to access for reporting purpose.

Can you please help me on the same.

Upvotes: 0

Views: 78

Answers (1)

EdStevens
EdStevens

Reputation: 3872

Within DB1, create a db link to DB2:

CREATE PUBLIC DATABASE LINK "DB2"
   CONNECT TO "db2user" IDENTIFIED BY "db2userpwd"
   USING 'DB2';

Create a tnsnames.ora entry (in the tnsnames.ora of the DB1 machine) for DB2

Then when you want to select the data,

select * from my_db2_table@DB2;

Read more on DB Links in the SQL Reference.create database link

BTW, in the CREATE statement above, the two strings 'DB2' do not have to be the same, but probably should be for consistency. The first (CREATE DATABASE LINK DB2) is the name of the link and is what is referenced in the sample SELECT statement. The second (using 'DB2') is the reference to the tnsnames.ora entry.

Upvotes: 2

Related Questions