Oracle How can one user access another user's table application guide

  • 2020-11-18 06:31:39
  • OfStack

If there are two users A and B in Oracle, then if A wants to access the table owned by B, the statement should be:
 
SELECT * FROM B.TABLENAME .  

My question is, can I change the Oracle Settings so that A accesses the B table language as well as the B user login statement: SELECT * FROM TABLENAME?
 
create synonym tablename for B.TABLENAME; 

In addition to creating synonyms on the first floor, A users will also be granted access to change consent words.
 
drop synonym tablename ; 

1 You can use queries to generate sql statements, such as
 
select 'CREATE SYNONYM '||table_name||' FOR A.'||table_name from dba_tables where owner = 'A' 

These sql statements are then executed. Or write a stored procedure implementation.
select any table permissions allow access to all tables

Related articles: