Site icon An Oracle Spin by Alex Lima

How to find definitions of V$, GV$ views?

From v$fixed_view_definition one can find the definitions of V$views which may one in understand them.

Example:
SQL> set pages 0
SQL> SELECT * FROM v$fixed_view_definition where view_name = 'V$SESSION';

V$SESSION
select SADDR , SID , SERIAL# , …. SQL_TRACE_BINDS from GV$SESSION where inst_id = USERENV('Instance')

If one tries to grant direct access to view you will receive ORA-02030 error
SQL> grant select on v$session to scott;
grant select on v$session to scott
*
ERROR at line 1:
ORA-02030: can only select from fixed tables/views

The views are created through the script $ORACLE_HOME/rdbms/admin/catalog.sql

Exit mobile version