使用PL/SQL时, 每次第一次打开表的时候会提示"动态执行表不可访问,本会话的自动统计被禁止"的错误,一消息如下: V$SESSION,V$SESSTAT,V$STATNAME没有被授权,没有权限访问这几张表,所以没有本法进行统计.

当然要给授权了.授权SQL如下:

sqlplus /nolog 进入登录页面,然后执行conn /as sysdba   登录到sys用户

用SYS登录,授权给相应的用户,用下面的语句
grant select on v_$statname to scott;
grant select on v_$sesstat to scott;
grant select on v_$session to scott;
grant select on v_$mystat to scott;

取消权限

revoke select on v_$statname from scott;
revoke select on v_$sesstat from scott;
revoke select on v_$session from scott;
revoke select on v_$mystat from scott;

posted on 2016-06-21 22:18  navyhj  阅读(1549)  评论(0编辑  收藏  举报