日期:2014-05-16  浏览次数:20518 次

创建视图需要注意的问题

创建视图报错

SQL> create or replace view stats
  2  as select 'STAT...' || a.name name, b.value
  3        from v$statname a, v$mystat b
  4       where a.statistic# = b.statistic#
  5      union all
  6      select 'LATCH.' || name,  gets
  7        from v$latch
  8    union all
  9    select 'STAT...Elapsed Time', hsecs from v$timer;
      from v$statname a, v$mystat b
                         *
第 3 行出现错误: 
ORA-01031: 权限不足

?解决办法:授权对象v_$statname,v_$latch,v_$timer, v_$mystat

SQL> grant select on v_$statname to carmot_develop;

SQL> grant select on v_$latch to carmot_develop;

SQL> grant select on v_$timer to carmot_develop;

SQL> grant select on v_$mystat to carmot_develop;
?

?