Skip to main content

grant select on all tables in a schema



GRANT  SELECT on all tables in a schema

Single statement to grant privileges

FOR  x  IN (SELECT * FROM user_tables)
LOOP
 EXECUTE IMMEDIATE  ‘GRANT SELECT ON  ‘ || x.table_name || ‘  TO  << someone >>’ ;
END LOOP;

OR

DECLARE
CURSOR  cur1 IS SELECT TABLE_NAME from user_tables;
cmd varchar2(200);
BEGIN
FOR c in c1 LOOP
cmd := ‘GRANT SELECT ON ‘||c.table_name||<< TO YOURUSERNAME>>’;
execute immediate cmd;
END LOOP;
END;

Comments

Popular posts from this blog

ORA-01033 Oracle initialization or shutdown in progress

ORA-01033 Oracle initialization or shutdown in progress When you connect oracle 12c plug gable database, Thus time you have get oracle initialization or shutdown in progress error. This error occurred because pluggable database are not initialized. To fix this error connect as sysdba and run  ALTER PLUGGABLE DATABASE ALL OPEN    command. ALTER PLUGGABLE DATABASE ALL OPEN Thanks.

Checking operating system version: must be 5.0, 5.1 or 5.2 Actual 6.1 Failed

This error occurred when we are installing old oracle software in latest OS (Operating System).   Basically Its’s occurring on windows platform.

AFTER LOGON Trigger not perfectly working

AFTER LOGON not perfectly working.  I have tried it on single instance oracle 12c database it's perfectly work but it's not perfectly working on multi instance Oracle 12c database. I have submitted this matter in oracle forum but not found any perfect answer. Do you know why  it's not working ???