ORA-01919: role 'PLUSTRACE' does not exist

环境:Oracle 10g,11g.
现象:在一次迁移测试中,发现有这样的角色赋权会报错不存在:

SYS@orcl> grant PLUSTRACE to jingyu;
grant PLUSTRACE to jingyu
      *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist

查询发现这个角色是需要手工执行脚本创建,直接执行Oracle自带的SQL脚本@?/sqlplus/admin/plustrce.sql即可:

SYS@orcl> @?/sqlplus/admin/plustrce.sql
SYS@orcl> 
SYS@orcl> drop role plustrace;
drop role plustrace
          *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist


SYS@orcl> create role plustrace;

Role created.

SYS@orcl> 
SYS@orcl> grant select on v_$sesstat to plustrace;

Grant succeeded.

SYS@orcl> grant select on v_$statname to plustrace;

Grant succeeded.

SYS@orcl> grant select on v_$mystat to plustrace;

Grant succeeded.

SYS@orcl> grant plustrace to dba with admin option;

Grant succeeded.

SYS@orcl> 
SYS@orcl> set echo off
SYS@orcl> 

可以看到这个角色就是封装了对v_$sesstat,v_$statname,v_$mystat这几个视图的查询权限。

执行以后就可以直接赋予用户PLUSTRACE的角色了:

SYS@orcl> grant PLUSTRACE to jingyu;

Grant succeeded.

你可能感兴趣的:(ORA-01919: role 'PLUSTRACE' does not exist)