Solved

Perennial Grant Select On Schema

Posted on 2014-07-22
1
576 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

756 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