zoukankan      html  css  js  c++  java
  • 转 User has no SELECT privilege on V$SESSION

     
    使用dbms_xplan.display_cursor function的时候发现如下错误。
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------
    User has no SELECT privilege on V$SESSION
    SQL> 
    然后查看官网发现这么几句话:
    This package runs with the privileges of the calling user, not the package owner (SYS). The table functionDISPLAY_CURSOR requires to have select privileges on the following fixed views:V$SQL_PLAN, V$SESSION and V$SQL_PLAN_STATISTICS_ALL.
    也就是说要有,v$sql_plan,v$session,v$sql_plan_statistics_all权限。
    如下:
    SQL> conn sys/root as sysdba
    Connected.
    SQL> grant select on v_$sql_plan to rhys ;
    Grant succeeded.
    SQL> grant select on v_$session to rhys;
    Grant succeeded.
    SQL> grant select on v_$sql_plan_statistics_all to rhys;
    Grant succeeded.
    SQL> conn rhys/amy
    Connected.
     
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------------------------------------------------------------------User has no SELECT privilege on V$SESSION
    SQL>
    依然出错,咋回事?然后继续看联机手册,又发现了这么一句话:
    To use the DISPLAY_CURSOR functionality, the calling user must haveSELECT privilege on the fixed views V$SQL_PLAN_STATISTICS_ALL,V$SQL and V$SQL_PLAN, otherwise it shows an appropriate error message.
    呵呵。那么这就明了,要想使用display_cursor那么必须要有对v$sql,v$sql_plan_statistics_all,v$session,v$sql_pan这四个视图的权限。先看看rhys账户有哪些权限吧:
     
    SQL> conn sys/root as sysdba
    Connected.
    SQL> grant select on v_$sql to rhys;
     
    Grant succeeded. 
    SQL> conn rhys/amy
    Connected.
    SQL> select * from table(dbms_xplan.display_cursor);
     
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID dyk4dprp70d74, child number 0
    -------------------------------------
    SELECT DECODE('A','A','1','2') FROM DUAL
     
    Plan hash value: 1388734953
     
    -----------------------------------------------------------------
    | Id | Operation | Name | Rows | Cost (%CPU)| Time |
    -----------------------------------------------------------------
    | 0 | SELECT STATEMENT | | | 2 (100)| |
    | 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
    -----------------------------------------------------------------
     
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
     
    13 rows selected.
     
    SQL> 
  • 相关阅读:
    Python dict 排序
    解决问题:Appium WebView 跳转页面后无法定位元素
    解决问题:Appium Android WebView 测试执行,从源生切换至WebView不稳定。超时后报chrome not reachable
    uiautomatorviewer获取元素属性,属性列表中缺少resource-id
    解决问题 Jenkins 执行RobotFramework 脚本时未能打开浏览器 只有进程在运行
    解决问题 WebDriverException: Message: unknown error: cannot find Chrome binary
    通过JS操作滚动条
    Python 判断指定路径下文件是否存在
    Linux下安装Oracle 11g
    博客园-评论树
  • 原文地址:https://www.cnblogs.com/hbhzz/p/3998825.html
Copyright © 2011-2022 走看看