Search This Blog

Friday, December 1, 2017

ORA-02030: can only select from fixed tables/views

Description :
***********
A quick solution to solve ORA-02030 error.

Problem :
********
When i try to grant select right to a user on v$views, you get an error - "ORA-02030: can only select from fixed tables/views"

SQL> grant select on v$LOCK to USER1;
grant select on v$LOCK to USER1
                *
ERROR at line 1:
ORA-02030: can only select from fixed tables/views



Reason :
********
You can not grant select right to V$ views directy, looks we need to find the base table name here and apparently the object also name should be in capital letters, so, you Should grants the select rights on base tables and not on v$views.


Solution:
********
SELECT 'grant select on ' || table_name || ' to <username>;'
  FROM dba_synonyms
 WHERE LOWER (synonym_name) IN (SELECT LOWER (object_name)
                                  FROM dba_objects
                                 WHERE LOWER (object_name) IN ('v$_lock',
                                                               'v$sqlarea',
                                                               'v$process'));

Sample Output :
**************
SQL> grant select on  V_$SQLAREA to USER1;

Grant succeeded.