Jul 8, 2011

Can't select data from view [ORA-01031: "insufficient privileges"]

Hello i'm new DBA this is my first article

Problem : I can't select data from view
first i run this command

SQLPLUS / AS SYSDBA
SQL> GRANT SELECT ON SCHEMA_A.VIEWNAME TO SCHEMA_B;

second login to schama B and run this command

SQL> SELECT * FROM  SCHEMA_A.VIEWNAME;
ERROR at line 1:
ORA-01031: "insufficient privileges"


Solution

- Verify this SCHEMA_A.VIEWNAME is select to table , view or execute procedure , funtion in another schema
  • If "yes" you must grant "WITH GRANT OPTION" to SCHEMA_A it will grant to schema B too

example
GRANT SELECT ON SCHEMA_C.TABLENAME TO SCHEMA_A WITH GRANT OPTION;


hope this helps