Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I give access of my schema to a user in Oracle? I had created a user named CCMS_ADMIN and I had created 200 tables in that. But I need to give read access of CCMS_ADMIN tables to all my developers and testers. How can I do this?
Posted
Updated 14-Jan-15 2:44am
v2

1 solution

As far as I know you have to grant access one object at a time.

This can of course be done using a procedure like this
SQL
PROCEDURE GRANT_SELECT_ON_TABLES
    USERID IN varchar2 
IS
BEGIN
    FOR TABLES IN (
        SELECT  TABLE_NAME
        FROM    ALL_TABLES
        WHERE   OWNER = USER)
    LOOP
       EXECUTE IMMEDIATE 'GRANT SELECT ON '|| TABLES.TABLE_NAME ||' TO USERID;
    END LOOP;
END;

You have to run it while logged in as CCMS_ADMIN and it will take the user you want to grant select access to as a parameter.

Disclaimer: I haven't tested it as such and I don't have access to a server at the moment.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900