当前位置: 首页 > news >正文

set autotrace报错

报错:

SQL> set autotrace traceonly
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

原因分析:

根据上面的错误提示“SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled”我们知道是****因为PLUSTRACE角色没有授权给该用户导致的****

解决办法:

重新创建PLUSTRACE用户

SQL> conn / as sysdba
Connected.
SQL> select * from dba_role_privs where granted_role='SQL> conn / as sysdba
Connected.
SQL> select * from dba_role_privs where granted_role='PLUSTRACE';no rows selectedSQL> @?/sqlplus/admin/plustrce.sql
SQL> 
SQL> drop role plustrace;
drop role plustrace*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not existSQL> 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> ';no rows selectedSQL> @?/sqlplus/admin/plustrce.sql
SQL> 
SQL> drop role plustrace;
drop role plustrace*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not existSQL> 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> 

发现sys用户执行成功,但是scott用户执行还是失败

SQL> conn / as sysdba
Connected.
SQL> set autotrace traceonly;
SQL> conn scott/oracle
Connected.
SQL> set autotrace traceonly;
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-061

将统计信息视图权限赋予scott

grant select on v_$sesstat to SCOTT;
grant select on v_$statname to SCOTT;
grant select on v_$mystat to SCOTT;

再次执行成功

SQL>  set autotrace traceonly;
SQL> 

相关文章:

  • 模型部署——cuda编程入门
  • SpringMVC——第五章:视图View
  • qml显示视频帧(QQuickImageProvider)
  • 58认知干货:创业经验分享及企业形式的汇总
  • 【操作系统】深入理解内存管理:从虚拟内存到OOM Killer
  • 从实列中学习linux shell12 通过Shell脚本来优化MySQL数据库性能,特别是慢SQL跟踪和索引优化
  • Java学习手册:MyBatis 框架作用详解
  • 【LLM】deepseek R1之GRPO训练笔记(持续更新)
  • Axure打开html文件失败,解决方案:
  • Three.js在vue中的使用(二)-动画、材质
  • 微服务框架选型
  • 小白机器人假想:分布式关节控制——机器人运动的未来模式?
  • 数字化时代下,软件测试中的渗透测试是如何保障安全的?
  • C# 方法(返回值、返回语句和void方法)
  • spring cloud 与 cloud alibaba 版本对照表
  • HTML04:图像标签
  • 组合模式(Composite Pattern)
  • 【计算机网络】HTTP中GET和POST的区别是什么?
  • 工业大模型:从设备诊断到工艺重构
  • spring中的@ComponentScan注解详解
  • 特朗普关税风暴中的“稳”与“变”:新加坡国会选举观察
  • 两千万粉丝网红“大LOGO”带货茶叶被指虚假宣传,涉事茶企被立案调查
  • 四人自驾游宣恩因酒店爆满无处住宿,求助文旅局后住进局长家
  • 郭少雄导演逝世,享年82岁
  • 五一假期多地政府食堂对外开放:部分机关食堂饭菜“秒没”
  • 5月资金面前瞻:政府债净融资规模预计显著抬升,央行有望提供流动性支持