In oracle, we cannot grant the privileges on schemas level .If we have to grant the privileges on all the tables of a particular schemas, then it is very tedious to grant privileges on all the tables one-by-one to a particular user. This task can be performed by using a simple pl/sql procedure. Here is a Demo for this :
Suppose we have to grant "select" privileges on all the tables to user then we need to do something like this .
SQL>FOR x IN (SELECT * FROM user_tables)
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || your.table_names || ' TO <<user>>' ;
END LOOP ;
Enjoy :-)
No comments:
Post a Comment