AllExperts > Oracle 
Search      
Oracle
Volunteer
Answers to thousands of questions
 Home · More Oracle Questions · Answer Library  · Encyclopedia ·
More Oracle Answers
Question Library

Ask a question about Oracle
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Peter Choi
Expertise
I am a senior Oracle DBA, PeopleSoft Administrator and Project Manager with 10+ years experience. I have been working with PeopleSoft (HRMS 5, 7, 7.x and 8.9), Oracle RDBMS (7.3 - 11gR1) on various Unix and Windows platforms, and some Oracle Application Server (9i/10gR2). I also have experience with the configuration and administration of BEA`s Tuxedo and WebLogic for PeopleSoft 8.x.

 
   

You are here:  Experts > Computing/Technology > Oracle > Oracle > howto map a user to a shared schema

Oracle - howto map a user to a shared schema


Expert: Peter Choi - 10/16/2009

Question
Hi there!
we are using oracle 8.0.5...we have all tables in one schema called I_local..how can i map all users (schema) in this shared schema?

pelase help!

thanks in advance,
beth

Answer
Hi Lilibeth,

You can create public synonyms and then grant privileges (SELECT, INSERT, UPDATE, DELETE) to a role.

Then grant the role to the users. This way if you were to add or drop a table, updating one role is easier than re-visiting all the users.

I generally build a script that queries the Oracle Data Dictionary to create the public synonym and then grant access to the role.

In this example, my ROLENAME = myRole (assume that the role has been created).

spool create_syn.sql;
SELECT "CREATE PUBLIC SYNONYM ON " || <tablename> ||" FOR " <owner> || "." || <tablename> ||";"
FROM DBA_TABLES
WHERE OWNER="I_LOCAL"

SELECT "GRANT SELECT ON " || <tablename> ||" TO " myRole ||";"
FROM DBA_USERS
WHERE USERNAME="<list of users>";
spool off;

@create_syn.sql


Once the role has populated, all you need to do is issue a grant user to the role

GRANT USER lilibeth to MYROLE;

Hope this helps.

Peter


Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.