Solved

Perennial Grant Select On Schema

Posted on 2014-07-22
1
549 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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now