Oracle数据库普通用户授权autotrace权限

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:21

今天在RAC虚拟机上用普通用户查看ORACLE执行计划时发现,普通用户没有autotrace权限,报错如下:SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled ,缺少plustrace权限,记录一下处理过程。
第一步:创建plan_table表
[color=#191eff]node2-> sqlplus / as sysdba
[color=#191eff]SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 23 13:47:27 2014
[color=#191eff]Copyright (c) 1982, 2009, Oracle. All rights reserved.

[color=#191eff]Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[color=#191eff]SQL> @?\rdbms\admin\utlxplan.sql
[color=#191eff]Table created.
第二步:创建plan_table同义词
[color=#191eff]SQL> create public synonym plan_table for plan_table;
create public synonym plan_table for plan_table
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
提示已经存在,可以跳过此步
第三步:将同义词plan_table权限赋给普通用户
[color=#191eff]SQL> grant all on plan_table to wxw;
[color=#191eff]Grant succeeded.
第四步:创建plustrace权限,此时脚本内容会自动赋权
[color=#191eff]node2-> cd $ORACLE_HOME/sqlplus/admin
[color=#191eff]SQL> @plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist

[color=#191eff]SQL> create role plustrace;
[color=#191eff]Role created.
[color=#191eff]SQL>
SQL> grant select on v_$sesstat to plustrace;
[color=#191eff]Grant succeeded.
[color=#191eff]SQL> grant select on v_$statname to plustrace;
[color=#191eff]Grant succeeded.
[color=#191eff]SQL> grant select on v_$mystat to plustrace;
[color=#191eff]Grant succeeded.
[color=#191eff]SQL> grant plustrace to dba with admin option;
[color=#191eff]Grant succeeded.
[color=#191eff]SQL>
SQL> set echo off
第五步:将plustrace赋权给普通用户

[color=#191eff]SQL> grant plustrace to wxw;

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】