Solved

Perennial Grant Select On Schema

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bash Script to Analyze Oracle Schemas 11 104
create a nested synonym 4 25
error in my cursor 5 29
SQL Workhours Count beetween Workhours 3 15
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

770 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