Oracle read-only user role creation

Source: Internet
Author: User

The following describes how to create an Oracle read-only user role. This method is for your reference. If you have encountered any problems with the Oracle read-only user role, take a look.

Script created for Oracle read-only user role:
1. Grant the object read permission to the role in a certain mode.

 
 
  1. SET PAGESIZE 0  
  2. SET FEEDBACK OFF  
  3. SET VERIFY OFF  
  4. SPOOL s.sql  
  5. SELECT 'GRANT SELECT ON "' || u.object_name || '" TO &1;'  
  6. FROM user_objects u  
  7. WHERE   u.object_type IN ('TABLE','VIEW','SEQUENCE')  
  8. AND NOT EXISTS (SELECT '1'  
  9.                FROM all_tab_privs a  
  10.                WHERE   a.grantee = UPPER('&1')  
  11.                AND a.privilege   = 'SELECT' 
  12.                AND a.table_name = u.object_name);  
  13. SPOOL OFF  
  14. -- Comment out following line to prevent immediate run @s.sql  
  15. SET PAGESIZE 14  
  16. SET FEEDBACK ON  
  17. SET VERIFY ON 

2. Create an authorization word for the mode permission object.

 
 
  1. SET PAGESIZE 0  
  2. SET FEEDBACK OFF  
  3. SET VERIFY OFF  
  4. SPOOL temp.sql  
  5. SELECT 'CREATE SYNONYM "' || a.table_name || '" FOR "' || a.owner || '"."' || a.table_name || '";'  
  6. FROM all_tables a  
  7. WHERE   NOT EXISTS (SELECT '1'  
  8.                FROM user_synonyms u  
  9.                WHERE   u.synonym_name = a.table_name  
  10.                AND u.table_owner   = UPPER('&1'))  
  11. AND a.owner = UPPER('&1');  
  12.  
  13. SPOOL OFF  
  14. -- Comment out following line to prevent immediate run  
  15. @temp.sql  
  16. SET PAGESIZE 14  
  17. SET FEEDBACK ON  
  18. SET VERIFY ON  

The preceding section describes how to create an Oracle read-only user role.

View oracle user permissions

Implementation of batch Oracle authorization

How to store images in oracle

Implementation of oracle tree Query

Implementation of oracle query current time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.