PL/SQL Developer报错Dynamic Performance Tables not access

手册/FAQ (489) 2016-04-27 13:46:10

在使用PL/SQL Developer工具登陆一个新创建的用户进行查询时,报出以下错误(PL/SQL Developer版本:7.1.5 1403):

Dynamic Performance Tables not accessible, 
Automatic Statistics disabled for this session 

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

这个报 错 信息在不同的PL/SQL Developer版本都会出现,从上面详细的报错提示信息中我们可以判断得到,报错原因不在工 具 本身。 

在此,详细记录一下这个小问题的三种处理方法。 
1.第一种处理方法(不推荐) 
就是在报错的Error对话框中将“Don't show this message again”选项选中,下次就不在提示这个错误了。 
这种方法应该可以叫做“鸵鸟方式”的处理方法。没有从根本上解决这个 问题。 

2.第二种处理方法(可以采 纳) 

报错信息中描述的非常详细,原因是动态性能表没有权利被访问导致的问 题,因此,我们通过把所需访问权限赋予给具体用户的方法来解决这个问题。 
这里给出我能想到的三种具体处理方法。大家可以继续补充。 

1)如果只是某一具体用户有权限查询这三个动态性能视图,可以如下进 行操作 
这里注意一下:我们授权的视图是V_$session不是 V$session,因为V$session是同名不是具体的视图。否则您会收到下面这个错误。 
sys@ora10g> grant select on V$session  to user_sec; 
grant select on V$session  to user_sec 
                * 
ERROR at line 1: 
ORA-02030: can only select from fixed tables/views 

正确的授权方法如下: 

SQL> grant select on V_$session  to user_sec; 
SQL> grant select on V_$sesstat  to user_sec; 
SQL> grant select on V_$statname to user_sec; 

2)可以使用下面这个“简单粗暴”的方法处理之。 

SQL> grant Select ANY DICTIONARY to user_sec; 

3)以上两种方法是针对特定用户的处理方法,如果想让所有用户(不局 限在上面的user_sec用户)都能够查询这三个动态性能视图,可以通过将查询权限授权给public方法来实现,操作如下。这样就可以保证所有开发人 员都不会再出现上述的报错信息了。 

SQL> grant select on V_$session  to public;
SQL> grant select on V_$sesstat  to public;
SQL> grant select on V_$statname to public; 

THE END