ITPub博客

首页 > 数据库 > Oracle > 启用SQL执行计划,遇到没有启用 PLUSTRACE 角色

启用SQL执行计划,遇到没有启用 PLUSTRACE 角色

原创 Oracle 作者:kkl510331367 时间:2016-08-11 17:21:32 0 删除 编辑

点击(此处)折叠或打开

  1. SQL> show user
  2. USER is "SCOTT"
  3. SQL> set autot on
  4. SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
  5. SP2-0611: Error enabling STATISTICS report
  6. SQL> conn / as sysdba
  7. Connected.
  8. SQL> grant plustrace to scott;
  9. grant plustrace to scott
  10.       *
  11. ERROR at line 1:
  12. ORA-01919: role 'PLUSTRACE' does not exist


  13. SQL> !ls $ORACLE_HOME/sqlplus/admin

  14. SQL> @$ORACLE_HOME/sqlplus/admin/plustrce.sql
  15. SQL>
  16. SQL> drop role plustrace;
  17. drop role plustrace
  18.           *
  19. ERROR at line 1:
  20. ORA-01919: role 'PLUSTRACE' does not exist


  21. SQL> create role plustrace;

  22. Role created.

  23. SQL>
  24. SQL> grant select on v_$sesstat to plustrace;

  25. Grant succeeded.

  26. SQL> grant select on v_$statname to plustrace;

  27. Grant succeeded.

  28. SQL> grant select on v_$mystat to plustrace;

  29. Grant succeeded.

  30. SQL> grant plustrace to dba with admin option;

  31. Grant succeeded.

  32. SQL>
  33. SQL> set echo off
  34. SQL> grant plustrace to scott;

  35. Grant succeeded.

  36. SQL> set autot on
  37. SQL> spool off

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

下一篇: Arry
请登录后发表评论 登录
全部评论

注册时间:2015-07-13

  • 博文量
    13
  • 访问量
    9076