【小错误】SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled

1.今天在scott用户下执行语句跟踪时报了如下错误:

SCOTT@ORA11GR2>set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

2.通过上述问题分析,是由于scott用户没有PLUSTRACE角色,执行PLUSTRACE角色:

[oracle@host02 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/
[oracle@host02 admin]$ ls
glogin.sql help libsqlplus.def plustrce.sql pupbld.sql
[oracle@host02 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin SYS@ORA11GR2>@/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/plustrce.sql
SYS@ORA11GR2>
SYS@ORA11GR2>drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist SYS@ORA11GR2>create role plustrace; Role created. SYS@ORA11GR2>
SYS@ORA11GR2>grant select on v_$sesstat to plustrace; Grant succeeded. SYS@ORA11GR2>grant select on v_$statname to plustrace; Grant succeeded. SYS@ORA11GR2>grant select on v_$mystat to plustrace; Grant succeeded. SYS@ORA11GR2>grant plustrace to dba with admin option; Grant succeeded. SYS@ORA11GR2>
SYS@ORA11GR2>set echo off

3.将plustrace角色给scott用户:

SYS@ORA11GR2>grant plustrace to scott;

Grant succeeded.

SYS@ORA11GR2>conn scott/tiger
Connected. Session altered. SCOTT@ORA11GR2>set auto on

这样scott用户就可以开启会话跟踪了。

上一篇:【ORA】ORA-00030: User session ID does not exist.


下一篇:Oracle set autotrace 时提示:Cannot find the Session Identifier. Check PLUSTRACE role is enabled