目录
- 1、使用scott用户执行set autotrace traceonly时报错
- 2、切换到sys用户下,给scott用户授权
- 3、通过执行sql文本,创建plustrace角色
- 4、再次给scott用户授权
1、使用scott用户执行set autotrace traceonly时报错
SQL> set autotrace traceonly
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
2、切换到sys用户下,给scott用户授权
sqlplus / as sysdba
grant plustace to scott;
SQL> show user;
USER is “SYS”
SQL> grant plustrace to scott;
grant plustrace to scott
*
ERROR at line 1:
ORA-01919: role ‘PLUSTRACE’ does not exist
说明plustrace这个角色不存在。
3、通过执行sql文本,创建plustrace角色
SQL> @?/sqlplus/admin/plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role ‘PLUSTRACE’ does not exist
SQL> create role plustrace;
Role created.
SQL>
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>
SQL> set echo off
SQL>
4、再次给scott用户授权
SQL>
SQL> grant plustrace to scott;
Grant succeeded.