How to Create a Read-Only APPS Schema?

How to Create a Read-Only APPS Schema?

 

We are going to create a schema similar to the APPS schema having only read-only privileges.

 

Step 1. Create the user for the required schema:

  • SQL> connect system/manager
  • SQL> create user <your_user> identified by <your_user_password> default tablespace;
  • SQL><tablespace_to_assign_to_user> temporary tablespace temp;

 

Step 2. Grant connect and resource privileges to your user:

  • SQL> connect system/manager
  • SQL> grant connect, resource to <your_user>;

 

Step 3. Use the following select statement to generate a script that will grant privileges on APPS objects to your User.

This select statement would generate a script that will grant almost all required permissions to a user called READONLY.

SELECT 'GRANT ' 
       || Decode(O.object_type, 'TABLE', 'SELECT', 
                                'VIEW', 'SELECT', 
                                'EXECUTE') 
       || ' ON ' 
       || Decode(O.owner, 'PUBLIC', '', 
                          O.owner 
                          || '.') 
       || '"' 
       || O.object_name 
       || '"' 
       || ' TO MYUSER;' COMMAND 
FROM   all_objects O 
WHERE  O.object_type IN ( 'TABLE', 'PACKAGE', 'PACKAGE BODY', 'PROCEDURE', 
                          'VIEW', 'FUNCTION' ) 
UNION 
SELECT 'GRANT ' 
       || Decode(O2.object_type, 'TABLE', 'SELECT', 
                                 'VIEW', 'SELECT', 
                                 'EXECUTE') 
       || ' ON ' 
       || Decode(O.owner, 'PUBLIC', '', 
                          O.owner 
                          || '.') 
       || '"' 
       || O.object_name 
       || '"' 
       || ' TO READONLY;' COMMAND 
FROM   all_objects O, 
       all_objects O2, 
       dba_synonyms S 
WHERE  O.object_type = 'SYNONYM' 
       AND O.object_name = S.synonym_name 
       AND O2.object_name = S.table_name 
       AND O2.object_type IN ( 'TABLE', 'PACKAGE', 'PACKAGE BODY', 'PROCEDURE', 
                               'VIEW', 'FUNCTION' )

 

Now, Use the following select statement to generate a script that will create synonyms in <your_user> schema for all objects owned by APPS.

SELECT ‘CREATE SYNONYM MYUSER.’ || O.OBJECT_NAME || ‘ FOR APPS.’ || O.OBJECT_NAME || ‘;’ COMMAND FROM DBA_OBJECTS O WHERE O.Owner = ‘APPS’

 

Run the above two scripts as SYS user.

 

 

 

About Syed Saad

With 13 years of experience as a certified and skilled Oracle Database Administrator, I possess the expertise to handle various levels of database maintenance tasks and proficiently perform Oracle updates. Throughout my career, I have honed my analytical abilities, enabling me to swiftly diagnose and resolve issues as they arise. I excel in planning and executing special projects within time-sensitive environments, showcasing exceptional organizational and time management skills. My extensive knowledge encompasses directing, coordinating, and exercising authoritative control over all aspects of planning, organization, and successful project completions. Additionally, I have a strong aptitude for resolving customer relations matters by prioritizing understanding and effective communication. I am adept at interacting with customers, vendors, and management, ensuring seamless communication and fostering positive relationships.

Check Also

OracleEBSConfig

How to Create The Service Manager ‘FNDSM’ on Oracle Applications

Create The Service Manager ‘FNDSM’

Leave a Reply