当前位置: 首页 > 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> 
http://www.dtcms.com/a/170726.html

相关文章:

  • 模型部署——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注解详解
  • Oracle VirtualBox 在 macOS 上的详细安装步骤
  • 数据同步实战篇
  • HTTP协议(一)
  • ios systeam introduction
  • 【SimSession】1:将视频发送逻辑与 libuv 事件循环集成是一个典型的并发设计问题
  • Android第三次面试总结之activity和线程池篇(补充)
  • 软件架构之旅(6):浅析ATAM 在软件技术架构评估中的应用
  • Webug4.0通关笔记12- 第17关 文件上传之前端拦截(3种方法)
  • OpenHarmony平台驱动开发(一),ADC
  • 人工智能(AI)未来会产生意识吗?