I am trying to modify this free script I have obtained but only require select access for the Sequence object but require insert,update,delete,select etc for all other object types such as tables, views , procedures etc. How can I amend this script so that it caters for both types of grants. At presnt i have had to comment out the sequence object but do require the select permission only for sequences. Please advise. I have tried declaring another for loop but not had much luck.
cursor get_obj is
select object_name,owner from all_objects
where owner = 'FLEET_DBA'
-- and object_type IN ('PACKAGE','FUNCTION','PROCEDURE','TABLE','VIEW','SEQUENCE','CLUSTER');
and object_type IN ('PACKAGE','FUNCTION','PROCEDURE','TABLE','VIEW','CLUSTER');
-- and object_name not in (select synonym_name
-- from all_synonyms
-- where owner='PUBLIC');
BEGIN
cursor_id:=dbms_sql.open_cursor;
FOR obj_rec in get_obj LOOP
l_sql := 'GRANT UPDATE,SELECT,INSERT,DELETE on '||obj_rec.object_name||' to '||admrole;
t_sql := 'GRANT UPDATE,SELECT,INSERT,DELETE on '||obj_rec.object_name||' to '||userrole;
dbms_sql.parse(cursor_id,l_sql,1);
dbms_sql.parse(cursor_id,t_sql,1);
dbms_output.put_line(l_sql);
dbms_output.put_line(t_sql);
result := dbms_sql.execute(cursor_id);
Bookmarks