ITPub博客

首页 > Linux操作系统 > Linux操作系统 > v$mystat does not exist

v$mystat does not exist

原创 Linux操作系统 作者:zhaohf_1106 时间:2011-01-06 09:53:13 0 删除 编辑

Logged in as scott:

scott@EDDEV> select * from v$mystat;
select * from v$mystat
              *
ERROR at line 1:
ORA-00942: table or view does not exist

Obviously, scott did not have the privilege to select from v$mystat. So, I went ahead and logged in as “sys as sysdba” and issued the following grant:

sys@EDDEV> grant select on v$mystat to scott;
grant select on v$mystat to scott
                *
ERROR at line 1:
ORA-02030: can only select from fixed tables/views

OOPS! What’s the problem here?!

Whenever I face a problem that I do not know how to solve, I always search for a solution first before starting to ask questions. So, a simple search for “ORA-02030″ on AskTom revealed that I needed to use v_$maystat instead of v$mystat:

sys@EDDEV> grant select on v_$mystat to scott;
 
Grant succeeded.

Logged in as scott:

scott@EDDEV> select count(*) from v$mystat;
 
  COUNT(*)
----------
       248

It worked. Now scott has access to v$mystat. So, if you want to grant a privilege on a v$ object, make sure you use the corresponding v_$ object. Note that v$ objects are synonyms and v_$ objects are views:

sys@EDDEV> select object_name, object_type
  2  from all_objects
  3  where object_name = 'V$LATCH'
  4  /
 
OBJECT_NAME                    OBJECT_TYPE
------------------------------ ------------------
V$LATCH                        SYNONYM
 
sys@EDDEV> c/V$/V_$
 3* where object_name = 'V_$LATCH'
sys@EDDEV> l
  1  select object_name, object_type
  2  from all_objects
  3* where object_name = 'V_$LATCH'
sys@EDDEV> /
 
OBJECT_NAME                    OBJECT_TYPE
------------------------------ ------------------
V_$LATCH                       VIEW

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10173379/viewspace-683351/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-10-30

  • 博文量
    44
  • 访问量
    109395