?
Solved

Perennial Grant Select On Schema

Posted on 2014-07-22
1
Medium Priority
?
580 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 1200 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to recover a database from a user managed backup
Suggested Courses

752 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