前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ORA-01919: role 'PLUSTRACE' does not exist

ORA-01919: role 'PLUSTRACE' does not exist

作者头像
Alfred Zhao
发布2022-05-06 15:19:01
3970
发布2022-05-06 15:19:01
举报

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

代码语言:javascript
复制
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即可:

代码语言:javascript
复制
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的角色了:

代码语言:javascript
复制
SYS@orcl> grant PLUSTRACE to jingyu;

Grant succeeded.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-11-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档