使用hr用户查看执行计划时报错
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
原因是该用户没有PLUSTRACE这个用户导致的。
SYS@PROD1> grant plustrace to hr; --尝试授权提示不存在。
grant plustrace to hr
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist
然后准备用脚本创建用户
SYS@PROD1> start ?/sqlplus/admin/plustrce.sql
SYS@PROD1>
SYS@PROD1> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist
SYS@PROD1> create role plustrace;
Role created.
SYS@PROD1>
SYS@PROD1> grant select on v_$sesstat to plustrace;
Grant succeeded.
SYS@PROD1> grant select on v_$statname to plustrace;
Grant succeeded.
SYS@PROD1> grant select on v_$mystat to plustrace;
Grant succeeded.
SYS@PROD1> grant plustrace to dba with admin option;
Grant succeeded.
SYS@PROD1>
SYS@PROD1> set echo off
SYS@PROD1> grant plustrace to hr; --授权成功
Grant succeeded.
HR@PROD1> conn hr/hr
Connected.
HR@PROD1> set autotrace on
HR@PROD1>
查看执行计划成功,解决。