ORACLE的普通用户获得 V$STATNAME、V$MYSTAT、V$LATCH的访问授权

来源:互联网 发布:javascript难学吗 编辑:程序博客网 时间:2024/05/18 20:08

要使用runstats,需要能访问几个神奇的动态性能表:V$STATNAME、V$MYSTAT 和 V$LATCH。

例如:创建视图

create or replace view stats
as select 'STAT...'||a.name name,b.value
from v$statname a,v$mystat b
where a.statistic#=b.statistic#
union all
select 'LATCH.'||name,gets
from v$latch;

但是普通用户需要获得授权才可以使用,通过sqlplus用管理员身份连接到数据库给普通用户授权:

grant select on V_$STATNAME on SCOTT;

grant select on V_$MYSTAT on SCOTT;

grant select on V_$LATCH on SCOTT;

原创粉丝点击