How can i create read only database link in oracle -


consider following scenerio....

i have master user master.

i have test user test.

for both users table structure same. both user can on different oracle servers.

then create database link master_link logging in test user sql plus using following command

create database link master_link connect master identified password using (description = (address_list = (address = (protocol = tcp) (host =192.168.9.139)(port = 1521))) (connect_data = (service_name = orcl)))

by loggin in test user , using database link name can modify tables in master user. example

update table1@master_link set display_title = 'ponds' ;

this query updates table table1 of master user.

my requirement want give read permission database link (master_link) test user can't modify or insert table in master user using database link.

on whatever database master schema resides, need create new user (i.e. master_read_only). grant master_read_only user select access on of master's tables (most via role). optionally, create either public synonyms or private synonyms in master_read_only schema reference objects in master. then, when create database link, use master_read_only account rather master account.

something like

as dba

create user master_read_only   identified password2;  grant create session, create synonym    master_read_only;  create role master_ro_role;  grant master_ro_role    master_read_only; 

as master

begin   x in (select * user_tables)   loop     execute immediate        'grant select on master.' || x.table_name ||          ' master_ro_role';   end loop; end; 

as master_read_only

begin   x in (select * all_tables owner='master')   loop     execute immediate        'create synonym ' || x.table_name ||          ' master.' || x.table_name;   end loop; end; 

on database test user has been created

create database link master_link    connect master_read_only    identified password2    using (description =            (address_list =              (address =                (protocol = tcp)                (host =192.168.9.139)               (port = 1521)))              (connect_data = (service_name = orcl))) 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -