PL/SQL Developer – First Query Running Results in Error

oracleoracle-11g-r2plsql-developer

When I run first query in PL/SQL Developer I got the error:

Dynamic Performance Tables not accessible,

Automatic Statistics disabled for this session

You can disable statistics in the preference menu, or obtain select
privileges on the v$session, v$sesstat and v$statname tables

How can I fix the error?

Best Answer

It seems your question contains the answer.

By default PL/SQL Developer gathers statistical data per session for every query.
In the SQL Window and in the debugger's Test Window you can use the Statistics page to view the resources used by the last executed SQL statement or program unit. This information can be a big help when optimizing your SQL or PL/SQL code.
enter image description here
If the user you have logged in, dose not heve the privilege to query on v$ views (as described in the error description) you will not be able to see the statistics result in Test Window and the message will be shown.
To solve the problem you may choose any of the approaches bellow:

  • Grant the user the privilege to select on desired v$ views.
    GRANT SELECT ON sys.V_$SESSION TO scott;
    GRANT SELECT ON sys.V_$SESSTAT TO scott;
    GRANT SELECT ON sys.V_$STATNAME TO scott;

  • Or disable automatic statistics in PL/SQL Developer in preferences menu.

enter image description here