yes I'm aware of that but I am looking for a cleaner way of doing this if possible, I don't want to be having to run this script to grant access multiple times a day to ensure user B has access to all of user A's schema
Main Topics
Browse All TopicsI have a user (user A) in oracle who has a lot of objects under their schema, I wish to give access to these tables to another user (user B).
I want to avoid the following if possible
1. creating public synomyns for all the objects under user A.
2. having to grant User B access to User A's on a object level (for example 1000000 tables and 1 million grants.
Is there a way to do this ? I have seen something to do with proxy users but I am not sure I have understood it correctly.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Oracle allows granting either system privileges or object privileges. For object privileges, you can specify only an object, not a schema. So ultimately u vil have to issue a grant stmt. to each table in schema A. You can use something like this to make things easier : -
GRANT ALL PRIVILEGES ON table_1 TO user_b;
At best, if you want to avoid PL/SQL, you can write a SELECT (below) to generate all the GRANT statements for u, dump its results in a SQL-script and run it on SQLPLUS prompt.
SELECT 'GRANT ALL PRIVILEGES ON ' || table_name || ' TO USER_B'
FROM user_tables;
If you have multiple user's that you'll have to keep maintaining, then try granting to a role and then grant that role to each user.
That way the user's don't have to be modified just the role.
To keep them in sych automatically you can create ddl triggers to automatically grant anytime that schema creates a new table.
Or a dbms job to find ungranted objects and grant them.
I'm curious as to why you have such dynamic table creation.
Seems odd that you wouldn't be able to keep up.
Hopefully it's not because an application is creating and destroying tables to store "temporary" information.
Business Accounts
Answer for Membership
by: oleggoldPosted on 2007-11-14 at 07:53:35ID: 20280909
You could write a simple loop :
begin
for i in
(select distinct table_name from all_tables where owner='USER_A')
loop
execute immediate 'grant all on '||i.table_name||' to USER_B';
end loop;
end;
/