Solved

Perennial Grant Select On Schema

Posted on 2014-07-22
1
578 Views
Last Modified: 2014-07-24
I want a certain user to have SELECT privileges on all tables in a particular schema.  If new tables are added to that schema I want to user to have SELECT privilege without having to issue a new GRANT SELECT for the new table.  Is this possible?
0
Comment
Question by:xoxomos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
Wasim Akram Shaik earned 300 total points
ID: 40213433
Its possible but for that you need to do something at user level..

something like creating a trigger on table creation ..

this will check if the table is created and then it will automatically grant select to the table for the schema you want .. replace the <USER> with your user name


CREATE OR REPLACE TRIGGER bcs_trigger
BEFORE CREATE
 ON SCHEMA

DECLARE
  oper ddl_log.operation%TYPE;
var_sql varchar2(1000);
BEGIN
IF ORA_DICT_OBJ_TYPE ='TABLE' THEN
var_sql:='GRANT SELECT ON';
var_sql:=var_sql||'ora_dict_obj_owner.'||'ora_dict_obj_name'||' TO '|| '<USER>';
   EXECUTE IMMEDIATE var_sql;
END;
END;

Open in new window

0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question