SP2-0618、SP2-0611 PLUSTRCE授权错误

来源:互联网 发布:centos7 源码安装php 编辑:程序博客网 时间:2024/06/04 00:47
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enable

SP2-0611: Error enabling STATISTICS report


非sys用户使用autotrace来获得执行计划报如下错误
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
第一反应是授予用用户plustrace角色
SQL> conn / as sysdba
Connected.
SQL> grant plustrace to oe;
 grant plustrace to oe
       *
ERROR at line 1:

ORA-01919: role 'PLUSTRACE' does not exist


报角色不存在错误
plustrace角色在数据库创建时并不会创建
这个角色可通过运行下面的sql来创建
$@?/sqlplus/admin/plustrce.sql

SQL> drop role plustrace;
Role dropped.
SQL> create role plustrace;
Role created.
SQL> grant select on v_$sesstat to plustrace;

Grant succeeded.

SQL> grant select on v_$statname to plustrace;
Grant succeeded.
SQL> grant select on v_$mystat to plustrace;
Grant succeeded.
SQL> grant plustrace to dba with admin option;
Grant succeeded.
SQL> set echo off


授予用户plustrace角色
SQL> grant plustrace to oe;
 
Grant succeeded.

启用oe用户autotrace

SQL>conn oe/oe

SQL> set autotrace on
至此问题解决
 
0 0
原创粉丝点击