Consider the following scenerio….
I have a master user MASTER.
I have a test user TEST.
For both users the table structure are same. Both user can be on different oracle servers.
then I create a database link as master_link by logging in as test user to sql plus using the following command
CREATE DATABASE LINK master_link CONNECT TO MASTER IDENTIFIED BY password USING (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST =192.168.9.139)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
By loggin in as test user and using the database link name i can modify the tables in master user. for example
update table1@master_link set display_title = ‘PONDS’ ;
This query updates the table table1 of master user.
My requirement is i want to give read only permission to database link (master_link) so that test user can’t modify or insert into any table in master user by using database link.
On whatever database the MASTER schema resides, you would need to create a new user (i.e. MASTER_READ_ONLY). Grant the MASTER_READ_ONLY user SELECT access on all of MASTER’s tables (most likely via a role). Optionally, create either public synonyms or private synonyms in the MASTER_READ_ONLY schema that reference the objects in MASTER. Then, when you create the database link, use the MASTER_READ_ONLY account rather than the MASTER account.
Something like
As a DBA
As MASTER
As MASTER_READ_ONLY
On the database where the TEST user has been created