I have a USER1 in DATABASE1 and USER2 and USER3 in DATABASE2. I am given the credentials of USER2 from which i can select only few tables on USER3. Now the requirement is, i have to create a databaselink in USER1 to query the tables in USER3. Can someone help, how to create the database link for this type of requirement?
Asked
Active
Viewed 59 times
1 Answers
0
Here's one options: in USER2 schema create views to tables owned by USER3:
create view v_tab1 as select * from user3.tab1;
As USER1, create a database link to USER2:
create database link dbl_user2
connect to user2
identified by its_password
using 'database2_alias';
Now you can access USER2 objects, which includes both tables and views:
select * from tabx@dbl_user2; -- selects from USER2's table
select * from v_tab1@dbl_user2; -- selects from USER3's table, via a view owned by USER2

Littlefoot
- 131,892
- 15
- 35
- 57