Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Oracle schema objects from another user without using user prefix

I have a a user that has a lot of tables against their account. Lets says UserA. I can do SELECT * FROM TABLE and all is fine. If I login in as a different user, UserB, but make this user a readonly connection I cannot access the table, I have to use SELECT * FROM UserA.TABLE

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

like image 965
Jon Avatar asked Nov 30 '22 03:11

Jon


1 Answers

After logging in as UserB, run the following statement:

ALTER SESSION SET current_schema = UserA;

After that you don't have to prefix your table names.

You can create a logon trigger that does this automatically if you don't want to run it manually.

like image 97
a_horse_with_no_name Avatar answered Dec 04 '22 09:12

a_horse_with_no_name