Access to Oracle schema objects from another user without using a user prefix

I have a user who has many tables against their account. Lets say UserA. I can do SELECT * FROM TABLE , and everything is fine. If I log in as another UserB user, but make a read-only connection for this user, I cannot access the table, I must use SELECT * FROM UserA.TABLE

Is there a way in Oracle somewhere to allow UserB to access UserA tables without having to prefix the user with the table name?

+4
source share
2 answers

After logging in as UserB, run the following statement:

 ALTER SESSION SET current_schema = UserA; 

After that, you do not need a prefix for the names of your table.

You can create a login trigger that will do this automatically if you do not want to start it manually.

+11
source

You can also do this by creating a synonym in the table:

 CREATE SYNONYM TABLE FOR UserA.TABLE; 
+11
source

Source: https://habr.com/ru/post/1401827/


All Articles