阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

ORA-01919: role ‘PLUSTRACE’ does not exist

126次阅读
没有评论

共计 895 个字符,预计需要花费 3 分钟才能阅读完成。

环境: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.

更多 Oracle 相关信息见 Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计895字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中