Dynamic Performance Tables not accessible 问题

使用PL/SQL Dev连接Oracle数据库时,弹出错误信息:

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

    You can disable statistics in the preference menu,

    or obtanin select priviliges on the v$session,v$sesstat and v$statname tables

在网上搜索到解决方案:http://wenku.baidu.com/view/5160ec0ef78a6529647d53a5.html

第一种处理方法(不推荐)

就是在报错的Error对话框中将?Don't show this message again?选项选中,下次就不在提示这个 错误了。 这种方法应该可以叫做“鸵鸟方式‘的处理方法。没有从根本上解决这个问题。

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

报错信息中描述的非常详细,原因是动态性能表没有权利被访问导致的问题,因此,我们通过把所 需访问权限赋予给具体用户的方法来解决这个问题。

这里给出我能想到的三种具体处理方法。大家可以继续补充。

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;

第三种方法(推荐)

彻底禁掉PL/SQL Developer的这个功能。 方法如下: 导航到Tools --> Preferences --> Options 找到"Automatic Statistics"选项,将其前面的小对勾去掉,然后点击"Apply"和"OK"保存退出。

解决方法如下: grant SELECT ANY DICTIONARY to username; 因为v$开头的属于数据字典,通常称为动态性能视图。 解决方法是: 用dba执行下面这句或者在pl/sql中找到username,然后在edit中选择"System privileges"tab, 增加一个"select any dictionary"权限。

grant SELECT ANY DICTIONARY to username;

猜你喜欢

转载自javaanswer.iteye.com/blog/1565931