Friday, January 15, 2016

Read Only User Creation 

There is a db user called READ which has read permissions.

For read-only access to apps schema
select 'GRANT SELECT ON '||OBJECT_NAME||' TO READ;' from dba_objects where OWNER='XXBG';

For full access on XXBG Schema

Login as XXBG user and execute:

select 'GRANT SELECT, UPDATE, INSERT, DELETE ON '||table_name||' TO READ;' from user_tables;

Do the same thing for 
USER_TABLES
USER_VIEWS
USER_SYNONYMS

EXECUTE can't be given on tables.

To Give Execute to FUNCTION, PACKAGE and PROCEDURE, exeucte following pl/sql block.

Replace Package with Procedure and Fuction also.

BEGIN
FOR i IN (SELECT object_name FROM user_objects WHERE object_type='PACKAGE' )
LOOP
EXECUTE IMMEDIATE 'GRANT EXECUTE ON '||i.object_name||' TO READ';
END LOOP;
END;
/

No comments:

Post a Comment